|
-
November 23rd, 2016, 02:06 PM
#2
Re: (OpenGL) Possible to achieve keyboard() functionality outside of keyboard()?
keyDown is an array of 255 elements of type bool indexed by the ASCII value of a character. When a key is pressed, keyboard() is entered which sets the required element of keyDown to true, and when key is released, keyboardUp() is entered which sets the required element of keydown to false. So the array keyDown determines which key(s) are down at any time.
Where in checkKeyboard() are you using this code? Where are you defining b? If this is from the suggested code in post #8 here http://forums.codeguru.com/showthrea...-for-quot-loop, then b is only available if the first if statement following the for is true for the block of the if statement.
It would be helpful if you posted all the code for the function checkKeyboard().
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|