Re: SDL_GetMouseState - Solved
- Posted by ChrisB (moderator) Jan 25, 2023
- 740 views
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