mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 19:29:52 +02:00
fix modifiers from lua, fix right ctrl
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#ifndef WIN
|
#ifndef WIN
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@@ -1887,14 +1888,7 @@ bool LuaScriptInterface::OnMouseWheel(int x, int y, int d)
|
|||||||
|
|
||||||
bool LuaScriptInterface::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
bool LuaScriptInterface::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
{
|
{
|
||||||
int modifiers = 0;
|
return luacon_keyevent(key, SDL_GetModState(), LUACON_KDOWN);
|
||||||
if(shift)
|
|
||||||
modifiers |= 0x001;
|
|
||||||
if(ctrl)
|
|
||||||
modifiers |= 0x040;
|
|
||||||
if(alt)
|
|
||||||
modifiers |= 0x100;
|
|
||||||
return luacon_keyevent(key, modifiers, LUACON_KDOWN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LuaScriptInterface::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
bool LuaScriptInterface::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
#define KEY_MOD_MODE KMOD_MODE
|
#define KEY_MOD_MODE KMOD_MODE
|
||||||
#define KEY_MOD_RESERVED KMOD_RESERVED
|
#define KEY_MOD_RESERVED KMOD_RESERVED
|
||||||
|
|
||||||
#define KEY_MOD_CONTROL KEY_MOD_RCONTROL | KEY_MOD_LCONTROl
|
#define KEY_MOD_CONTROL KEY_MOD_RCONTROL | KEY_MOD_LCONTROL
|
||||||
#define KEY_MOD_ALT KEY_MOD_RALT | KEY_MOD_LALT
|
#define KEY_MOD_ALT KEY_MOD_RALT | KEY_MOD_LALT
|
||||||
#define KEY_MOD_SHIFT KEY_MOD_RSHIFT | KEY_MOD_LSHIFT
|
#define KEY_MOD_SHIFT KEY_MOD_RSHIFT | KEY_MOD_LSHIFT
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user