Added SetRelative function to lime.Mouse to allow for locking the mouse to the screen in native.
This commit is contained in:
@@ -14,6 +14,7 @@ namespace lime {
|
||||
|
||||
static MouseCursor currentCursor;
|
||||
|
||||
static int SetRelative (bool value);
|
||||
static void Hide ();
|
||||
static void SetCursor (MouseCursor cursor);
|
||||
static void Show ();
|
||||
|
||||
@@ -516,6 +516,14 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
value lime_mouse_set_relative (value input_value) {
|
||||
|
||||
Mouse::SetRelative (input_value);
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_mouse_set_cursor (value cursor) {
|
||||
|
||||
Mouse::SetCursor ((MouseCursor)val_int (cursor));
|
||||
@@ -785,6 +793,7 @@ namespace lime {
|
||||
DEFINE_PRIM (lime_key_event_manager_register, 2);
|
||||
DEFINE_PRIM (lime_lzma_encode, 1);
|
||||
DEFINE_PRIM (lime_lzma_decode, 1);
|
||||
DEFINE_PRIM (lime_mouse_set_relative, 1);
|
||||
DEFINE_PRIM (lime_mouse_hide, 0);
|
||||
DEFINE_PRIM (lime_mouse_set_cursor, 1);
|
||||
DEFINE_PRIM (lime_mouse_show, 0);
|
||||
|
||||
@@ -17,6 +17,18 @@ namespace lime {
|
||||
SDL_Cursor* SDLMouse::textCursor = 0;
|
||||
SDL_Cursor* SDLMouse::waitCursor = 0;
|
||||
SDL_Cursor* SDLMouse::waitArrowCursor = 0;
|
||||
|
||||
|
||||
int Mouse::SetRelative (bool value) {
|
||||
if(value)
|
||||
{
|
||||
return SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Mouse::Hide () {
|
||||
|
||||
Reference in New Issue
Block a user