Sign in to follow this  
emforce

toggling buttons and user interface

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this