milkytracker / MilkyTracker

An FT2 compatible music tracker
http://milkytracker.github.io/
Other
1.69k stars 162 forks source link

Wayland support/touch support #209

Closed TheMorc closed 4 years ago

TheMorc commented 4 years ago

Hi, i want to know if there's a simple way to implement touch support or even support for Wayland. I actually compiled it for Sailfish OS and it actually works, but without touch or orientation

Deltafire commented 4 years ago

Touch is already supported via mouse emulation, it should "just work". There isn't any gesture support however.

Wayland is supported if libsdl2 supports it.

TheMorc commented 4 years ago

Oh right, so orientation isn't making much of a problem (portrait resolution or just rotating it with argument works just fine), so only the touch doesn't seem to work. I actually tried on two devices(OnePlus 6T with Sailfish OS 3.2.1 and Nexus 5 with newer Sailfish OS 3.3.0). So is there something in the code so i could "attach" to it and monitor SDL mouse events or i have to try something else?

TheMorc commented 4 years ago

Small update, i found out that SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP events aren't even getting registered after touching the screen. I tried changing it to SDL_FINGERDOWN from SDL_TouchFingerEvent and it compiled, started, and after touching i think that it actually did register as it crashed right away. edit: it's not crashing now as i was experimenting with things before, but it's not touching anything also except for registering the touch events another edit: i got it to print x,y pixel positions of finger and that does work aswell

last edit: oh god i fixed it i changed original mouse events for this

void processSDLEvents(const SDL_Event& event)
{
        pp_uint32 mouseButton = 0;

        switch (event.type)
        {
                case SDL_FINGERDOWN:
                        printf("\ndostal som DOWN event");
                        mouseButton = 1;
                        translateMouseDownEvent(mouseButton, event.tfinger.x, event.tfinger.y);
                        break;

                case SDL_FINGERUP:
                        printf("\ndostal som UP event");
                        mouseButton = 1;
                        translateMouseUpEvent(mouseButton, event.tfinger.x, event.tfinger.y);
                        break;