1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00

Fix compilation with SDL1

+ seems to be fully backward compatible (need more testing)
This commit is contained in:
AlexVinS 2014-05-25 14:29:04 +04:00
parent 56c74bc46a
commit 15fe37133c
3 changed files with 12 additions and 11 deletions

View File

@ -815,7 +815,7 @@ static bool checkVideoMode(int monitorIndex, int w, int h, int& bpp, bool fullsc
return false; return false;
#else #else
bpp = SDL_VideoModeOK(w, h, bpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0)); bpp = SDL_VideoModeOK(w, h, bpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0));
return !(bpp==0) return !(bpp==0);
#endif // VCMI_SDL1 #endif // VCMI_SDL1
} }

View File

@ -60,10 +60,10 @@
<Add directory="$(#sdl.include)" /> <Add directory="$(#sdl.include)" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add option="-lSDL.dll" /> <Add option="-lSDL" />
<Add option="-lSDL_image.dll" /> <Add option="-lSDL_image" />
<Add option="-lSDL_mixer.dll" /> <Add option="-lSDL_mixer" />
<Add option="-lSDL_ttf.dll" /> <Add option="-lSDL_ttf" />
<Add directory="$(#sdl.lib)" /> <Add directory="$(#sdl.lib)" />
</Linker> </Linker>
</Target> </Target>
@ -81,10 +81,10 @@
</Compiler> </Compiler>
<Linker> <Linker>
<Add option="-s" /> <Add option="-s" />
<Add option="-lSDL.dll" /> <Add option="-lSDL" />
<Add option="-lSDL_image.dll" /> <Add option="-lSDL_image" />
<Add option="-lSDL_mixer.dll" /> <Add option="-lSDL_mixer" />
<Add option="-lSDL_ttf.dll" /> <Add option="-lSDL_ttf" />
<Add directory="$(#sdl.lib)" /> <Add directory="$(#sdl.lib)" />
</Linker> </Linker>
</Target> </Target>

View File

@ -1651,6 +1651,9 @@ void CTextInput::keyPressed( const SDL_KeyboardEvent & key )
} }
bool redrawNeeded = false; bool redrawNeeded = false;
#ifdef VCMI_SDL1
std::string oldText = text;
#endif // 0
switch(key.keysym.sym) switch(key.keysym.sym)
{ {
case SDLK_DELETE: // have index > ' ' so it won't be filtered out by default section case SDLK_DELETE: // have index > ' ' so it won't be filtered out by default section
@ -1687,8 +1690,6 @@ void CTextInput::keyPressed( const SDL_KeyboardEvent & key )
redraw(); redraw();
cb(text); cb(text);
} }
//todo: handle text input for SDL2
} }
void CTextInput::setText( const std::string &nText, bool callCb ) void CTextInput::setText( const std::string &nText, bool callCb )