1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

SDL1 wipe, part 1. Untested.

This commit is contained in:
AlexVinS
2015-06-21 01:13:45 +03:00
parent 728dac3b47
commit dca1e28bc1
17 changed files with 9 additions and 422 deletions

View File

@ -461,9 +461,7 @@ void CTextInput::keyPressed( const SDL_KeyboardEvent & key )
}
bool redrawNeeded = false;
#ifdef VCMI_SDL1
std::string oldText = text;
#endif // 0
switch(key.keysym.sym)
{
case SDLK_DELETE: // have index > ' ' so it won't be filtered out by default section
@ -481,20 +479,9 @@ void CTextInput::keyPressed( const SDL_KeyboardEvent & key )
}
break;
default:
#ifdef VCMI_SDL1
if (key.keysym.unicode < ' ')
return;
else
{
text += key.keysym.unicode; //TODO 16-/>8
redrawNeeded = true;
}
#endif // 0
break;
}
#ifdef VCMI_SDL1
filters(text, oldText);
#endif // 0
if (redrawNeeded)
{
redraw();
@ -514,18 +501,9 @@ bool CTextInput::captureThisEvent(const SDL_KeyboardEvent & key)
if(key.keysym.sym == SDLK_RETURN || key.keysym.sym == SDLK_KP_ENTER)
return false;
#ifdef VCMI_SDL1
//this should allow all non-printable keys to go through (for example arrows)
if (key.keysym.unicode < ' ')
return false;
return true;
#else
return false;
#endif
}
#ifndef VCMI_SDL1
void CTextInput::textInputed(const SDL_TextInputEvent & event)
{
if(!focus)
@ -553,9 +531,6 @@ void CTextInput::textEdited(const SDL_TextEditingEvent & event)
cb(text+newText);
}
#endif
void CTextInput::filenameFilter(std::string & text, const std::string &)
{
static const std::string forbiddenChars = "<>:\"/\\|?*\r\n"; //if we are entering a filename, some special characters won't be allowed