1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00

SDL1 wipe, part 2. Untested.

This commit is contained in:
AlexVinS 2015-06-21 01:17:44 +03:00
parent dca1e28bc1
commit b6a2323e01
11 changed files with 3 additions and 39 deletions

View File

@ -266,9 +266,7 @@ void Graphics::loadHeroFlagsDetail(std::pair<std::vector<CDefEssential *> Graphi
for(auto & curImg : curImgs) for(auto & curImg : curImgs)
{ {
CSDL_Ext::setDefaultColorKey(curImg.bitmap); CSDL_Ext::setDefaultColorKey(curImg.bitmap);
#ifndef VCMI_SDL1
SDL_SetSurfaceBlendMode(curImg.bitmap,SDL_BLENDMODE_NONE); SDL_SetSurfaceBlendMode(curImg.bitmap,SDL_BLENDMODE_NONE);
#endif
} }
} }
} }

View File

@ -27,10 +27,8 @@ void CCursorHandler::initCursor()
currentCursor = nullptr; currentCursor = nullptr;
help = CSDL_Ext::newSurface(40,40); help = CSDL_Ext::newSurface(40,40);
#ifndef VCMI_SDL1
//No blending. Ensure, that we are copying pixels during "screen restore draw" //No blending. Ensure, that we are copying pixels during "screen restore draw"
SDL_SetSurfaceBlendMode(help,SDL_BLENDMODE_NONE); SDL_SetSurfaceBlendMode(help,SDL_BLENDMODE_NONE);
#endif // VCMI_SDL1
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
changeGraphic(ECursor::ADVENTURE, 0); changeGraphic(ECursor::ADVENTURE, 0);

View File

@ -63,10 +63,7 @@ void CGuiHandler::processLists(const ui16 activityFlag, std::function<void (std:
processList(CIntObject::TIME,activityFlag,&timeinterested,cb); processList(CIntObject::TIME,activityFlag,&timeinterested,cb);
processList(CIntObject::WHEEL,activityFlag,&wheelInterested,cb); processList(CIntObject::WHEEL,activityFlag,&wheelInterested,cb);
processList(CIntObject::DOUBLECLICK,activityFlag,&doubleClickInterested,cb); processList(CIntObject::DOUBLECLICK,activityFlag,&doubleClickInterested,cb);
#ifndef VCMI_SDL1
processList(CIntObject::TEXTINPUT,activityFlag,&textInterested,cb); processList(CIntObject::TEXTINPUT,activityFlag,&textInterested,cb);
#endif // VCMI_SDL1
} }
void CGuiHandler::handleElementActivate(CIntObject * elem, ui16 activityFlag) void CGuiHandler::handleElementActivate(CIntObject * elem, ui16 activityFlag)
@ -197,9 +194,7 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
if(key.keysym.sym == SDLK_KP_ENTER) if(key.keysym.sym == SDLK_KP_ENTER)
{ {
key.keysym.sym = (SDLKey)SDLK_RETURN; key.keysym.sym = (SDLKey)SDLK_RETURN;
#ifndef VCMI_SDL1
key.keysym.scancode = SDL_SCANCODE_RETURN; key.keysym.scancode = SDL_SCANCODE_RETURN;
#endif // VCMI_SDL1
} }
bool keysCaptured = false; bool keysCaptured = false;
@ -271,7 +266,6 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
} }
} }
} }
#ifndef VCMI_SDL1 //SDL2x only events
else if (sEvent->type == SDL_MOUSEWHEEL) else if (sEvent->type == SDL_MOUSEWHEEL)
{ {
std::list<CIntObject*> hlp = wheelInterested; std::list<CIntObject*> hlp = wheelInterested;
@ -296,7 +290,6 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
} }
} }
//todo: muiltitouch //todo: muiltitouch
#endif // VCMI_SDL1
else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_LEFT)) else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_LEFT))
{ {
std::list<CIntObject*> hlp = lclickable; std::list<CIntObject*> hlp = lclickable;
@ -330,7 +323,6 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
} }
} }
current = nullptr; current = nullptr;
} //event end } //event end
void CGuiHandler::handleMouseMotion(SDL_Event *sEvent) void CGuiHandler::handleMouseMotion(SDL_Event *sEvent)

View File

@ -58,10 +58,9 @@ private:
motioninterested, motioninterested,
timeinterested, timeinterested,
wheelInterested, wheelInterested,
doubleClickInterested; doubleClickInterested,
#ifndef VCMI_SDL1 textInterested;
CIntObjectList textInterested;
#endif // VCMI_SDL1
void processLists(const ui16 activityFlag, std::function<void (std::list<CIntObject*> *)> cb); void processLists(const ui16 activityFlag, std::function<void (std::list<CIntObject*> *)> cb);
public: public:

View File

@ -133,10 +133,8 @@ public:
virtual void keyPressed(const SDL_KeyboardEvent & key){} virtual void keyPressed(const SDL_KeyboardEvent & key){}
virtual bool captureThisEvent(const SDL_KeyboardEvent & key); //allows refining captureAllKeys against specific events (eg. don't capture ENTER) virtual bool captureThisEvent(const SDL_KeyboardEvent & key); //allows refining captureAllKeys against specific events (eg. don't capture ENTER)
#ifndef VCMI_SDL1
virtual void textInputed(const SDL_TextInputEvent & event){}; virtual void textInputed(const SDL_TextInputEvent & event){};
virtual void textEdited(const SDL_TextEditingEvent & event){}; virtual void textEdited(const SDL_TextEditingEvent & event){};
#endif // VCMI_SDL1
//mouse movement handling //mouse movement handling
bool strongInterest; //if true - report all mouse movements, if not - only when hovered bool strongInterest; //if true - report all mouse movements, if not - only when hovered

View File

@ -967,23 +967,19 @@ SDL_Color CSDL_Ext::makeColor(ui8 r, ui8 g, ui8 b, ui8 a)
void CSDL_Ext::startTextInput(SDL_Rect * where) void CSDL_Ext::startTextInput(SDL_Rect * where)
{ {
#ifndef VCMI_SDL1
if (SDL_IsTextInputActive() == SDL_FALSE) if (SDL_IsTextInputActive() == SDL_FALSE)
{ {
SDL_StartTextInput(); SDL_StartTextInput();
} }
SDL_SetTextInputRect(where); SDL_SetTextInputRect(where);
#endif
} }
void CSDL_Ext::stopTextInput() void CSDL_Ext::stopTextInput()
{ {
#ifndef VCMI_SDL1
if (SDL_IsTextInputActive() == SDL_TRUE) if (SDL_IsTextInputActive() == SDL_TRUE)
{ {
SDL_StopTextInput(); SDL_StopTextInput();
} }
#endif
} }
STRONG_INLINE static uint32_t mapColor(SDL_Surface * surface, SDL_Color color) STRONG_INLINE static uint32_t mapColor(SDL_Surface * surface, SDL_Color color)

View File

@ -10,15 +10,10 @@
#pragma once #pragma once
#include <SDL_version.h> #include <SDL_version.h>
#ifndef VCMI_SDL1
#include <SDL_render.h> #include <SDL_render.h>
#endif
#include <SDL_video.h> #include <SDL_video.h>
#include <SDL_events.h> #include <SDL_events.h>
#include "../../lib/int3.h" #include "../../lib/int3.h"
//#include "../Graphics.h"
#include "Geometries.h" #include "Geometries.h"
#include "../../lib/GameConstants.h" #include "../../lib/GameConstants.h"

View File

@ -1126,8 +1126,6 @@ void CInGameConsole::keyPressed (const SDL_KeyboardEvent & key)
} }
} }
#ifndef VCMI_SDL1
void CInGameConsole::textInputed(const SDL_TextInputEvent & event) void CInGameConsole::textInputed(const SDL_TextInputEvent & event)
{ {
if(!captureAllKeys || enteredText.size() == 0) if(!captureAllKeys || enteredText.size() == 0)
@ -1145,8 +1143,6 @@ void CInGameConsole::textEdited(const SDL_TextEditingEvent & event)
//do nothing here //do nothing here
} }
#endif // VCMI_SDL1
void CInGameConsole::startEnteringText() void CInGameConsole::startEnteringText()
{ {
CSDL_Ext::startTextInput(&pos); CSDL_Ext::startTextInput(&pos);

View File

@ -369,10 +369,8 @@ public:
void print(const std::string &txt); void print(const std::string &txt);
void keyPressed (const SDL_KeyboardEvent & key); //call-in void keyPressed (const SDL_KeyboardEvent & key); //call-in
#ifndef VCMI_SDL1
void textInputed(const SDL_TextInputEvent & event) override; void textInputed(const SDL_TextInputEvent & event) override;
void textEdited(const SDL_TextEditingEvent & event) override; void textEdited(const SDL_TextEditingEvent & event) override;
#endif // VCMI_SDL1
void startEnteringText(); void startEnteringText();
void endEnteringText(bool printEnteredText); void endEnteringText(bool printEnteredText);

View File

@ -174,13 +174,9 @@ public:
void keyPressed(const SDL_KeyboardEvent & key) override; void keyPressed(const SDL_KeyboardEvent & key) override;
bool captureThisEvent(const SDL_KeyboardEvent & key) override; bool captureThisEvent(const SDL_KeyboardEvent & key) override;
#ifndef VCMI_SDL1
void textInputed(const SDL_TextInputEvent & event) override; void textInputed(const SDL_TextInputEvent & event) override;
void textEdited(const SDL_TextEditingEvent & event) override; void textEdited(const SDL_TextEditingEvent & event) override;
#endif // VCMI_SDL1
//Filter that will block all characters not allowed in filenames //Filter that will block all characters not allowed in filenames
static void filenameFilter(std::string &text, const std::string & oldText); static void filenameFilter(std::string &text, const std::string & oldText);
//Filter that will allow only input of numbers in range min-max (min-max are allowed) //Filter that will allow only input of numbers in range min-max (min-max are allowed)

View File

@ -1089,9 +1089,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 &GrailPos, double discoveredRatio):
piecesToRemove.push_back(piece); piecesToRemove.push_back(piece);
piece->needRefresh = true; piece->needRefresh = true;
piece->recActions = piece->recActions & ~SHOWALL; piece->recActions = piece->recActions & ~SHOWALL;
#ifndef VCMI_SDL1
SDL_SetSurfaceBlendMode(piece->bg,SDL_BLENDMODE_BLEND); SDL_SetSurfaceBlendMode(piece->bg,SDL_BLENDMODE_BLEND);
#endif // VCMI_SDL1
} }
} }
} }