After you use GetKey(int* key) return after you press Menu? I've got some code that is basically:
Code:
main() {
  int key;
  FillScreen(COLOR_GREEN);
  Flip();
  while (1) {
    key = PRGM_GetKey();
    if (key == KEY_PRGM_MENU) {
      GetKey(&key);
      FillScreen(COLOR_BLACK);
      Flip();
    }
  }
}
(Flip is just an alias to that unmemorable Bdisp_something_something command) What happens when I run that is: the screen turns green, I press Menu, and it goes straight to the menu, go back to the program, and it flashes black, and then turns green again. So, does GetKey() return directly where it left off, or does it do something crazy with block?

Edit: Nevermind. I'm stupid. My error was that this was part of a bigger piece of code, so there were two loops (while (forever); and while(!forever)Wink and I forgot to fix the error condition from the first loop when it goes back around. So, it was turning green again because that first loop decided to exit on its first go and then went straight into the other block that looks like the code above.
It returns to the next instruction, just like an interrupt! You're not using the best getKey code that you could be using, though. Wink
Doesn't seem slow to me Wink And, yeah, I figured it came back right after the call, but that test seemed to be disproving it. I just forgot to fix my X and Y variables to reasonable values Razz
_player1537 wrote:
Doesn't seem slow to me Wink And, yeah, I figured it came back right after the call, but that test seemed to be disproving it. I just forgot to fix my X and Y variables to reasonable values Razz
Ah, glad that you got it resolved. Smile And please excuse me, then; I was thinking that the WaitKeyOS was much faster.
I mean, I don't really know for sure, but I haven't noticed it be extremely slow. I think it'd be interesting to see the speed comparison at some point.
_player1537 wrote:
I mean, I don't really know for sure, but I haven't noticed it be extremely slow. I think it'd be interesting to see the speed comparison at some point.
Since we have access to the Real-Time Clock (RTC) ticks, it would be pretty straightforward to run that test. Smile I'll have to do that one day.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement