Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No publicly accessible functionality to get global screen position in FlxPointer #3200

Closed
01010111 opened this issue Jul 4, 2024 · 2 comments

Comments

@01010111
Copy link
Contributor

01010111 commented Jul 4, 2024

  • Haxe version: 4.3.2
  • Flixel version: 5.8.0
  • OpenFL version: 9.3.3
  • Lime version: 8.1.2
  • Affected targets: html5, ?

Code snippet reproducing the issue:

package;

import flixel.FlxG;
import flixel.FlxState;

class PlayState extends FlxState
{
	override public function create()
	{
		super.create();
		camera.setSize(800, 800);
		camera.setPosition(-(800 - FlxG.width)/2, -(800 - FlxG.height)/2);
	}

	override public function update(elapsed:Float)
	{
		super.update(elapsed);
		trace(camera.x, camera.y);
		trace(FlxG.mouse.getScreenPosition());
	}
}

Observed behavior:

When putting the mouse cursor at the top-left position on flixel's screen, trace(camera.x, camera.y is returning -80, -160 and trace(FlxG.mouse.getScreenPosition() is returning (x: 80 | y: 154)

Expected behavior:

When putting the mouse cursor at the top-left position on flixel's screen, trace(camera.x, camera.y should return -80, -160 and trace(FlxG.mouse.getScreenPosition() should return (x: 0 | y: 0)

(also note that assuming that this is also affected by #3199

@01010111
Copy link
Contributor Author

01010111 commented Jul 4, 2024

Looks like there was some misunderstanding on my part, I just don't think there's any publicly accessible functionality within FlxPointer to get the global screen position of the mouse, changing the issue name to reflect that!

@01010111 01010111 changed the title Camera position affects FlxPointer.getScreenPosition No publicly accessible functionality to get global screen position in FlxPointer Jul 4, 2024
@Geokureli
Copy link
Member

Fixed via #3211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants