• Advertisement
Sign in to follow this  

toggling buttons and user interface

This topic is 3133 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi guys i was just wondering how i would toggle a bool value off using one key. and also how would i implement a user interface into an app for instance: i have an application which renders simple geometry and i want to add the button which puts on the FPS: counter box. how would i go about doing this?

Share this post


Link to post
Share on other sites
Advertisement
Toggling a value on a key press is straightforward. Just use the windows messaging loop.


bool blarg = false;
//
//
//
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
//If bool is true set to false else set to true
(blarg == true) ? (blarg = false) : (blarg = true);
break;
}
return 0;


Share this post


Link to post
Share on other sites
thanks alot guys!

ahh i think i like the second way better. simplicity wins the day :D

Share this post


Link to post
Share on other sites
Quote:
Original post by CirdanValen

myBool = !myBool;



Lol that would have made more sense. Don't even ask me why I used the other operator cos I couldn't tell you!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement