mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Added love.keyboard.setTextInput to enable/disable text input events (enabled by default.)
This fixes the issue of receiving an unwanted text input event if a key is used to bring a game's textbox into focus, since textinput events can be triggered after keypress events if the keypress generates text.
This commit is contained in:
@@ -64,6 +64,19 @@ bool Keyboard::isDown(Key *keylist) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void Keyboard::setTextInput(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
SDL_StartTextInput();
|
||||
else
|
||||
SDL_StopTextInput();
|
||||
}
|
||||
|
||||
bool Keyboard::hasTextInput() const
|
||||
{
|
||||
return SDL_IsTextInputActive();
|
||||
}
|
||||
|
||||
std::map<Keyboard::Key, SDL_Keycode> Keyboard::createKeyMap()
|
||||
{
|
||||
std::map<Keyboard::Key, SDL_Keycode> k;
|
||||
|
||||
Reference in New Issue
Block a user