HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.97k stars 434 forks source link

FlxPointer.getScreenPosition is returning impossible numbers #3199

Open 01010111 opened 3 months ago

01010111 commented 3 months ago

Code snippet reproducing the issue:

package;

import flixel.FlxG;
import flixel.FlxState;

class PlayState extends FlxState
{
    override public function update(elapsed:Float)
    {
        super.update(elapsed);
        trace(FlxG.mouse.getScreenPosition());
    }
}

It's also useful to update openfl-content div's styling:

#openfl-content {
    background: #000000;
    width: 640px;
}

Observed behavior:

When placing the cursor at the top-left most position on the screen, trace(FlxG.mouse.getScreenPosition() is returning (x: 0 | y: -4)

Expected behavior:

When placing the cursor at the top-left most position on the screen, trace(FlxG.mouse.getScreenPosition() should return (x: 0 | y: 0)

01010111 commented 3 months ago

traced this back to openFL's Stage.__mouseY so I think it's probably safe to assume this isn't a flixel issue?

Geokureli commented 2 months ago

What is going on here? is this a way to resize the game?

width: 640px;

Here are my results:

What I'm working on (or thinking about doing):