Re: SDL_GetMouseState - Solved
- Posted by Icy_Viking Jan 26, 2023
- 787 views
ChrisB said...
Hi,
yup, that idea works perfectly.
------------------------------------------------------------ --note these are decalared outside of the function, so don't need to keep recreating them atom mousePtr = allocate_struct(SDL_Point) atom Amx, Amy --this way - create and SDL_Point structure, and pass those addresses to the SDL_GetMouseState function Amx = mousePtr Amy = mousePtr + sizeof(C_UINT32) function scanMouse_b(atom e) ------------------------------------------------------------ sequence scanned = repeat(0, sizeof(SDL_Event)) integer event_type = peek_type(e, C_UINT32) integer mx, my, mouseState mouseState = SDL_GetMouseState(Amx,Amy) mx = peek4u(Amx) my = peek4u(Amy) printf(1, "%d , %d \n", {mx,my}) return eMouse end function
And also note the use of ffi - I understand it so much better now, and much easier than before. You're not allowed to change it Greg.
Cheers
Chris
That's great Chris! SDL is currently on 2.26.2, I think I have that version updated for the SDL2 wrapper. Hopefully Greg makes his return soon. Getting Euphoria up to date is important.