diff --git a/flixel/addons/ui/FlxUICursor.hx b/flixel/addons/ui/FlxUICursor.hx index 8954502..2982273 100644 --- a/flixel/addons/ui/FlxUICursor.hx +++ b/flixel/addons/ui/FlxUICursor.hx @@ -962,7 +962,11 @@ class FlxUICursor extends FlxUISprite { #if FLX_MOUSE // REALLY force it to this location + #if (flixel < version("5.9.0")) FlxG.mouse.setGlobalScreenPositionUnsafe(pt.x, pt.y); + #else + FlxG.mouse.setRawPositionUnsafe(pt.x, pt.y); + #end if (_newMouse != null) { @@ -1084,7 +1088,11 @@ class FlxUICursor extends FlxUISprite if (_newMouse != null) { _newMouse.updateGlobalScreenPosition = true; // resume low-level-mouse updating now that I'm done overriding it + #if (flixel < version("5.9.0")) _newMouse.setGlobalScreenPositionUnsafe(Std.int(FlxG.game.mouseX), Std.int(FlxG.game.mouseY)); + #else + _newMouse.setRawPositionUnsafe(Std.int(FlxG.game.mouseX), Std.int(FlxG.game.mouseY)); + #end } #end } diff --git a/flixel/addons/ui/FlxUIMouse.hx b/flixel/addons/ui/FlxUIMouse.hx index 41bf6cb..4972b4f 100644 --- a/flixel/addons/ui/FlxUIMouse.hx +++ b/flixel/addons/ui/FlxUIMouse.hx @@ -23,17 +23,27 @@ class FlxUIMouse extends FlxMouse * Called by the internal game loop to update the mouse pointer's position in the game world. * Also updates the just pressed/just released flags. */ - private override function update():Void + override function update():Void { - var oldScreenX:Int = _globalScreenX; - var oldScreenY:Int = _globalScreenY; - + #if (flixel < version("5.9.0")) + final oldScreenX = _globalScreenX; + final oldScreenY = _globalScreenY; + #else + final oldRawX = _rawX; + final oldRawY = _rawY; + #end + super.update(); if (!updateGlobalScreenPosition) { + #if (flixel < version("5.9.0")) _globalScreenX = oldScreenX; _globalScreenY = oldScreenY; + updatePositions(); + #else + setRawPositionUnsafe(oldRawX, oldRawY); + #end } } }