[Q] How to access the window from luxe.Game?

sign up sign in

I am trying to implement a camera scroll where you click the mouse and "grab" the ground. Then you move the mouse and you move the camera, usually 1:1. I have no issue doing this part, but the scrolling stops when I hit the edge of the window. I want to move the mouse to the other side of the screen and allow the user to have a continuous scrolling experience.

Digging through the APIs I only found one class that seems to allow me to move the mouse. snow.window.Window and it's function set_cursor_position(x:Int,y:Int.

Here is some untested Haxe code as an example (x only).

var window_padding:Int = 20;
var thisWindow:snow.window.Window;

if (mouse.x < window_padding)
{
   thisWindow.set_cursor_position( thisWindow.width-window_padding , mouse.y );
}
else if (mouse.x > (thisWindow.width - window_padding))
{
   thisWindow.set_cursor_position( 0 + window_padding , mouse.y );
}

There should be more code, measuring relative movement vs overall movement, but the above should show what I am trying to achieve by "jumping" the mouse.

I can't seem to find a way to get the actual window instance after it has been created. I found how to edit properties of the window before its created through luxe.Appconfig but can't seem to get anything after that point.

I would love any pointers on how to access the container for luxe.Game.

Tags
luxemousemouseless