Repository navigation
|
I want to lock the cursor position on the game screen (in the center or just don't let the cursor go outside the window) |
Answered by
bogdan-ov
May 7, 2023
Replies: 3 comments 1 reply
|
I recommend checking out https://api.haxeflixel.com/flixel/input/mouse/FlxMouse.html
|
0 replies
|
Well... I found the solution by myself // Put it somewhere in `update` function
public function update(elapsed:Float) {
FlxG.stage.application.window.warpMouse(0, 0);
} |
0 replies
Answer selected by
bogdan-ov
|
I think with: var mouseChange = FlxPoint.get(0, 0);
function create() {
FlxG.mouse.visible = false;
FlxG.stage.application.window.warpMouse(0, 0);
}
function update() {
mouseChange.set(FlxG.mouse.x, FlxG.mouse.y);
FlxG.stage.application.window.warpMouse(0, 0);
} |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well... I found the solution by myself