Jump to content

  • Log In with Google      Sign In   
  • Create Account


Chris528

Member Since 25 Aug 2007
Offline Last Active Nov 24 2013 01:50 PM
-----

#5101356 Problem with Key presses in SDL 2.0

Posted by Chris528 on 14 October 2013 - 01:18 PM

You may create a bool variable to track the state of your 'backface culling'...

 

So when the key_3 is released you set it to true, nex time set it to false... 

 

 

Thats the idea...

 

(sry about my english.. its not so good )

Thanks, but that's how i had already coded it. otherwise it wouldn't have toggled at all. Here's my current code, I'm just not sure where to go from here http://privatepaste.com/990f8f54f7




#5101237 Problem with Key presses in SDL 2.0

Posted by Chris528 on 14 October 2013 - 04:10 AM

Hi, I'm currently working on a model viewer and I've come across an have issue that's driving me crazy. I wanted to toggle backface culling with the number 3 key, so I went ahead and and implemented it. But my problem is that the keydown event is triggered for as long as I'm holding the key down, which means that pressing the 3 key for about a half second toggles backface culling about 20 times. Do i somehow reset the key after It is pressed so It is no longer active on the next frame even if its still being pressed? If so how would I accomplish that? The SDL 2 documentation seems pretty useless in this regard, and I haven't been able to find any useful info anywhere else.




PARTNERS