|
Post by rosy on Oct 31, 2021 7:37:42 GMT -6
How to check if any key is pressed? I used to use Inkey, but now it works intermittently.
|
|
|
Post by n00b on Nov 1, 2021 6:15:43 GMT -6
I have been looking at inkey and have tested it on windows, linux, and mac repeatedly and I am not getting any of the issues you are having. johnno56 have you been able to reproduce rosy issue. In the meantime, @j7m made a function that gets keypresses in his Galaxy Ranger game. Its pretty clean and easy to understand code. Galaxy Ranger GitHub
|
|
|
Post by rosy on Nov 1, 2021 6:32:30 GMT -6
So how in the loop you have PRINT Inkey and you have pressed the key, it never displays 0 ??
|
|
|
Post by n00b on Nov 1, 2021 7:53:39 GMT -6
I can post a video when I get home from work today showing an example of it working on my computer. I just don't get the errors that you are.
|
|
|
Post by rosy on Nov 1, 2021 11:23:48 GMT -6
|
|
|
Post by rosy on Nov 13, 2021 13:43:52 GMT -6
And you changed something in the Inkey function that now works differently?
|
|
|
Post by aurel on Nov 14, 2021 3:00:34 GMT -6
rosy please next time use some sort of video capture program or hold smartphone in one position ...i cannot figure from your video what is what all i see you movin left-right and showing your monitor
|
|
|
Post by n00b on Nov 15, 2021 8:46:52 GMT -6
rosy The only thing that changed with Inkey() is a bug that was fixed in the last version that caused multiple key presses to be registered each time you press a button. I have not had time to look at this specific issue yet.
|
|
|
Post by rosy on Feb 26, 2022 15:11:08 GMT -6
What exactly did you change? Because I have a suspicion that maybe the action has changed in SDL itself in newer versions. Where do you have the source code for handling functions in RC?
|
|
|
Post by n00b on Feb 26, 2022 20:14:23 GMT -6
Where do you have the source code for handling functions in RC? RCBasic GitHubLook in rcbasic_runtime/rc_media.h. InKey() is located at line 4658. It returns a value that is set on line 4326.
|
|
|
Post by rosy on Feb 27, 2022 4:02:09 GMT -6
THIS IS nothing special except I can't see rc_inkey = 0. How was it before?
|
|
|
Post by n00b on Feb 27, 2022 21:22:28 GMT -6
rc_inkey = 0 is on line 293 in main.cpp. I don't remember what it was like before. I have probably made over 100 changes since I fixed this issue.
|
|
|
Post by rosy on Feb 28, 2022 2:20:55 GMT -6
case SDL_QUIT: SDL_PumpEvents(); //rc_media_quit(); exit(0); break;
I don't understand that either. You exit the program without calling SDL_Quit, and so on. ? And why SDL_PumpEvents () before exiting?
|
|
|
Post by aurel on Feb 28, 2022 3:39:27 GMT -6
from wiki
SDL_PumpEvents() gathers all the pending input information from devices and places it in the event queue. Without calls to SDL_PumpEvents() no events would ever be placed on the queue. Often the need for calls to SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not polling or waiting for events (e.g. you are filtering them), then you must call SDL_PumpEvents() to force an event queue update.
|
|
|
Post by rosy on Feb 28, 2022 7:59:37 GMT -6
You did not understand the question ...
I don't understand yet why one of the functions is defined twice ... And I'm curious how PrintS works. Any default font loaded? I can't find the printRGB function either ...
|
|