About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Gui always under mouse
Author Message
Houge Offline
Silver Supporter

Post: #1
Gui always under mouse
Hello, I need some help with Gui objects, here is simple code example:

Code:
/******************************************************************************/
void InitPre() // init before engine inits
{
   EE_INIT(); // call auto-generated function that will setup application name, load engine and project data
   SimulateTouches(true);
}
/******************************************************************************/
bool Init() // initialize after engine is ready
{    return true;    }
/******************************************************************************/
void Shut() // shut down at exit
{ }
/******************************************************************************/
bool Update() // main updating
{
   if(Kb.bp(KB_ESC))return false; // exit if escape on the keyboard pressed
  
   Gui.update();
   if(MT.bp(0) && MT.guiObj(0) != null)
   {
      Gui.msgBox("", S + &Gui + " " +
                     MT.guiObj(0) + " " +
                     MT.guiObj(0)->desc() + " " +
                     MT.guiObj(0)->visible() + " " +
                     MT.guiObj(0)->enabled());
   }
   return true;
}
/******************************************************************************/
void Draw() // main drawing
{
   D.clear(TURQ);
   Gui.draw();
   D.text (0, 0, "Hello to Esenthel Engine !");
}
/******************************************************************************/

As you can see there is no Gui at all, but if i press mouse button, message box always returns information, that i pressed Gui object that is visible and active. What am i doing wrong? I just want to test that there is no Gui under mouse when i press buttons.

P.S. you can remove SimulateTouches, the result will be the same.
(This post was last modified: 12-11-2016 01:40 PM by Houge.)
12-11-2016 01:38 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #2
RE: Gui always under mouse
This is because you still got Gui.desktop() if you add object!=Gui.desktop()(this is the actual Gui parent which your first window or so gets added to) it works.
(This post was last modified: 12-11-2016 02:06 PM by Zervox.)
12-11-2016 02:05 PM
Find all posts by this user Quote this message in a reply
Houge Offline
Silver Supporter

Post: #3
RE: Gui always under mouse
I knew that there is a simple solution! Thank you very much, Zervox! smile
12-11-2016 02:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #4
RE: Gui always under mouse
Had the same headscratcher two weeks ago. wink
12-11-2016 02:29 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #5
RE: Gui always under mouse
Yea the global objects are easy to be forgotten.
12-12-2016 03:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply