I’m perplexed, my menu system works with it’s own event system, touch’s work, but once I go in game 3D the touch system sometimes work, but most of time it doesn’t.
if (event.type == SDL_FINGERMOTION)
{
if (event.tfinger.fingerId == 0)
{
if (bf1 == false)
bf1 = true;
Thats my output when not working, i
MouseX: -0.016728
MouseY: 0.014660
UPDATE FIXED seems like the event works different to SDL 2.10
Solution that worked, but still there seems to be a leak or something, depending on the run, it gives different results. Might be related to the screencreation.
it says “0 is an invalid ID” and that “ID is valid for the time the finger (stylus, etc) is touching and will be unique for all fingers currently in contact”. so I think the ID could be any number, and you should be aware of this and keep track of it. this if (event.tfinger.fingerId == 0) is kinda sus
edit: I have zero experience with development for touchscreen devices
It was working before using SDL 2.10. It sometimes works sometimes doesn’t. It’s like the events are getting corrupted, there is some type memory leak. The problem is intermittent.
This is using a mouse click and move, currently testing on an emulator.
Its coming as zero, if I was to try it on my phone it would be 1 for the second touch.
This is running from main, but if I was run it from my input object in the game, X and Y’s come up as 0.5
I purged my code and just left the above code in my input loop and still coming up with those values. Then ran the same code from main.cpp and it works first time.
I ran it in my first menu system, same 0.5 values. How bizarre.
I figured it out!
it’s connected to the SDL createWindow, SDL Render. I had code that created the Window, then destroyed it then I created a new one because of a previous bug I had in SDL 2.10 not going into fullscreen. Now my OpenGL Objects are rotating really fast and frame rate is 60fps, same as before. How bizarre. Fixed one thing, now have another! The SDLcreateWindow, Render being called and destroyed then created again must of messed up SDL events in this 2.30.10 version.