mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Input fixes from TW master for mouse wheel
This commit is contained in:
parent
1446adee2c
commit
4761608329
|
@ -2713,7 +2713,7 @@ void CClient::Run()
|
|||
Input()->MouseModeAbsolute();
|
||||
m_WindowMustRefocus = 1;
|
||||
}
|
||||
else if (g_Config.m_DbgFocus && Input()->KeyPressed(KEY_ESCAPE))
|
||||
else if (g_Config.m_DbgFocus && Input()->KeyIsPressed(KEY_ESCAPE))
|
||||
{
|
||||
Input()->MouseModeAbsolute();
|
||||
m_WindowMustRefocus = 1;
|
||||
|
@ -2728,7 +2728,7 @@ void CClient::Run()
|
|||
m_WindowMustRefocus++;
|
||||
}
|
||||
|
||||
if(m_WindowMustRefocus >= 3 || Input()->KeyPressed(KEY_MOUSE_1))
|
||||
if(m_WindowMustRefocus >= 3 || Input()->KeyIsPressed(KEY_MOUSE_1))
|
||||
{
|
||||
Input()->MouseModeRelative();
|
||||
m_WindowMustRefocus = 0;
|
||||
|
@ -2855,12 +2855,12 @@ void CClient::Run()
|
|||
|
||||
bool CClient::CtrlShiftKey(int Key, bool &Last)
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && !Last && Input()->KeyPressed(Key))
|
||||
if(Input()->KeyIsPressed(KEY_LCTRL) && Input()->KeyIsPressed(KEY_LSHIFT) && !Last && Input()->KeyIsPressed(Key))
|
||||
{
|
||||
Last = true;
|
||||
return true;
|
||||
}
|
||||
else if (Last && !Input()->KeyPressed(Key))
|
||||
else if (Last && !Input()->KeyIsPressed(Key))
|
||||
Last = false;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -27,6 +27,7 @@ void CInput::AddEvent(char *pText, int Key, int Flags)
|
|||
m_aInputEvents[m_NumEvents].m_aText[0] = 0;
|
||||
else
|
||||
str_copy(m_aInputEvents[m_NumEvents].m_aText, pText, sizeof(m_aInputEvents[m_NumEvents].m_aText));
|
||||
m_aInputEvents[m_NumEvents].m_InputCount = m_InputCounter;
|
||||
m_NumEvents++;
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +37,8 @@ CInput::CInput()
|
|||
mem_zero(m_aInputCount, sizeof(m_aInputCount));
|
||||
mem_zero(m_aInputState, sizeof(m_aInputState));
|
||||
|
||||
m_InputCurrent = 0;
|
||||
m_InputCounter = 1;
|
||||
m_InputGrabbed = 0;
|
||||
m_InputDispatched = false;
|
||||
|
||||
m_LastRelease = 0;
|
||||
m_ReleaseDelta = -1;
|
||||
|
@ -114,52 +114,42 @@ void CInput::SetClipboardText(const char *Text)
|
|||
SDL_SetClipboardText(Text);
|
||||
}
|
||||
|
||||
void CInput::ClearKeyStates()
|
||||
void CInput::Clear()
|
||||
{
|
||||
mem_zero(m_aInputState, sizeof(m_aInputState));
|
||||
mem_zero(m_aInputCount, sizeof(m_aInputCount));
|
||||
m_NumEvents = 0;
|
||||
}
|
||||
|
||||
int CInput::KeyState(int Key) const
|
||||
bool CInput::KeyState(int Key) const
|
||||
{
|
||||
return m_aInputState[m_InputCurrent][Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))];
|
||||
}
|
||||
|
||||
int CInput::KeyStateOld(int Key) const
|
||||
{
|
||||
return m_aInputState[m_InputCurrent^1][Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))];
|
||||
return m_aInputState[Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))];
|
||||
}
|
||||
|
||||
int CInput::Update()
|
||||
{
|
||||
if(m_InputDispatched)
|
||||
{
|
||||
// clear and begin count on the other one
|
||||
m_InputCurrent^=1;
|
||||
mem_zero(&m_aInputCount[m_InputCurrent], sizeof(m_aInputCount[m_InputCurrent]));
|
||||
mem_zero(&m_aInputState[m_InputCurrent], sizeof(m_aInputState[m_InputCurrent]));
|
||||
m_InputDispatched = false;
|
||||
}
|
||||
// keep the counter between 1..0xFFFF, 0 means not pressed
|
||||
m_InputCounter = (m_InputCounter%0xFFFF)+1;
|
||||
|
||||
{
|
||||
int i;
|
||||
const Uint8 *pState = SDL_GetKeyboardState(&i);
|
||||
if(i >= KEY_LAST)
|
||||
i = KEY_LAST-1;
|
||||
mem_copy(m_aInputState[m_InputCurrent], pState, i);
|
||||
mem_copy(m_aInputState, pState, i);
|
||||
}
|
||||
|
||||
// these states must always be updated manually because they are not in the GetKeyState from SDL
|
||||
int i = SDL_GetMouseState(NULL, NULL);
|
||||
if(i&SDL_BUTTON(1)) m_aInputState[m_InputCurrent][KEY_MOUSE_1] = 1; // 1 is left
|
||||
if(i&SDL_BUTTON(3)) m_aInputState[m_InputCurrent][KEY_MOUSE_2] = 1; // 3 is right
|
||||
if(i&SDL_BUTTON(2)) m_aInputState[m_InputCurrent][KEY_MOUSE_3] = 1; // 2 is middle
|
||||
if(i&SDL_BUTTON(4)) m_aInputState[m_InputCurrent][KEY_MOUSE_4] = 1;
|
||||
if(i&SDL_BUTTON(5)) m_aInputState[m_InputCurrent][KEY_MOUSE_5] = 1;
|
||||
if(i&SDL_BUTTON(6)) m_aInputState[m_InputCurrent][KEY_MOUSE_6] = 1;
|
||||
if(i&SDL_BUTTON(7)) m_aInputState[m_InputCurrent][KEY_MOUSE_7] = 1;
|
||||
if(i&SDL_BUTTON(8)) m_aInputState[m_InputCurrent][KEY_MOUSE_8] = 1;
|
||||
if(i&SDL_BUTTON(9)) m_aInputState[m_InputCurrent][KEY_MOUSE_9] = 1;
|
||||
if(i&SDL_BUTTON(1)) m_aInputState[KEY_MOUSE_1] = 1; // 1 is left
|
||||
if(i&SDL_BUTTON(3)) m_aInputState[KEY_MOUSE_2] = 1; // 3 is right
|
||||
if(i&SDL_BUTTON(2)) m_aInputState[KEY_MOUSE_3] = 1; // 2 is middle
|
||||
if(i&SDL_BUTTON(4)) m_aInputState[KEY_MOUSE_4] = 1;
|
||||
if(i&SDL_BUTTON(5)) m_aInputState[KEY_MOUSE_5] = 1;
|
||||
if(i&SDL_BUTTON(6)) m_aInputState[KEY_MOUSE_6] = 1;
|
||||
if(i&SDL_BUTTON(7)) m_aInputState[KEY_MOUSE_7] = 1;
|
||||
if(i&SDL_BUTTON(8)) m_aInputState[KEY_MOUSE_8] = 1;
|
||||
if(i&SDL_BUTTON(9)) m_aInputState[KEY_MOUSE_9] = 1;
|
||||
|
||||
{
|
||||
SDL_Event Event;
|
||||
|
@ -214,8 +204,7 @@ int CInput::Update()
|
|||
case SDL_MOUSEWHEEL:
|
||||
if(Event.wheel.y > 0) Key = KEY_MOUSE_WHEEL_UP; // ignore_convention
|
||||
if(Event.wheel.y < 0) Key = KEY_MOUSE_WHEEL_DOWN; // ignore_convention
|
||||
AddEvent(0, Key, Action);
|
||||
Action = IInput::FLAG_RELEASE;
|
||||
Action |= IInput::FLAG_RELEASE;
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
|
@ -223,12 +212,13 @@ int CInput::Update()
|
|||
// shortcuts
|
||||
switch (Event.window.event)
|
||||
{
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
Graphics()->Resize(Event.window.data1, Event.window.data2);
|
||||
break;
|
||||
#elif defined(__ANDROID__)
|
||||
m_VideoRestartNeeded = 1;
|
||||
#endif
|
||||
break;
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
// TODO: Check if from FOCUS_LOST til FOCUS_GAINED is good enough, maybe also ENTER and LEAVE
|
||||
|
@ -246,19 +236,15 @@ int CInput::Update()
|
|||
// other messages
|
||||
case SDL_QUIT:
|
||||
return 1;
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
m_VideoRestartNeeded = 1;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(Key >= 0 && Key < 1024 && !IgnoreKeys)
|
||||
if(Key >= 0 && Key < g_MaxKeys)
|
||||
{
|
||||
m_aInputCount[m_InputCurrent][Key].m_Presses++;
|
||||
if(Action == IInput::FLAG_PRESS)
|
||||
m_aInputState[m_InputCurrent][Scancode] = 1;
|
||||
if(Action&IInput::FLAG_PRESS)
|
||||
{
|
||||
m_aInputState[Scancode] = 1;
|
||||
m_aInputCount[Key] = m_InputCounter;
|
||||
}
|
||||
AddEvent(0, Key, Action);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,15 @@ class CInput : public IEngineInput
|
|||
int m_VideoRestartNeeded;
|
||||
|
||||
void AddEvent(char *pText, int Key, int Flags);
|
||||
void Clear();
|
||||
bool IsEventValid(CEvent *pEvent) const { return pEvent->m_InputCount == m_InputCounter; };
|
||||
|
||||
//quick access to input
|
||||
unsigned short m_aInputCount[g_MaxKeys]; // tw-KEY
|
||||
unsigned char m_aInputState[g_MaxKeys]; // SDL_SCANCODE
|
||||
int m_InputCounter;
|
||||
|
||||
bool KeyState(int Key) const;
|
||||
|
||||
IEngineGraphics *Graphics() { return m_pGraphics; }
|
||||
|
||||
|
@ -24,14 +33,8 @@ public:
|
|||
|
||||
virtual void Init();
|
||||
|
||||
int KeyState(int Key) const;
|
||||
int KeyStateOld(int Key) const;
|
||||
int KeyWasPressed(int Key) const { return KeyStateOld(Key); }
|
||||
|
||||
int KeyPressed(int Key) const { return KeyState(Key); }
|
||||
int KeyReleases(int Key) const { return m_aInputCount[m_InputCurrent][Key].m_Releases; }
|
||||
int KeyPresses(int Key) const { return m_aInputCount[m_InputCurrent][Key].m_Presses; }
|
||||
int KeyDown(int Key) const { return KeyPressed(Key)&&!KeyWasPressed(Key); }
|
||||
bool KeyIsPressed(int Key) const { return KeyState(Key); }
|
||||
bool KeyPress(int Key, bool CheckCounter) const { return CheckCounter ? (m_aInputCount[Key] == m_InputCounter) : m_aInputCount[Key]; }
|
||||
|
||||
virtual void MouseRelative(float *x, float *y);
|
||||
virtual void MouseModeAbsolute();
|
||||
|
@ -40,10 +43,6 @@ public:
|
|||
virtual const char* GetClipboardText();
|
||||
virtual void SetClipboardText(const char *Text);
|
||||
|
||||
void ClearKeyStates();
|
||||
|
||||
int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; }
|
||||
|
||||
virtual int Update();
|
||||
|
||||
virtual int VideoRestartNeeded();
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
#include "kernel.h"
|
||||
|
||||
extern const char g_aaKeyStrings[512][20];
|
||||
const int g_MaxKeys = 512;
|
||||
extern const char g_aaKeyStrings[g_MaxKeys][20];
|
||||
|
||||
class IInput : public IInterface
|
||||
{
|
||||
|
@ -17,6 +18,7 @@ public:
|
|||
int m_Flags;
|
||||
int m_Key;
|
||||
char m_aText[32];
|
||||
int m_InputCount;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -29,17 +31,6 @@ protected:
|
|||
int m_NumEvents;
|
||||
IInput::CEvent m_aInputEvents[INPUT_BUFFER_SIZE];
|
||||
|
||||
//quick access to input
|
||||
struct
|
||||
{
|
||||
unsigned char m_Presses;
|
||||
unsigned char m_Releases;
|
||||
} m_aInputCount[2][1024];
|
||||
|
||||
unsigned char m_aInputState[2][1024];
|
||||
int m_InputCurrent;
|
||||
bool m_InputDispatched;
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
|
@ -51,11 +42,7 @@ public:
|
|||
|
||||
// events
|
||||
int NumEvents() const { return m_NumEvents; }
|
||||
void ClearEvents()
|
||||
{
|
||||
m_NumEvents = 0;
|
||||
m_InputDispatched = true;
|
||||
}
|
||||
virtual bool IsEventValid(CEvent *pEvent) const = 0;
|
||||
CEvent GetEvent(int Index) const
|
||||
{
|
||||
if(Index < 0 || Index >= m_NumEvents)
|
||||
|
@ -67,11 +54,10 @@ public:
|
|||
}
|
||||
|
||||
// keys
|
||||
virtual int KeyPressed(int Key) const = 0;
|
||||
virtual int KeyReleases(int Key) const = 0;
|
||||
virtual int KeyPresses(int Key) const = 0;
|
||||
virtual int KeyDown(int Key) const = 0;
|
||||
const char *KeyName(int Key) { return (Key >= 0 && Key < 512) ? g_aaKeyStrings[Key] : g_aaKeyStrings[0]; }
|
||||
virtual bool KeyIsPressed(int Key) const = 0;
|
||||
virtual bool KeyPress(int Key, bool CheckCounter=false) const = 0;
|
||||
const char *KeyName(int Key) const { return (Key >= 0 && Key < g_MaxKeys) ? g_aaKeyStrings[Key] : g_aaKeyStrings[0]; }
|
||||
virtual void Clear() = 0;
|
||||
|
||||
//
|
||||
virtual void MouseModeRelative() = 0;
|
||||
|
|
|
@ -47,10 +47,10 @@ bool CBinds::OnInput(IInput::CEvent e)
|
|||
if(e.m_Key <= 0 || e.m_Key >= KEY_LAST || m_aaKeyBindings[e.m_Key][0] == 0)
|
||||
return false;
|
||||
|
||||
int Stroke = 0;
|
||||
if(e.m_Flags&IInput::FLAG_PRESS)
|
||||
Stroke = 1;
|
||||
Console()->ExecuteLineStroked(Stroke, m_aaKeyBindings[e.m_Key]);
|
||||
Console()->ExecuteLineStroked(1, m_aaKeyBindings[e.m_Key]);
|
||||
if(e.m_Flags&IInput::FLAG_RELEASE)
|
||||
Console()->ExecuteLineStroked(0, m_aaKeyBindings[e.m_Key]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
if(m_Mode == MODE_NONE)
|
||||
return false;
|
||||
|
||||
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyDown(KEY_V))
|
||||
if(Input()->KeyIsPressed(KEY_LCTRL) && Input()->KeyPress(KEY_V))
|
||||
{
|
||||
const char *Text = Input()->GetClipboardText();
|
||||
if(Text)
|
||||
|
@ -145,7 +145,7 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
}
|
||||
}
|
||||
|
||||
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyDown(KEY_C))
|
||||
if(Input()->KeyIsPressed(KEY_LCTRL) && Input()->KeyPress(KEY_C))
|
||||
{
|
||||
Input()->SetClipboardText(m_Input.GetString());
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ void CChat::EnableMode(int Team)
|
|||
else
|
||||
m_Mode = MODE_ALL;
|
||||
|
||||
Input()->ClearEvents();
|
||||
Input()->Clear();
|
||||
m_CompletionChosen = -1;
|
||||
UI()->AndroidShowTextInput("", Team ? Localize("Team chat") : Localize("Chat"));
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
|
|||
{
|
||||
bool Handled = false;
|
||||
|
||||
if(m_pGameConsole->Input()->KeyPressed(KEY_LCTRL) && m_pGameConsole->Input()->KeyDown(KEY_V))
|
||||
if(m_pGameConsole->Input()->KeyIsPressed(KEY_LCTRL) && m_pGameConsole->Input()->KeyPress(KEY_V))
|
||||
{
|
||||
const char *Text = m_pGameConsole->Input()->GetClipboardText();
|
||||
if(Text)
|
||||
|
@ -125,7 +125,7 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
|
|||
}
|
||||
}
|
||||
|
||||
if(m_pGameConsole->Input()->KeyPressed(KEY_LCTRL) && m_pGameConsole->Input()->KeyDown(KEY_C))
|
||||
if(m_pGameConsole->Input()->KeyIsPressed(KEY_LCTRL) && m_pGameConsole->Input()->KeyPress(KEY_C))
|
||||
{
|
||||
m_pGameConsole->Input()->SetClipboardText(m_Input.GetString());
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ void CHud::RenderVoting()
|
|||
Base.y += Base.h+6;
|
||||
UI()->DoLabel(&Base, Localize("Vote yes"), 16.0f, -1);
|
||||
UI()->DoLabel(&Base, Localize("Vote no"), 16.0f, 1);
|
||||
if( Input()->KeyDown(KEY_MOUSE_1) )
|
||||
if( Input()->KeyPress(KEY_MOUSE_1) )
|
||||
{
|
||||
float mx, my;
|
||||
Input()->MouseRelative(&mx, &my);
|
||||
|
|
|
@ -210,7 +210,7 @@ void CMapLayers::OnRender()
|
|||
Render = true;
|
||||
}
|
||||
|
||||
if(Render && pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_KP_0))
|
||||
if(Render && pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyIsPressed(KEY_LCTRL) && Input()->KeyIsPressed(KEY_LSHIFT) && Input()->KeyPress(KEY_KP_0))
|
||||
{
|
||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||
CTile *pTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Data);
|
||||
|
|
|
@ -238,7 +238,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
if(Len == 0)
|
||||
s_AtIndex = 0;
|
||||
|
||||
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyDown(KEY_V))
|
||||
if(Input()->KeyIsPressed(KEY_LCTRL) && Input()->KeyPress(KEY_V))
|
||||
{
|
||||
const char *Text = Input()->GetClipboardText();
|
||||
if(Text)
|
||||
|
@ -256,7 +256,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
}
|
||||
}
|
||||
|
||||
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyDown(KEY_C))
|
||||
if(Input()->KeyIsPressed(KEY_LCTRL) && Input()->KeyPress(KEY_C))
|
||||
{
|
||||
Input()->SetClipboardText(pStr);
|
||||
}
|
||||
|
@ -1838,9 +1838,9 @@ void CMenus::OnRender()
|
|||
int Buttons = 0;
|
||||
if(m_UseMouseButtons)
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_MOUSE_1)) Buttons |= 1;
|
||||
if(Input()->KeyPressed(KEY_MOUSE_2)) Buttons |= 2;
|
||||
if(Input()->KeyPressed(KEY_MOUSE_3)) Buttons |= 4;
|
||||
if(Input()->KeyIsPressed(KEY_MOUSE_1)) Buttons |= 1;
|
||||
if(Input()->KeyIsPressed(KEY_MOUSE_2)) Buttons |= 2;
|
||||
if(Input()->KeyIsPressed(KEY_MOUSE_3)) Buttons |= 4;
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
|
|
@ -166,17 +166,17 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
s_ScrollValue = (float)(m_ScrollOffset)/ScrollNum;
|
||||
m_ScrollOffset = -1;
|
||||
}
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&View))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&View))
|
||||
s_ScrollValue -= 3.0f/ScrollNum;
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&View))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&View))
|
||||
s_ScrollValue += 3.0f/ScrollNum;
|
||||
}
|
||||
else
|
||||
ScrollNum = 0;
|
||||
|
||||
if(Input()->KeyDown(KEY_TAB) && m_pClient->m_pGameConsole->IsClosed())
|
||||
if(Input()->KeyPress(KEY_TAB) && m_pClient->m_pGameConsole->IsClosed())
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
g_Config.m_UiToolboxPage = (g_Config.m_UiToolboxPage + 3 - 1) % 3;
|
||||
else
|
||||
g_Config.m_UiToolboxPage = (g_Config.m_UiToolboxPage + 3 + 1) % 3;
|
||||
|
@ -1335,7 +1335,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
|
|||
else
|
||||
str_copy(aBuf, Localize("Refresh"), sizeof(aBuf));
|
||||
|
||||
if(DoButton_Menu(&s_RefreshButton, aBuf, 0, &Button) || Input()->KeyDown(KEY_F5) || (Input()->KeyDown(KEY_R) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))))
|
||||
if(DoButton_Menu(&s_RefreshButton, aBuf, 0, &Button) || Input()->KeyPress(KEY_F5) || (Input()->KeyPress(KEY_R) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||
{
|
||||
if(g_Config.m_UiPage == PAGE_INTERNET)
|
||||
ServerBrowser()->Refresh(IServerBrowser::TYPE_INTERNET);
|
||||
|
|
|
@ -146,7 +146,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
}
|
||||
|
||||
// handle mousewheel independent of active menu
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
{
|
||||
if(pInfo->m_Speed < 0.1f) DemoPlayer()->SetSpeed(0.1f);
|
||||
else if(pInfo->m_Speed < 0.25f) DemoPlayer()->SetSpeed(0.25f);
|
||||
|
@ -158,7 +158,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
else DemoPlayer()->SetSpeed(8.0f);
|
||||
LastSpeedChange = time_get();
|
||||
}
|
||||
else if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
else if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
{
|
||||
if(pInfo->m_Speed > 4.0f) DemoPlayer()->SetSpeed(4.0f);
|
||||
else if(pInfo->m_Speed > 2.0f) DemoPlayer()->SetSpeed(2.0f);
|
||||
|
@ -274,7 +274,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
static float PrevAmount = 0.0f;
|
||||
float Amount = (UI()->MouseX()-SeekBar.x)/(float)SeekBar.w;
|
||||
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
{
|
||||
Amount = PrevAmount + (Amount-PrevAmount) * 0.05f;
|
||||
|
||||
|
@ -356,7 +356,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||
static int s_SlowDownButton = 0;
|
||||
if(DoButton_Sprite(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, 0, &Button, CUI::CORNER_ALL) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(DoButton_Sprite(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, 0, &Button, CUI::CORNER_ALL) || Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
DecreaseDemoSpeed = true;
|
||||
|
||||
// fastforward
|
||||
|
@ -507,9 +507,9 @@ void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHe
|
|||
Num = 0;
|
||||
if(Num > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&View))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&View))
|
||||
gs_ListBoxScrollValue -= 3.0f/Num;
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&View))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&View))
|
||||
gs_ListBoxScrollValue += 3.0f/Num;
|
||||
|
||||
if(gs_ListBoxScrollValue < 0.0f) gs_ListBoxScrollValue = 0.0f;
|
||||
|
@ -956,9 +956,9 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
s_ScrollValue = (float)(m_ScrollOffset)/ScrollNum;
|
||||
m_ScrollOffset = 0;
|
||||
}
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&ListBox))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&ListBox))
|
||||
s_ScrollValue -= 3.0f/ScrollNum;
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&ListBox))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&ListBox))
|
||||
s_ScrollValue += 3.0f/ScrollNum;
|
||||
}
|
||||
else
|
||||
|
@ -1118,7 +1118,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
}
|
||||
|
||||
static int s_RefreshButton = 0;
|
||||
if(DoButton_Menu(&s_RefreshButton, Localize("Refresh"), 0, &RefreshRect) || Input()->KeyDown(KEY_F5) || (Input()->KeyDown(KEY_R) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))))
|
||||
if(DoButton_Menu(&s_RefreshButton, Localize("Refresh"), 0, &RefreshRect) || Input()->KeyPress(KEY_F5) || (Input()->KeyPress(KEY_R) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||
{
|
||||
DemolistPopulate();
|
||||
DemolistOnUpdate(false);
|
||||
|
|
|
@ -947,9 +947,9 @@ void CMenus::RenderGhost(CUIRect MainView)
|
|||
int ScrollNum = NumGhosts-Num+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue -= 1.0f/ScrollNum;
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue += 1.0f/ScrollNum;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
#include "SDL.h" // SDL_VIDEO_DRIVER_X11
|
||||
|
||||
#include <base/tl/string.h>
|
||||
|
||||
|
|
|
@ -386,6 +386,8 @@ void CGameClient::OnUpdate()
|
|||
for(int i = 0; i < Input()->NumEvents(); i++)
|
||||
{
|
||||
IInput::CEvent e = Input()->GetEvent(i);
|
||||
if(!Input()->IsEventValid(&e))
|
||||
continue;
|
||||
|
||||
for(int h = 0; h < m_Input.m_Num; h++)
|
||||
{
|
||||
|
@ -393,9 +395,6 @@ void CGameClient::OnUpdate()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// clear all events for this frame
|
||||
Input()->ClearEvents();
|
||||
}
|
||||
|
||||
|
||||
|
@ -563,6 +562,9 @@ void CGameClient::OnRender()
|
|||
for(int i = 0; i < m_All.m_Num; i++)
|
||||
m_All.m_paComponents[i]->OnRender();
|
||||
|
||||
// clear all events/input for this frame
|
||||
Input()->Clear();
|
||||
|
||||
// clear new tick flags
|
||||
m_NewTick = false;
|
||||
m_NewPredictedTick = false;
|
||||
|
|
|
@ -738,7 +738,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
|
|||
|
||||
UI()->SetActiveItem(&s_NumberBoxID);
|
||||
|
||||
if(Input()->KeyPressed(KEY_RETURN) || Input()->KeyPressed(KEY_KP_ENTER) ||
|
||||
if(Input()->KeyIsPressed(KEY_RETURN) || Input()->KeyIsPressed(KEY_KP_ENTER) ||
|
||||
((UI()->MouseButton(1) || UI()->MouseButton(0)) && !Inside))
|
||||
{
|
||||
if(isHex)
|
||||
|
@ -750,7 +750,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
|
|||
s_TextMode = false;
|
||||
}
|
||||
|
||||
if(Input()->KeyPressed(KEY_ESCAPE))
|
||||
if(Input()->KeyIsPressed(KEY_ESCAPE))
|
||||
{
|
||||
m_LockMouse = false;
|
||||
UI()->SetActiveItem(0);
|
||||
|
@ -763,7 +763,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
|
|||
{
|
||||
if(UI()->MouseButton(0))
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
s_Value += m_MouseDeltaX*0.05f;
|
||||
else
|
||||
s_Value += m_MouseDeltaX;
|
||||
|
@ -946,7 +946,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
TB_Bottom.HSplitTop(2.5f, 0, &TB_Bottom);
|
||||
|
||||
// ctrl+o to open
|
||||
if(Input()->KeyDown(KEY_O) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE)
|
||||
if(Input()->KeyPress(KEY_O) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE)
|
||||
{
|
||||
if(HasUnsavedData())
|
||||
{
|
||||
|
@ -961,7 +961,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
}
|
||||
|
||||
// ctrl+s to save
|
||||
if(Input()->KeyDown(KEY_S) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE)
|
||||
if(Input()->KeyPress(KEY_S) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE)
|
||||
{
|
||||
if(m_aFileName[0] && m_ValidSaveFilename)
|
||||
{
|
||||
|
@ -976,18 +976,18 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
}
|
||||
|
||||
// ctrl+shift+s to save as
|
||||
if(Input()->KeyDown(KEY_S) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && (Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) && m_Dialog == DIALOG_NONE)
|
||||
if(Input()->KeyPress(KEY_S) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL)) && (Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT)) && m_Dialog == DIALOG_NONE)
|
||||
InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", "", CallbackSaveMap, this);
|
||||
|
||||
// ctrl+shift+alt+s to save as
|
||||
if(Input()->KeyDown(KEY_S) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && (Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) && (Input()->KeyPressed(KEY_LALT) || Input()->KeyPressed(KEY_RALT)) && m_Dialog == DIALOG_NONE)
|
||||
if(Input()->KeyPress(KEY_S) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL)) && (Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT)) && (Input()->KeyIsPressed(KEY_LALT) || Input()->KeyIsPressed(KEY_RALT)) && m_Dialog == DIALOG_NONE)
|
||||
InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", "", CallbackSaveCopyMap, this);
|
||||
|
||||
// detail button
|
||||
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
||||
static int s_HqButton = 0;
|
||||
if(DoButton_Editor(&s_HqButton, "HD", m_ShowDetail, &Button, 0, "[ctrl+h] Toggle High Detail") ||
|
||||
(Input()->KeyDown(KEY_H) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))))
|
||||
(Input()->KeyPress(KEY_H) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||
{
|
||||
m_ShowDetail = !m_ShowDetail;
|
||||
}
|
||||
|
@ -998,7 +998,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||
static int s_AnimateButton = 0;
|
||||
if(DoButton_Editor(&s_AnimateButton, "Anim", m_Animate, &Button, 0, "[ctrl+m] Toggle animation") ||
|
||||
(Input()->KeyDown(KEY_M) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))))
|
||||
(Input()->KeyPress(KEY_M) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||
{
|
||||
m_AnimateStart = time_get();
|
||||
m_Animate = !m_Animate;
|
||||
|
@ -1010,7 +1010,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||
static int s_ProofButton = 0;
|
||||
if(DoButton_Editor(&s_ProofButton, "Proof", m_ProofBorders, &Button, 0, "[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.") ||
|
||||
(Input()->KeyDown(KEY_P) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))))
|
||||
(Input()->KeyPress(KEY_P) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||
{
|
||||
m_ProofBorders = !m_ProofBorders;
|
||||
}
|
||||
|
@ -1021,7 +1021,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||
static int s_TileInfoButton = 0;
|
||||
if(DoButton_Editor(&s_TileInfoButton, "Info", m_ShowTileInfo, &Button, 0, "[ctrl+i] Show tile informations") ||
|
||||
(Input()->KeyDown(KEY_I) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))))
|
||||
(Input()->KeyPress(KEY_I) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||
{
|
||||
m_ShowTileInfo = !m_ShowTileInfo;
|
||||
m_ShowEnvelopePreview = 0;
|
||||
|
@ -1033,7 +1033,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||
static int s_AllowPlaceUnusedTilesButton = 0;
|
||||
if(DoButton_Editor(&s_AllowPlaceUnusedTilesButton, "Unused", m_AllowPlaceUnusedTiles, &Button, 0, "[ctrl+u] Allow placing unused tiles") ||
|
||||
(Input()->KeyDown('u') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))))
|
||||
(Input()->KeyPress('u') && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||
{
|
||||
m_AllowPlaceUnusedTiles = !m_AllowPlaceUnusedTiles;
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
// flip buttons
|
||||
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
||||
static int s_FlipXButton = 0;
|
||||
if(DoButton_Ex(&s_FlipXButton, "X/X", Enabled, &Button, 0, "[N] Flip brush horizontal", CUI::CORNER_L) || (Input()->KeyDown(KEY_N) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
if(DoButton_Ex(&s_FlipXButton, "X/X", Enabled, &Button, 0, "[N] Flip brush horizontal", CUI::CORNER_L) || (Input()->KeyPress(KEY_N) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
{
|
||||
for(int i = 0; i < m_Brush.m_lLayers.size(); i++)
|
||||
m_Brush.m_lLayers[i]->BrushFlipX();
|
||||
|
@ -1099,7 +1099,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
|
||||
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
||||
static int s_FlipyButton = 0;
|
||||
if(DoButton_Ex(&s_FlipyButton, "Y/Y", Enabled, &Button, 0, "[M] Flip brush vertical", CUI::CORNER_R) || (Input()->KeyDown(KEY_M) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
if(DoButton_Ex(&s_FlipyButton, "Y/Y", Enabled, &Button, 0, "[M] Flip brush vertical", CUI::CORNER_R) || (Input()->KeyPress(KEY_M) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
{
|
||||
for(int i = 0; i < m_Brush.m_lLayers.size(); i++)
|
||||
m_Brush.m_lLayers[i]->BrushFlipY();
|
||||
|
@ -1124,7 +1124,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
|
||||
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
||||
static int s_CcwButton = 0;
|
||||
if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || (Input()->KeyDown(KEY_R) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || (Input()->KeyPress(KEY_R) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
{
|
||||
for(int i = 0; i < m_Brush.m_lLayers.size(); i++)
|
||||
m_Brush.m_lLayers[i]->BrushRotate(-s_RotationAmount/360.0f*pi*2);
|
||||
|
@ -1132,7 +1132,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
|
||||
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
||||
static int s_CwButton = 0;
|
||||
if(DoButton_Ex(&s_CwButton, "CW", Enabled, &Button, 0, "[T] Rotates the brush clockwise", CUI::CORNER_R) || (Input()->KeyDown(KEY_T) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
if(DoButton_Ex(&s_CwButton, "CW", Enabled, &Button, 0, "[T] Rotates the brush clockwise", CUI::CORNER_R) || (Input()->KeyPress(KEY_T) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
|
||||
{
|
||||
for(int i = 0; i < m_Brush.m_lLayers.size(); i++)
|
||||
m_Brush.m_lLayers[i]->BrushRotate(s_RotationAmount/360.0f*pi*2);
|
||||
|
@ -1228,7 +1228,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
// refocus button
|
||||
TB_Bottom.VSplitLeft(50.0f, &Button, &TB_Bottom);
|
||||
static int s_RefocusButton = 0;
|
||||
if(DoButton_Editor(&s_RefocusButton, "Refocus", m_WorldOffsetX&&m_WorldOffsetY?0:-1, &Button, 0, "[HOME] Restore map focus") || (m_EditBoxActive == 0 && Input()->KeyDown(KEY_HOME)))
|
||||
if(DoButton_Editor(&s_RefocusButton, "Refocus", m_WorldOffsetX&&m_WorldOffsetY?0:-1, &Button, 0, "[HOME] Restore map focus") || (m_EditBoxActive == 0 && Input()->KeyPress(KEY_HOME)))
|
||||
{
|
||||
m_WorldOffsetX = 0;
|
||||
m_WorldOffsetY = 0;
|
||||
|
@ -1331,7 +1331,7 @@ void CEditor::DoSoundSource(CSoundSource *pSource, int Index)
|
|||
UI()->SetHotItem(pID);
|
||||
|
||||
bool IgnoreGrid;
|
||||
if(Input()->KeyPressed(KEY_LALT) || Input()->KeyPressed(KEY_RALT))
|
||||
if(Input()->KeyIsPressed(KEY_LALT) || Input()->KeyIsPressed(KEY_RALT))
|
||||
IgnoreGrid = true;
|
||||
else
|
||||
IgnoreGrid = false;
|
||||
|
@ -1466,7 +1466,7 @@ void CEditor::DoQuad(CQuad *q, int Index)
|
|||
UI()->SetHotItem(pID);
|
||||
|
||||
bool IgnoreGrid;
|
||||
if(Input()->KeyPressed(KEY_LALT) || Input()->KeyPressed(KEY_RALT))
|
||||
if(Input()->KeyIsPressed(KEY_LALT) || Input()->KeyIsPressed(KEY_RALT))
|
||||
IgnoreGrid = true;
|
||||
else
|
||||
IgnoreGrid = false;
|
||||
|
@ -1617,9 +1617,9 @@ void CEditor::DoQuad(CQuad *q, int Index)
|
|||
|
||||
if(UI()->MouseButton(0))
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
s_Operation = OP_MOVE_PIVOT;
|
||||
else if(Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))
|
||||
else if(Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))
|
||||
{
|
||||
m_LockMouse = true;
|
||||
s_Operation = OP_ROTATE;
|
||||
|
@ -1642,7 +1642,7 @@ void CEditor::DoQuad(CQuad *q, int Index)
|
|||
|
||||
if(UI()->MouseButton(1))
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
{
|
||||
if(m_SelectedQuad != Index)
|
||||
m_SelectedPoints = 0;
|
||||
|
@ -1702,7 +1702,7 @@ void CEditor::DoQuadPoint(CQuad *pQuad, int QuadIndex, int V)
|
|||
static int s_Operation = OP_NONE;
|
||||
|
||||
bool IgnoreGrid;
|
||||
if(Input()->KeyPressed(KEY_LALT) || Input()->KeyPressed(KEY_RALT))
|
||||
if(Input()->KeyIsPressed(KEY_LALT) || Input()->KeyIsPressed(KEY_RALT))
|
||||
IgnoreGrid = true;
|
||||
else
|
||||
IgnoreGrid = false;
|
||||
|
@ -1787,7 +1787,7 @@ void CEditor::DoQuadPoint(CQuad *pQuad, int QuadIndex, int V)
|
|||
{
|
||||
if(!s_Moved)
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
m_SelectedPoints ^= 1<<V;
|
||||
else
|
||||
m_SelectedPoints = 1<<V;
|
||||
|
@ -1814,7 +1814,7 @@ void CEditor::DoQuadPoint(CQuad *pQuad, int QuadIndex, int V)
|
|||
{
|
||||
UI()->SetActiveItem(pID);
|
||||
s_Moved = false;
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
{
|
||||
s_Operation = OP_MOVEUV;
|
||||
m_LockMouse = true;
|
||||
|
@ -1824,7 +1824,7 @@ void CEditor::DoQuadPoint(CQuad *pQuad, int QuadIndex, int V)
|
|||
|
||||
if(!(m_SelectedPoints&(1<<V)))
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
m_SelectedPoints |= 1<<V;
|
||||
else
|
||||
m_SelectedPoints = 1<<V;
|
||||
|
@ -1840,7 +1840,7 @@ void CEditor::DoQuadPoint(CQuad *pQuad, int QuadIndex, int V)
|
|||
UI()->SetActiveItem(pID);
|
||||
if(!(m_SelectedPoints&(1<<V)))
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
m_SelectedPoints |= 1<<V;
|
||||
else
|
||||
m_SelectedPoints = 1<<V;
|
||||
|
@ -2006,7 +2006,7 @@ void CEditor::DoQuadEnvPoint(const CQuad *pQuad, int QIndex, int PIndex)
|
|||
}
|
||||
|
||||
bool IgnoreGrid;
|
||||
if(Input()->KeyPressed(KEY_LALT) || Input()->KeyPressed(KEY_RALT))
|
||||
if(Input()->KeyIsPressed(KEY_LALT) || Input()->KeyIsPressed(KEY_RALT))
|
||||
IgnoreGrid = true;
|
||||
else
|
||||
IgnoreGrid = false;
|
||||
|
@ -2063,7 +2063,7 @@ void CEditor::DoQuadEnvPoint(const CQuad *pQuad, int QIndex, int PIndex)
|
|||
|
||||
if(UI()->MouseButton(0))
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL))
|
||||
if(Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))
|
||||
{
|
||||
m_LockMouse = true;
|
||||
s_Operation = OP_ROTATE;
|
||||
|
@ -2275,9 +2275,9 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
|
|||
s_StartWx = wx;
|
||||
s_StartWy = wy;
|
||||
|
||||
if(Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL) || UI()->MouseButton(2))
|
||||
if(Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL) || UI()->MouseButton(2))
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT))
|
||||
s_Operation = OP_PAN_EDITOR;
|
||||
else
|
||||
s_Operation = OP_PAN_WORLD;
|
||||
|
@ -2389,7 +2389,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
|
|||
}
|
||||
|
||||
CLayerTiles *pLayer = (CLayerTiles*)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||
if((Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT)) && pLayer)
|
||||
if((Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT)) && pLayer)
|
||||
s_Operation = OP_BRUSH_PAINT;
|
||||
}
|
||||
|
||||
|
@ -2704,7 +2704,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
}
|
||||
else if(pProps[i].m_Type == PROPTYPE_ANGLE_SCROLL)
|
||||
{
|
||||
bool Shift = Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT);
|
||||
bool Shift = Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT);
|
||||
int Value = pProps[i].m_Value;
|
||||
if (!Shift && UI()->MouseButton(0) && UI()->ActiveItem() == &pIDs[i])
|
||||
Value = (Value / 45) * 45;
|
||||
|
@ -2895,9 +2895,9 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
|||
int ScrollNum = (int)((LayersHeight-LayersBox.h)/15.0f)+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue = clamp(s_ScrollValue - 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue = clamp(s_ScrollValue + 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -3390,9 +3390,9 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
|||
int ScrollNum = (int)((ImagesHeight-ToolBox.h)/14.0f)+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue = clamp(s_ScrollValue - 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue = clamp(s_ScrollValue + 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -3562,9 +3562,9 @@ void CEditor::RenderSounds(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
|||
int ScrollNum = (int)((SoundsHeight-ToolBox.h)/14.0f)+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue = clamp(s_ScrollValue - 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue = clamp(s_ScrollValue + 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -3797,9 +3797,9 @@ void CEditor::RenderFileDialog()
|
|||
int ScrollNum = m_FileList.size()-Num+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
m_FileDialogScrollValue -= 3.0f/ScrollNum;
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
m_FileDialogScrollValue += 3.0f/ScrollNum;
|
||||
}
|
||||
else
|
||||
|
@ -3969,7 +3969,7 @@ void CEditor::RenderFileDialog()
|
|||
|
||||
ButtonBar.VSplitRight(40.0f, &ButtonBar, &Button);
|
||||
ButtonBar.VSplitRight(50.0f, &ButtonBar, &Button);
|
||||
if(DoButton_Editor(&s_CancelButton, "Cancel", 0, &Button, 0, 0) || Input()->KeyPressed(KEY_ESCAPE))
|
||||
if(DoButton_Editor(&s_CancelButton, "Cancel", 0, &Button, 0, 0) || Input()->KeyIsPressed(KEY_ESCAPE))
|
||||
m_Dialog = DIALOG_NONE;
|
||||
|
||||
if(m_FileDialogStorageType == IStorage::TYPE_SAVE)
|
||||
|
@ -4597,11 +4597,11 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
|
||||
{
|
||||
if(i != 0)
|
||||
{
|
||||
if((Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))
|
||||
if((Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL)))
|
||||
pEnvelope->m_lPoints[i].m_Time += (int)((m_MouseDeltaX));
|
||||
else
|
||||
pEnvelope->m_lPoints[i].m_Time += (int)((m_MouseDeltaX*TimeScale)*1000.0f);
|
||||
|
@ -4613,7 +4613,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
}
|
||||
else
|
||||
{
|
||||
if((Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))
|
||||
if((Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL)))
|
||||
pEnvelope->m_lPoints[i].m_aValues[c] -= f2fx(m_MouseDeltaY*0.001f);
|
||||
else
|
||||
pEnvelope->m_lPoints[i].m_aValues[c] -= f2fx(m_MouseDeltaY*ValueScale);
|
||||
|
@ -4665,7 +4665,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
m_pTooltip = "Left mouse to drag. Hold ctrl to be more precise. Hold shift to alter time point aswell. Right click to delete.";
|
||||
}
|
||||
|
||||
if(pID == s_pID && (Input()->KeyPressed(KEY_RETURN) || Input()->KeyPressed(KEY_KP_ENTER)))
|
||||
if(pID == s_pID && (Input()->KeyIsPressed(KEY_RETURN) || Input()->KeyIsPressed(KEY_KP_ENTER)))
|
||||
{
|
||||
if(i != 0)
|
||||
{
|
||||
|
@ -4756,7 +4756,7 @@ void CEditor::RenderServerSettingsEditor(CUIRect View)
|
|||
ToolBar.VSplitRight(50.0f, &ToolBar, &Button);
|
||||
static int s_AddButton = 0;
|
||||
if(DoButton_Editor(&s_AddButton, "Add", 0, &Button, 0, "Add a command to command list.")
|
||||
|| ((Input()->KeyDown(KEY_RETURN) || Input()->KeyDown(KEY_KP_ENTER)) && UI()->LastActiveItem() == &m_CommandBox))
|
||||
|| ((Input()->KeyPress(KEY_RETURN) || Input()->KeyPress(KEY_KP_ENTER)) && UI()->LastActiveItem() == &m_CommandBox))
|
||||
{
|
||||
if(m_aSettingsCommand[0] != 0 && str_find(m_aSettingsCommand, " "))
|
||||
{
|
||||
|
@ -4783,7 +4783,7 @@ void CEditor::RenderServerSettingsEditor(CUIRect View)
|
|||
Button.VSplitRight(5.0f, &Button, 0);
|
||||
static int s_AddButton = 0;
|
||||
if(DoButton_Editor(&s_AddButton, "Del", 0, &Button, 0, "Delete a command from the command list.")
|
||||
|| Input()->KeyDown(KEY_DELETE))
|
||||
|| Input()->KeyPress(KEY_DELETE))
|
||||
if(s_CommandSelectedIndex > -1 && s_CommandSelectedIndex < m_Map.m_lSettings.size())
|
||||
m_Map.m_lSettings.remove_index(s_CommandSelectedIndex);
|
||||
}
|
||||
|
@ -4814,9 +4814,9 @@ void CEditor::RenderServerSettingsEditor(CUIRect View)
|
|||
int ScrollNum = (int)((ListHeight-ListBox.h)/17.0f)+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue = clamp(s_ScrollValue - 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue = clamp(s_ScrollValue + 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
|
@ -5020,7 +5020,7 @@ void CEditor::Render()
|
|||
RenderBackground(View, ms_CheckerTexture, 32.0f, 1.0f);
|
||||
|
||||
CUIRect MenuBar, CModeBar, ToolBar, StatusBar, ExtraEditor, UndoList, ToolBox;
|
||||
m_ShowPicker = Input()->KeyPressed(KEY_SPACE) != 0 && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && UI()->LastActiveItem() != &m_CommandBox;
|
||||
m_ShowPicker = Input()->KeyIsPressed(KEY_SPACE) != 0 && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && UI()->LastActiveItem() != &m_CommandBox;
|
||||
|
||||
if(m_GuiActive)
|
||||
{
|
||||
|
@ -5053,11 +5053,11 @@ void CEditor::Render()
|
|||
DoMapEditor(View, ToolBar);
|
||||
|
||||
// do zooming
|
||||
if(Input()->KeyPresses(KEY_KP_MINUS) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
|
||||
if(Input()->KeyPress(KEY_KP_MINUS) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
|
||||
m_ZoomLevel += 50;
|
||||
if(Input()->KeyPresses(KEY_KP_PLUS) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
|
||||
if(Input()->KeyPress(KEY_KP_PLUS) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
|
||||
m_ZoomLevel -= 50;
|
||||
if(Input()->KeyDown(KEY_KP_MULTIPLY) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
|
||||
if(Input()->KeyPress(KEY_KP_MULTIPLY) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
|
||||
{
|
||||
m_EditorOffsetX = 0;
|
||||
m_EditorOffsetY = 0;
|
||||
|
@ -5067,9 +5067,9 @@ void CEditor::Render()
|
|||
{
|
||||
// Determines in which direction to zoom.
|
||||
int Zoom = 0;
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
Zoom--;
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
Zoom++;
|
||||
|
||||
if(Zoom != 0)
|
||||
|
@ -5177,7 +5177,7 @@ void CEditor::Render()
|
|||
int NKeys = 0;
|
||||
for(int i = 0; i < KEY_LAST; i++)
|
||||
{
|
||||
if(Input()->KeyPressed(i))
|
||||
if(Input()->KeyIsPressed(i))
|
||||
{
|
||||
if(NKeys)
|
||||
TextRender()->TextEx(&Cursor, " + ", -1);
|
||||
|
@ -5572,9 +5572,9 @@ void CEditor::UpdateAndRender()
|
|||
}
|
||||
|
||||
int Buttons = 0;
|
||||
if(Input()->KeyPressed(KEY_MOUSE_1)) Buttons |= 1;
|
||||
if(Input()->KeyPressed(KEY_MOUSE_2)) Buttons |= 2;
|
||||
if(Input()->KeyPressed(KEY_MOUSE_3)) Buttons |= 4;
|
||||
if(Input()->KeyIsPressed(KEY_MOUSE_1)) Buttons |= 1;
|
||||
if(Input()->KeyIsPressed(KEY_MOUSE_2)) Buttons |= 2;
|
||||
if(Input()->KeyIsPressed(KEY_MOUSE_3)) Buttons |= 4;
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
static int ButtonsOneFrameDelay = 0; // For Android touch input
|
||||
|
@ -5587,10 +5587,10 @@ void CEditor::UpdateAndRender()
|
|||
}
|
||||
|
||||
// toggle gui
|
||||
if(Input()->KeyDown(KEY_TAB))
|
||||
if(Input()->KeyPress(KEY_TAB))
|
||||
m_GuiActive = !m_GuiActive;
|
||||
|
||||
if(Input()->KeyDown(KEY_F10))
|
||||
if(Input()->KeyPress(KEY_F10))
|
||||
m_ShowMousePointer = false;
|
||||
|
||||
if (g_Config.m_ClEditorUndo)
|
||||
|
@ -5611,13 +5611,13 @@ void CEditor::UpdateAndRender()
|
|||
}
|
||||
Render();
|
||||
|
||||
if(Input()->KeyDown(KEY_F10))
|
||||
if(Input()->KeyPress(KEY_F10))
|
||||
{
|
||||
Graphics()->TakeScreenshot(0);
|
||||
m_ShowMousePointer = true;
|
||||
}
|
||||
|
||||
Input()->ClearEvents();
|
||||
Input()->Clear();
|
||||
}
|
||||
|
||||
IEditor *CreateEditor() { return new CEditor; }
|
||||
|
|
|
@ -188,7 +188,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = GetTile(r.x+x, r.y+y);
|
||||
|
||||
// copy the tele data
|
||||
if(!m_pEditor->Input()->KeyPressed(KEY_SPACE))
|
||||
if(!m_pEditor->Input()->KeyIsPressed(KEY_SPACE))
|
||||
for(int y = 0; y < r.h; y++)
|
||||
for(int x = 0; x < r.w; x++)
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = GetTile(r.x+x, r.y+y);
|
||||
|
||||
// copy the speedup data
|
||||
if(!m_pEditor->Input()->KeyPressed(KEY_SPACE))
|
||||
if(!m_pEditor->Input()->KeyIsPressed(KEY_SPACE))
|
||||
for(int y = 0; y < r.h; y++)
|
||||
for(int x = 0; x < r.w; x++)
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = GetTile(r.x+x, r.y+y);
|
||||
|
||||
// copy the switch data
|
||||
if(!m_pEditor->Input()->KeyPressed(KEY_SPACE))
|
||||
if(!m_pEditor->Input()->KeyIsPressed(KEY_SPACE))
|
||||
for(int y = 0; y < r.h; y++)
|
||||
for(int x = 0; x < r.w; x++)
|
||||
{
|
||||
|
@ -279,7 +279,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = GetTile(r.x+x, r.y+y);
|
||||
|
||||
// copy the tiles
|
||||
if(!m_pEditor->Input()->KeyPressed(KEY_SPACE))
|
||||
if(!m_pEditor->Input()->KeyIsPressed(KEY_SPACE))
|
||||
for(int y = 0; y < r.h; y++)
|
||||
for(int x = 0; x < r.w; x++)
|
||||
{
|
||||
|
|
|
@ -88,7 +88,7 @@ void CEditor::UiDoPopupMenu()
|
|||
m_PopupEventWasActivated = false;
|
||||
}
|
||||
|
||||
if(Input()->KeyDown(KEY_ESCAPE))
|
||||
if(Input()->KeyPress(KEY_ESCAPE))
|
||||
{
|
||||
m_LockMouse = false;
|
||||
UI()->SetActiveItem(0);
|
||||
|
@ -1124,9 +1124,9 @@ int CEditor::PopupSelectImage(CEditor *pEditor, CUIRect View)
|
|||
int ScrollNum = (int)((ImagesHeight-ButtonBar.h)/14.0f)+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(pEditor->Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(pEditor->Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue = clamp(s_ScrollValue - 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
if(pEditor->Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(pEditor->Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue = clamp(s_ScrollValue + 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -1235,9 +1235,9 @@ int CEditor::PopupSelectSound(CEditor *pEditor, CUIRect View)
|
|||
int ScrollNum = (int)((SoundsHeight-ButtonBar.h)/14.0f)+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(pEditor->Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
if(pEditor->Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue = clamp(s_ScrollValue - 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
if(pEditor->Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
if(pEditor->Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue = clamp(s_ScrollValue + 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue