Jump to content

GUI


Slimwaffle
 Share

Recommended Posts

that is one option.
i recommend moving the event loop outside of the menu file though.
then call processevent(event) with a return value on any table that needs to process events.

for example in my current c++ project i actualy have a class called GUIManager which holds the event loop.
which in turn calls other gui classes to update and grab events.
when that call returns true then the event is processed and there is no need to call other classes with that event.


example code(C++) :

	//Handle GUI events
	while (EventQueue::Peek())
	{
		Event event = EventQueue::Wait();
		//
		//Update menu UI events
		if (!gamemenu->Hidden())
		{
			//exit game
			if (gamemenu->ProcessEvent(event) == false) return false;
		}
      		//update game UI events
		if (!gameui->Hidden()) gameui->ProcessEvent(event);
	}

 

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...