You are not logged in.
There are a few different input modes, each with a main loop roughly like this:
jrbutton: MACRO ld a, [hJoyPressed] and \1 jr nz, \2 ENDM MainLoop: call DelayFrame ; ...redraw some tiles here... call GetJoypad jrbutton D_LEFT, .left jrbutton D_RIGHT, .right jrbutton D_DOWN, .down jrbutton D_UP, .up jrbutton A_BUTTON, .a jrbutton B_BUTTON, .b jrbutton START, .start jpbutton SELECT, .select ; prioritize refreshing the note display ld a, 2 ld [hBGMapThird], a jr MainLoop
The button-handling subroutines .left, .right, etc, do not write to [hJoyPressed].
The problem: I want the song list (the right screenshot) to continuously scroll when I hold Up or Down. I've looked at the standard menu code for pokecrystal, comparing the non-continuous Start menu and the continuous item menus, but can't figure out how to allow this. Any help, please?
(If anyone wants to compile the project—with rgbds 0.3.1—and give me feedback on the UI usability before I write documentation for it, that would be great too. It's a challenge fitting features into eight buttons and 160x144 pixels.)
Last edited by Rangi (2017-08-01 06:11:06)
I solved this! Just had to read from hJoypadDown instead of hJoypadPressed. This comment in home/joypad.asm explained it:
; hJoypadReleased: released this frame (delta) ; hJoypadPressed: pressed this frame (delta) ; hJoypadDown: currently pressed ; hJoypadSum: pressed so far
I also had to add a short delay before allowing another button event, since otherwise it would scroll too fast.
Here's the commit that implements continuous scrolling.