Jump to content
IGNORED

Detecting long-presses


nsn

Recommended Posts

Hi!

 

I need a second "gesture" in my game (to switch between different display modes), and I don't want players to have to reach for any of the h/w switches on the console - so I want to detect whenever the player presses the fire button for a significant duration (say 500ms?)

 

Are there any best practices to do this? Preferably w/o using a byte of ram for counting frames?

 

I'm using plain assembler, no bAtari basic

 

thanks!

Link to comment
Share on other sites

I think you have to count frames. For 500ms it's only 5 bits though. Just increment the variable every frame. And with $e0 if button isn't pressed. If count exceeds threshold switch modes. You could make $20 the flag for displaying the other mode so you switch modes for free once it counts to 32 frames. Then you can and with $C0 regardless of the display mode and releasing the button switches back to the original mode.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...