mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Remove remaining access to SDL_Events
This commit is contained in:
parent
594b7614cf
commit
aab082fd2e
@ -24,7 +24,6 @@
|
||||
#include "../../lib/mapObjects/CArmedInstance.h"
|
||||
|
||||
#include <SDL_timer.h>
|
||||
#include <SDL_events.h>
|
||||
|
||||
CInGameConsole::CInGameConsole()
|
||||
: CIntObject(KEYBOARD | TEXTINPUT),
|
||||
@ -176,19 +175,19 @@ void CInGameConsole::keyPressed (const SDL_Keycode & key)
|
||||
}
|
||||
}
|
||||
|
||||
void CInGameConsole::textInputed(const SDL_TextInputEvent & event)
|
||||
void CInGameConsole::textInputed(const std::string & inputtedText)
|
||||
{
|
||||
if(!captureAllKeys || enteredText.size() == 0)
|
||||
return;
|
||||
enteredText.resize(enteredText.size()-1);
|
||||
|
||||
enteredText += event.text;
|
||||
enteredText += inputtedText;
|
||||
enteredText += "_";
|
||||
|
||||
refreshEnteredText();
|
||||
}
|
||||
|
||||
void CInGameConsole::textEdited(const SDL_TextEditingEvent & event)
|
||||
void CInGameConsole::textEdited(const std::string & inputtedText)
|
||||
{
|
||||
//do nothing here
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ public:
|
||||
void print(const std::string &txt);
|
||||
void keyPressed(const SDL_Keycode & key) override;
|
||||
|
||||
void textInputed(const SDL_TextInputEvent & event) override;
|
||||
void textEdited(const SDL_TextEditingEvent & event) override;
|
||||
void textInputed(const std::string & enteredText) override;
|
||||
void textEdited(const std::string & enteredText) override;
|
||||
|
||||
void startEnteringText();
|
||||
void endEnteringText(bool processEnteredText);
|
||||
|
@ -487,14 +487,14 @@ void CGuiHandler::handleCurrentEvent( SDL_Event & current )
|
||||
{
|
||||
for(auto it : textInterested)
|
||||
{
|
||||
it->textInputed(current.text);
|
||||
it->textInputed(current.text.text);
|
||||
}
|
||||
}
|
||||
else if(current.type == SDL_TEXTEDITING)
|
||||
{
|
||||
for(auto it : textInterested)
|
||||
{
|
||||
it->textEdited(current.edit);
|
||||
it->textEdited(current.edit.text);
|
||||
}
|
||||
}
|
||||
else if(current.type == SDL_MOUSEBUTTONUP)
|
||||
|
@ -18,8 +18,6 @@ class CGuiHandler;
|
||||
class CPicture;
|
||||
|
||||
typedef int32_t SDL_Keycode;
|
||||
struct SDL_TextInputEvent;
|
||||
struct SDL_TextEditingEvent;
|
||||
|
||||
using boost::logic::tribool;
|
||||
|
||||
@ -123,8 +121,8 @@ public:
|
||||
virtual void keyReleased(const SDL_Keycode & key){}
|
||||
virtual bool captureThisKey(const SDL_Keycode & key); //allows refining captureAllKeys against specific events (eg. don't capture ENTER)
|
||||
|
||||
virtual void textInputed(const SDL_TextInputEvent & event){};
|
||||
virtual void textEdited(const SDL_TextEditingEvent & event){};
|
||||
virtual void textInputed(const std::string & enteredText){};
|
||||
virtual void textEdited(const std::string & enteredText){};
|
||||
|
||||
//mouse movement handling
|
||||
bool strongInterest; //if true - report all mouse movements, if not - only when hovered
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "../../lib/CondSh.h"
|
||||
#include "../../lib/mapping/CCampaignHandler.h"
|
||||
|
||||
#include <SDL_events.h>
|
||||
#include <SDL_surface.h>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
@ -61,9 +61,7 @@ ISelectionScreenInfo * SEL;
|
||||
|
||||
static void do_quit()
|
||||
{
|
||||
SDL_Event event;
|
||||
event.quit.type = SDL_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
GH.pushUserEvent(EUserEvent::FORCE_QUIT);
|
||||
}
|
||||
|
||||
CMenuScreen::CMenuScreen(const JsonNode & configNode)
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include "lib/CAndroidVMHelper.h"
|
||||
#endif
|
||||
|
||||
#include <SDL_events.h>
|
||||
|
||||
std::list<CFocusable*> CFocusable::focusables;
|
||||
CFocusable * CFocusable::inputWithFocus;
|
||||
|
||||
@ -610,13 +608,13 @@ bool CTextInput::captureThisKey(const SDL_Keycode & key)
|
||||
return true;
|
||||
}
|
||||
|
||||
void CTextInput::textInputed(const SDL_TextInputEvent & event)
|
||||
void CTextInput::textInputed(const std::string & enteredText)
|
||||
{
|
||||
if(!focus)
|
||||
return;
|
||||
std::string oldText = text;
|
||||
|
||||
text += event.text;
|
||||
text += enteredText;
|
||||
|
||||
filters(text, oldText);
|
||||
if(text != oldText)
|
||||
@ -627,12 +625,12 @@ void CTextInput::textInputed(const SDL_TextInputEvent & event)
|
||||
newText.clear();
|
||||
}
|
||||
|
||||
void CTextInput::textEdited(const SDL_TextEditingEvent & event)
|
||||
void CTextInput::textEdited(const std::string & enteredText)
|
||||
{
|
||||
if(!focus)
|
||||
return;
|
||||
|
||||
newText = event.text;
|
||||
newText = enteredText;
|
||||
redraw();
|
||||
cb(text + newText);
|
||||
}
|
||||
|
@ -229,8 +229,8 @@ public:
|
||||
|
||||
bool captureThisKey(const SDL_Keycode & key) override;
|
||||
|
||||
void textInputed(const SDL_TextInputEvent & event) override;
|
||||
void textEdited(const SDL_TextEditingEvent & event) override;
|
||||
void textInputed(const std::string & enteredText) override;
|
||||
void textEdited(const std::string & enteredText) override;
|
||||
|
||||
//Filter that will block all characters not allowed in filenames
|
||||
static void filenameFilter(std::string & text, const std::string & oldText);
|
||||
|
Loading…
Reference in New Issue
Block a user