interkosmos/fortran-sdl2

About the SDLK constants

angelog0 opened this issue · 5 comments

As I wrote elsewhere, after recent changes, this code

write(*,'(A,i0)') 'KEY = ', event%key%key_sym%sym

now works and prints the right values (ASCII code) of the key pressed

So we need the definition for SDLK_ESCAPE and friends which seem are not yet implemented. With those constants this code would work (see #4) too:

if (event%key%key_sym%sym == SDLK_ESCAPE) r = .true.

Out of curiosity: why don’t you just use sdl_get_keyboard_state() to handle the keyboard input?

The SDL keycodes have been added with commit 1a51d2f.

Thanks for the commit.

If event%key%key_sym%sym works I could write a routine which return the code of key pressed and the process that code...

key = getevent()

select case (key)
...

@interkosmos wrote:

The SDL keycodes have been added with commit 1a51d2f

Maybe we need also SDL_BUTTON... etc. constants?

Thanks.

SDL_BUTTON* parameters have been added with commit 9ebb8e4. Please see example events.