GUI Button Problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

GUI Button Problem

Post by keless »

Okay, im working on IrrLicht Tetris some more, even though I should be working on other things :wink:

Currently, I am implementing the 'Start Over' and 'Paused' buttons that will pop up when you lose or pause the game.

The Start Over button works fine, but I have a strange problem with Paused:
when you push 'p' it should pop up as well as pause the game. However, currently if you push 'p' once, it will only pause the game. Only if you then push 'p' a second time, the button will show.

After it shows, you can click the button to resume the game and the button is set to invisible (which is working correctly).

My code is as follows:
1) initialization function:
creates the buttons and sets them to Visible(false)

2) update function:

Code: Select all

if(m_mode == GSM_MODE_PLAY) {
  if(keys[irr::KEY_KEY_P]) {  //game pause
    m_btn_paused->setVisible(true);
    m_mode = GSM_MODE_PAUSED;
    return;
  }
the weirdest thing about this is that I only check KEY_KEY_P when in PLAY mode, and the first time you push 'P' it sets PAUSED mode-- which means I'm no longer in PLAY mode and should not be checking the 'p' key any more. But the button only shows up if you push the 'p' key, and only the 'p' key, a second time.

wierd?!
a screen cap is worth 0x100000 DWORDS
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

never mind this whole thread, i got it working, it was a problem of my own-- not IrrLicht's
a screen cap is worth 0x100000 DWORDS
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

keless wrote:never mind this whole thread, i got it working, it was a problem of my own-- not IrrLicht's
Hehe, always nice to hear. Less work for me. :)
Post Reply