/// <summary>Simulates a mouse key release for the given mouse key.</summary> /// <param name="luaState">Pointer to lua_State struct.</param> /// <param name="key">The key.</param> public static void InternalMouseReleased(LuaState luaState, MOUSE key) { lock (SyncRoot) { lua_getglobal(luaState, nameof(gui)); lua_getfield(luaState, -1, nameof(InternalMouseReleased)); lua_pushnumber(luaState, (double)key); lua_pcall(luaState, 1); } }
/// <summary> /// Returns whether a mouse key was initially pressed in the same frame this function was called. /// <para /> /// If <see cref="WasMouseDoublePressed" /> returns true, this function will return false. /// <para /> /// This function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text /// field. /// </summary> /// <param name="luaState">Pointer to lua_State struct.</param> /// <param name="button">The mouse button to test.</param> /// <returns> /// Returns true if the mouse key was initially pressed the same frame that this function was called; otherwise /// false. /// </returns> public static bool WasMousePressed(LuaState luaState, MOUSE button) { lock (SyncRoot) { lua_getglobal(luaState, nameof(input)); lua_getfield(luaState, -1, nameof(WasMousePressed)); lua_pushnumber(luaState, (double)button); lua_pcall(luaState, 1); return(lua_toboolean(luaState) == 1); } }
/// <summary>Gets whether a mouse button is down.</summary> /// <param name="luaState">Pointer to lua_State struct.</param> /// <param name="mouseKey">The mouse key.</param> /// <returns>Is the mouse key down?</returns> public static bool IsMouseDown(LuaState luaState, MOUSE mouseKey) { lock (SyncRoot) { lua_getglobal(luaState, nameof(input)); lua_getfield(luaState, -1, nameof(IsMouseDown)); lua_pushnumber(luaState, (double)mouseKey); lua_pcall(luaState, 1, 1); return(lua_toboolean(luaState) == 1); } }
protected override void Update(GameTime gameTime) { base.Update(gameTime); MOUSE.Update(); KEYBOARD.Update(); _frame++; if (KEYBOARD.KeyDown(ExitKey)) { ExitGame(); } elapsedTime += gameTime.ElapsedGameTime; if (elapsedTime > TimeSpan.FromSeconds(1)) { elapsedTime -= TimeSpan.FromSeconds(1); frameRate = frameCounter; frameCounter = 0; } }
public MOUSE_INFO(MOUSE s) { g = (int)s; }
/// <summary> /// Returns whether a mouse key was initially pressed in the same frame this function was called. /// <para /> /// If <see cref="WasMouseDoublePressed" /> returns true, this function will return false. /// <para /> /// This function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text /// field. /// </summary> /// <param name="luaState">Pointer to lua_State struct.</param> /// <param name="button">The mouse button to test.</param> /// <returns> /// Returns true if the mouse key was initially pressed the same frame that this function was called; otherwise /// false. /// </returns> public static bool WasMousePressed(LuaState luaState, MOUSE button) { lock (SyncRoot) { lua_getglobal(luaState, nameof(input)); lua_getfield(luaState, -1, nameof(WasMousePressed)); lua_pushnumber(luaState, (double)button); lua_pcall(luaState, 1); return lua_toboolean(luaState) == 1; } }
/// <summary>Gets whether a mouse button is down.</summary> /// <param name="luaState">Pointer to lua_State struct.</param> /// <param name="mouseKey">The mouse key.</param> /// <returns>Is the mouse key down?</returns> public static bool IsMouseDown(LuaState luaState, MOUSE mouseKey) { lock (SyncRoot) { lua_getglobal(luaState, nameof(input)); lua_getfield(luaState, -1, nameof(IsMouseDown)); lua_pushnumber(luaState, (double)mouseKey); lua_pcall(luaState, 1, 1); return lua_toboolean(luaState) == 1; } }
private void data_MouseDoubleClick(object sender, MouseButtonEventArgs e) { MOUSE.Invoke(sender, e); }
private void data_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { MOUSE.Invoke(sender, e); }
public static KEY GetMouseState(MOUSE button) { if (!mouseState[(int)button, 0] && !mouseState[(int)button, 1]) { return KEY.FREE; } else if (!mouseState[(int)button, 0] && mouseState[(int)button, 1]) { return KEY.PUSH; } else if (mouseState[(int)button, 0] && mouseState[(int)button, 1]) { return KEY.HOLD; } else { return KEY.PULL; } }