Jump to content
Entries in this blog
There is a problem with the default TextArea.lua widget script.
Your game will crash when you click on an empty TextArea.
look for the Function "Script:GetCaretCoord(caret)"
local text = self.lines[self.currentline]--self.widget:GetText()
if text == nil then return 0 end
More will be added when/if discovered...
Remember that a widget's behaviour is dictated by the script that is attached to it.
Well its that simple just use a custom script for your widget and your done.
I will show you how to create a simple ColorLabel.
First copy the default Label.lua script and rename it to Colorlabel.lua
Now lets make some changes in your Colorlabel.lua so open it up.
We will add 2 variables to the script called bordercolor and textcolor they will be of type Vec4().
Script.bordercolor = Vec4(0.2,0.2,0
Previously we created a custom class and a basic GUI.
Now its time to add some basic widgets to our class and show how to use them.
Lets start with a simple Panel that has a Label, a TextField and a Button.
Widget* panel = NULL;
Widget* label = NULL;
Widget* textField = NULL;
Widget* button = NULL;
//panel = Widget::Panel(guiScale * 100, guiScale * 100, guiScale * 300, guiScale * 80, gui->GetBase());
panel = Widge
Bare with me im not a very good story teller .
I will not be focusing on basic leadwerks usage and assume the reader knows a thing or 2 about leadwerks.
So lets start with the basics,
Create a window and context.
window = Leadwerks::Window::Create("GUI Tutorial", 0, 0, 1024, 768);
context = Leadwerks::Context::Create(window);
if (window->Closed() || window->KeyHit(Key::Escape)) return false;