61 #include "utils/timer.h"
93 SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS,
"1");
136 const std::string cf = std::string(
"sdl2")
148 const size_t keyStrSize = keyStr.size();
161 std::string keyStr2 = *it;
165 if ((keyStr2[0] <
'0' || keyStr2[0] >
'9')
166 && keyStr2[0] !=
'-')
179 keyStr2 = keyStr2.substr(1);
181 const int key = atoi(keyStr2.c_str());
182 if (key >= -255 && key < SDLK_LAST)
200 const std::string cf = std::string(
"sdl2")
217 std::string tmp(
"k");
235 keyStr.append(tmp).append(
toString(key.value));
240 tmp.c_str(), key.value));
265 val0.type = kd.defaultType1;
267 val1.type = kd.defaultType2;
271 val0.value = SDL_GetScancodeFromKey(kd.defaultValue1);
272 if (val0.value == SDL_SCANCODE_UNKNOWN)
276 val0.value = kd.defaultValue1;
279 val1.value = SDL_GetScancodeFromKey(kd.defaultValue2);
280 if (val1.value == SDL_SCANCODE_UNKNOWN)
284 val1.value = kd.defaultValue2;
287 val0.value = kd.defaultValue1;
288 val1.value = kd.defaultValue2;
319 if (*kdi.configField == 0)
326 if (vali2.value == -1)
333 || (*kdi.configField == 0))
344 && vali2.value == valj2.value
345 && vali2.type == valj2.type)
367 if (!isActionActive0(index))
374 if ((key.condition & mMask) != key.condition)
411 else if (key.value < -1)
420 str =
strprintf(
_(
"JButton%d"), key.value + 1);
427 keyStr.append(
", ").append(str);
434 return _(
"unknown key");
454 else if (key.value < -1)
470 keyStr.append(
", ").append(str);
477 mKeyStr[actionIdx] =
_(
"u key");
481 mKeyStr[actionIdx] =
STD_MOVE(keyStr);
496 if (it == mNameMap.end())
497 return std::string();
498 return getKeyValueString((*it).second);
506 if (it == mNameMap.end())
507 return std::string();
508 return getKeyStringLong((*it).second);
524 (val2.type == type && val2.value == val))
536 val1.type = val2.type;
537 val1.value = val2.value;
557 addActionKey(mNewKeyIndex, type, val);
582 setNewKey(event, type);
614 updateConditionMask(
true);
648 updateConditionMask(
false);
652 case SDL_JOYBUTTONDOWN:
654 updateConditionMask(
true);
663 case SDL_JOYBUTTONUP:
665 updateConditionMask(
false);
678 case SDL_ACCELEROMETER:
694 if (res && event.type == SDL_KEYDOWN)
726 case SDL_JOYBUTTONDOWN:
738 case SDL_ACCELEROMETER:
775 if (focus !=
nullptr)
777 if (
dynamic_cast<TextField*
>(focus->getFocused()) ==
nullptr)
800 if ((dialog ==
nullptr) || !dialog->isTextInputFocused())
802 if ((dialog ==
nullptr) || (dialog->isCloseState() != 0))
861 if ((key ==
nullptr) || (key->condition & mMask) != key->condition)
865 || isActionActive0(key->modKeyIndex);
878 if ((func !=
nullptr) && func(evt))
903 if (it != mChatMap.end())
928 if (it != mChatMap.end())
973 if (kd.action !=
nullptr)
978 if (ki.type == type && ki.value != -1)
980 actionMap[ki.value].push_back(
990 if (ki.type == type && ki.value != -1)
999 if (ki.type == type && ki.value != -1)
1000 keyTimeMap[ki.value] = 0;
1009 if (keys->size() > 1)
1017 if (ptrs ==
nullptr)
1045 if (value == vali2.value &&
1046 (grp & kd.grp) != 0 && vali2.type == type)
1059 if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP)
1085 for (
int i = 0; i < sz; i++)
1095 cmd = std::string(
"/").append(*it);
bool(* ActionFuncPtr)(InputEvent &event)
#define reportAlways(...)
bool isInputFocused() const
std::string getValue(const std::string &key, const std::string &deflt) const
void setValue(const std::string &key, const std::string &value)
Widget * getModalFocused() const
FocusHandler * getFocusHandler() const
static bool isAnyInputFocused()
static bool isStorageActive()
KeysVector * getActionVector(const SDL_Event &event)
void handleRepeat(const int time)
bool isActionActive(const InputActionT index) const
int getButtonFromEvent(const SDL_Event &event) const
InputActionT getActionId(const SDL_Event &event)
static std::string getKeyShortString(const std::string &key)
void handleActivateKey(const SDL_Event &event)
void handleRepeat(const int time)
KeysVector * getActionVector(const SDL_Event &event)
bool isActionActive(const InputActionT index) const
static std::string getKeyName(const int key)
static int getKeyValueFromEvent(const SDL_Event &event)
void handleDeActicateKey(const SDL_Event &event)
const std::string & getFollow() const
static bool isAnyInputFocused()
static NpcDialog * getActive()
void action(const ActionEvent &event)
bool disableGameModifiers
bool isActionActive(const InputActionT index) const
bool isInpupFocused() const
bool isWindowVisible() const
#define FOR_EACHP(type, iter, array)
#define FOR_EACH(type, iter, array)
LocalPlayer * localPlayer
MultiTouchManager multiTouchManager
std::string toString(T const &value)
converts any type to a string
#define BLOCK_START(name)
const bool Protected_true
SetupWindow * setupWindow
StringIntMap::const_iterator StringIntMapCIter
std::string strprintf(const char *const format,...)
void splitToStringVector(StringVect &tokens, const std::string &text, const char separator)
StringVect::const_iterator StringVectCIter
std::vector< std::string > StringVect
TouchManager touchManager
TradeWindow * tradeWindow