Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Official GUI Tutorial shoud be put in Learn Section


Recommended Posts

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.

Link to post
Share on other sites

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);
		context->Clear();

		context->Sync();
	}
	return 0;
}



 

  • Upvote 1
Link to post
Share on other sites
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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...