Giter Club home page Giter Club logo

Comments (20)

slouken avatar slouken commented on September 13, 2024 1

I'll take a look and see what's going on.

from sdl.

slouken avatar slouken commented on September 13, 2024

@Kontrabant, this is on iOS. Maybe we need some special consideration there for touch input?

from sdl.

Kontrabant avatar Kontrabant commented on September 13, 2024

I'm wondering if we even need it enabled by default on the non-desktop platforms, given that this is mainly to help legacy titles on platforms where constantly warping the pointer doesn't behave as expected?

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

JFYI it also affects Android builds (needing SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE=0 to work) after this change.

from sdl.

slouken avatar slouken commented on September 13, 2024

I'm wondering if we even need it enabled by default on the non-desktop platforms, given that this is mainly to help legacy titles on platforms where constantly warping the pointer doesn't behave as expected?

Probably not, but it sounds like a bug that if it's enabled for some reason (maybe someone sets it in their application?) it affects touch input.

from sdl.

Kontrabant avatar Kontrabant commented on September 13, 2024

The warp emulation wasn't being disabled when warping the mouse on fullscreen transitions. I'm pushing a fix to take care of that now.

from sdl.

Kontrabant avatar Kontrabant commented on September 13, 2024

@DominusExult, can you try the main branch now and see if your issue is fixed?

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

Just tried and it's not completely fixed. At first it seems to be but there are some things in our code that accidentally unhides the cursor again. When I then tap on the screen again, the cursor hides again but touch input is stuck on where I touched (that triggered the cursor hiding). So every time I touch the screen it only registers the touch on that one spot.

from sdl.

slouken avatar slouken commented on September 13, 2024

I'm having trouble getting a repro case here.

Are these the correct steps?

  1. Hide the cursor
  2. Warp the mouse to 0,0
  3. Mouse events no longer report change in position

Is that right?

At least with those steps, I'm seeing mouse relative mode being enabled and then touch moves the mouse.

Are there any other hints in play or something I'm missing?

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

Maybe itβ€˜s

  1. start with the mouse pointer hidden
  2. Unhide it
  3. Hide it again (maybe by touch)
  4. ..

from sdl.

slouken avatar slouken commented on September 13, 2024

Can you debug the SDL mouse code and see what's happening there? I can't repro with a simple test case.

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

I need some help with what you need to be logged where in SDL source and in which form, that's not my strength. (Or I can send a package with Exult source etc. and data to make it run on your end).

from sdl.

slouken avatar slouken commented on September 13, 2024

Yeah, a package with repro steps would be helpful, thanks!

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

I've sent you an email

from sdl.

slouken avatar slouken commented on September 13, 2024

I got it, thanks. However, I'm seeing different behavior.

Regardless of the value of the hint, the green cursor is stuck in the upper right area of the game, but clicking on the map shows a message "Clicked at tile (x, y)" and the values seem to match up with where I'm clicking. If I drag briefly the character will walk to the area I clicked. If I click on an object I get a dropdown menu of actions.

If I try to click on the map, the green cursor is outside the map and it just closes, I don't teleport at all.

As I said, this doesn't change based on the value of the hint. I haven't played this before, so I'm not sure whether this is correct behavior or not?

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

You have to double tap/click the map to get the cheat map (without the compass in the upper right) that teleports you to where you click on it.
The teleport part is important as this only triggers the odd behaviour.

from sdl.

slouken avatar slouken commented on September 13, 2024

So this is the issue. The mouse gets hidden, and then this code runs, which triggers the automatic relative mouse mode.

	//	teleported = 1;
	// generate mousemotion event
	float x;
	float y;
	SDL_GetMouseState(&x, &y);
	SDL_WarpMouseInWindow(win->get_screen_window(), x, y);

@Kontrabant, do we need a better heuristic for entering relative mouse mode? Maybe repeated warps to the center?

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

Hmm, I wonder if we actually need this in Exult anymore. Commenting that whole part seems to make no difference and that code is essentially 23 years old.
We use SDL_WarpMouseInWindow() in our main mouse code as well https://github.com/exult/exult/blob/master/mouse.cc#L162 (edit: which also seems to do nothing of note these days)

from sdl.

DominusExult avatar DominusExult commented on September 13, 2024

The problem is fixed on our side by removing the one SDL_WarpMouseInWindow() in our code that Sam pointed at. The other one is not affecting our mobile platforms.
Up to you to decide whether you need to follow up with a general fix for when SDL_WarpMouseInWindow() is used on iOS/Android.

from sdl.

Kontrabant avatar Kontrabant commented on September 13, 2024

@Kontrabant, do we need a better heuristic for entering relative mouse mode? Maybe repeated warps to the center?

I think that would be a good idea. Maybe more than one warp to center within a certain timeframe (a 30ms window or so)?

from sdl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.