[solved] Clicking buttons without text or image?

Started by Tamanegi, Sat 22/01/2011 04:10:47

Previous topic - Next topic

Tamanegi

Okay, my problem has changed, now I found out that my button clicks don't register because they have neither text nor graphics... but I need to have them there and have them clicked. Is there something I can do?
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

monkey0506

You could do some boundary checking in on_event:

Code: ags
function on_event(EventType event, int data)
{
  if (event == eEventGUIMouseDown) // consider using eEventGUIMouseUp instead if it fits your needs better
  {
    if (data == btnNothing.OwningGUI.ID)
    {
      int xx = btnNothing.OwningGUI.X + btnNothing.X;
      int yy = btnNothing.OwningGUI.Y + btnNothing.Y;
      if ((mouse.x >= xx) && (mouse.x <= (xx + btnNothing.Width)) && (mouse.y >= yy) && (mouse.y <= (yy + btnNothing.Height)))
      {
        // ..clicked on btnNothing..do something here
      }
    }
  }
}

Tamanegi

Thanks, seems like this is the only solution... I thought that maybe there was an attribute I could change to do it.

I handled it by checking the coordinates of clicks on the GUI.
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

SMF spam blocked by CleanTalk