GadgetUK Posted June 1, 2013 Share Posted June 1, 2013 Is there an easy way to check if opt1, opt2 or pause have been pressed? At the moment in my games I am using:- temp = kbhit(); To identify if any of the 3 have been pressed but they all register the same value I think. Does anyone know if there's a quick way to detect these on an individual basis? Quote Link to comment Share on other sites More sharing options...
LX.NET Posted June 2, 2013 Share Posted June 2, 2013 Here's a piece of code that might help you get started: // Wait for user to press Option 1 while (true) { if (kbhit()) { key = cgetc(); if (key == 'F') tgi_flip(); if (key == '1') break; } } It might be a bit weird example, but it reads the "character" that is read from the "console". It will wait till Option1 is pressed. If you press Flip in the meantime, it will do the flip while waiting for Opt1. From the cgetc.s source code: ; The Atari Lynx has a very small keyboard - only 3 keys ; Opt1, Opt2 and Pause. ; But the designers have decided that pressing Pause and Opt1 at the ; same time means Restart and pressing Pause and Opt2 means Flip screen. ; For "easter egg" use I have also included all three keys pressed '?' ; and Opt1 + Opt2 pressed '3'. ; So the keyboard returns '1', '2', '3', 'P', 'R', 'F' or '?'. Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted June 2, 2013 Author Share Posted June 2, 2013 Thanks, I should have thought about looking there. I am sure I tried to check the response from kbhit months ago and it came back with the same value regardless of which button was pressed - but that was an older version of CC65, maybe it has been fixed. Quote Link to comment Share on other sites More sharing options...
+karri Posted June 2, 2013 Share Posted June 2, 2013 kbhit returns a boolean value. cgetc waits until a key is pressed and returns the right kay value. Harry Dodgson created the routine to have the correct timing, look and feel for rhe keys. Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted June 7, 2013 Author Share Posted June 7, 2013 Thanks! For future reference if anyone find this post using search, this is Karris other reply on the same subject and including flipping the screen and controls. http://atariage.com/forums/topic/212999-flip-left-handed/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.