MCPcopy Create free account
hub / github.com/defold/defold / SetMouseLock

Function SetMouseLock

engine/gamesys/src/gamesys/scripts/script_window.cpp:185–202  ·  view source on GitHub ↗

set the locking state for current mouse cursor * * Set the locking state for current mouse cursor on a PC platform. * * This function locks or unlocks the mouse cursor to the center point of the window. While the cursor is locked, * mouse position updates will still be sent to the scripts as usual. * * @name window.set_mouse_lock * @param flag [type:boolean] The lock state for the mouse cu

Source from the content-addressed store, hash-verified

183 * @param flag [type:boolean] The lock state for the mouse cursor
184 */
185static int SetMouseLock(lua_State* L)
186{
187 DM_LUA_STACK_CHECK(L, 0);
188
189 bool flag = dmScript::CheckBoolean(L, 1);
190
191 // Hiding the cursor is the same thing as locking it currently
192 if (flag)
193 {
194 dmHID::HideMouseCursor(g_Window.m_HidContext);
195 }
196 else
197 {
198 dmHID::ShowMouseCursor(g_Window.m_HidContext);
199 }
200
201 return 0;
202}
203
204/*# set the mode for screen dimming
205 *

Callers

nothing calls this directly

Calls 3

CheckBooleanFunction · 0.85
HideMouseCursorFunction · 0.85
ShowMouseCursorFunction · 0.85

Tested by

no test coverage detected