The mouse events (MOUSEBUTTONDOWN, MOUSEMOTION, MOUSEBUTTONUP, and MOUSEWHEEL) have a which field that identifies the mouse that generated the event. When equal to pygame_sdl2.TOUCH_MOUSEID, the event was generated by a touch of the screen.
I am not familiar with the term "field ". Basically, I am trying to implement a Joypad with four buttons (UP, DOWN, RIGHT, LEFT) which is just a draw in the bottom left of the display.
When the user touches (e.g.) RIGHT the character of the game must move to the right.
I have implemented my code like so:
if ev.type == pygame.MOUSEMOTION or ev.type == pygame.MOUSEBUTTONDOWN or ev.type == pygame.TOUCH_MOUSEID:
hero.move(joypad.btn_pressed(ev))
But I'm not really sure if this is the right way to go.
Just talking about the pygame_sdl2.TOUCH_MOUSEID: is it used how it is supposed to?
My game works fine from desktop with the mouse, while on mobile is working but thwe movements are kind of messy (sometimes it moves the wrong way for instance...).
I guess it might be due to the fact that my finger is not like a mouse pointer and it's more like many conurrent clicks (is it?). And also is not "as thin as a pointer" (meaning that I can press by mistake more than one direction at a time I guess).
I just need to know more about this pygame_sdl2.TOUCH_MOUSEID possibly.
Hi,
in the documentation it reads:
I am not familiar with the term "field ". Basically, I am trying to implement a Joypad with four buttons (UP, DOWN, RIGHT, LEFT) which is just a draw in the bottom left of the display. When the user touches (e.g.) RIGHT the character of the game must move to the right. I have implemented my code like so:
But I'm not really sure if this is the right way to go.
Just talking about the
pygame_sdl2.TOUCH_MOUSEID
: is it used how it is supposed to? My game works fine from desktop with the mouse, while on mobile is working but thwe movements are kind of messy (sometimes it moves the wrong way for instance...).I guess it might be due to the fact that my finger is not like a mouse pointer and it's more like many conurrent clicks (is it?). And also is not "as thin as a pointer" (meaning that I can press by mistake more than one direction at a time I guess).
I just need to know more about this
pygame_sdl2.TOUCH_MOUSEID
possibly.Thanks!