Jump to content

Official GUI Tutorial shoud be put in Learn Section

Recommended Posts

As any others engine features which were introduced in Learn section (Editor Interface, Light, Textures, Materials etc) GUI should be put in there. Newbies need to learn how to use GUI too

Share this post

Link to post

I've mentioned it before that entire sections like Widget (GUI) and Sprite don't have a single C++ example and so you're forced to hunt and pick through whatever the community may have posted, and maybe to convert from Lua to C++ or the reverse, hoping you can figure the code out.  Someone was kind enough to post a GUI tutorial but he claims C++ requires Lua, which I don't believe is correct.

Share this post

Link to post

I agree there needs to be some official tutorial..

Off topic:
As for my "claim" that the widget system relies on lua scripts(even by using c++), proof exists and you can easily validate it.

run this c++ code and you will see a panel is drawn.
rename/remove the script "Scripts/GUI/Panel.lua" and you will see your gui no longer works.
the reason for this is because each widget(gui element)  its functionality and rendering is done by those scripts.

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
	Leadwerks::Window* window = Leadwerks::Window::Create();
	Context* context = Context::Create(window);

	GUI* gui = GUI::Create(context);

	//this widget no longer works if you rename/remove "Scripts/GUI/Panel.lua" 
	Widget* panel = Widget::Panel(25, 30, 150, 200, gui->GetBase());

	while (true)
		if (window->Closed() || window->KeyDown(Key::Escape)) return false;
		context->SetColor(0, 0, 0, 0);

	return 0;


Share this post

Link to post

I think I misunderstood you then.  I thought you needed to code partly in Lua to use the GUI, which didn't make sense to me.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...