1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +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)
{
CSDL_Ext::setDefaultColorKey(curImg.bitmap);
#ifndef VCMI_SDL1
SDL_SetSurfaceBlendMode(curImg.bitmap,SDL_BLENDMODE_NONE);
#endif
}
}
}

View File

@ -27,10 +27,8 @@ void CCursorHandler::initCursor()
currentCursor = nullptr;
help = CSDL_Ext::newSurface(40,40);
#ifndef VCMI_SDL1
//No blending. Ensure, that we are copying pixels during "screen restore draw"
SDL_SetSurfaceBlendMode(help,SDL_BLENDMODE_NONE);
#endif // VCMI_SDL1
SDL_ShowCursor(SDL_DISABLE);
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::WHEEL,activityFlag,&wheelInterested,cb);
processList(CIntObject::DOUBLECLICK,activityFlag,&doubleClickInterested,cb);
#ifndef VCMI_SDL1
processList(CIntObject::TEXTINPUT,activityFlag,&textInterested,cb);
#endif // VCMI_SDL1
}
void CGuiHandler::handleElementActivate(CIntObject * elem, ui16 activityFlag)
@ -197,9 +194,7 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
if(key.keysym.sym == SDLK_KP_ENTER)
{
key.keysym.sym = (SDLKey)SDLK_RETURN;
#ifndef VCMI_SDL1
key.keysym.scancode = SDL_SCANCODE_RETURN;
#endif // VCMI_SDL1
}
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)
{
std::list<CIntObject*> hlp = wheelInterested;
@ -296,7 +290,6 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
}
}
//todo: muiltitouch
#endif // VCMI_SDL1
else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_LEFT))
{
std::list<CIntObject*> hlp = lclickable;
@ -330,7 +323,6 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
}
}
current = nullptr;
} //event end
void CGuiHandler::handleMouseMotion(SDL_Event *sEvent)

View File

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

View File

@ -133,10 +133,8 @@ public:
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)
#ifndef VCMI_SDL1
virtual void textInputed(const SDL_TextInputEvent & event){};
virtual void textEdited(const SDL_TextEditingEvent & event){};
#endif // VCMI_SDL1
//mouse movement handling
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)
{
#ifndef VCMI_SDL1
if (SDL_IsTextInputActive() == SDL_FALSE)
{
SDL_StartTextInput();
}
SDL_SetTextInputRect(where);
#endif
}
void CSDL_Ext::stopTextInput()
{
#ifndef VCMI_SDL1
if (SDL_IsTextInputActive() == SDL_TRUE)
{
SDL_StopTextInput();
}
#endif
}
STRONG_INLINE static uint32_t mapColor(SDL_Surface * surface, SDL_Color color)

View File

@ -10,15 +10,10 @@
#pragma once
#include <SDL_version.h>
#ifndef VCMI_SDL1
#include <SDL_render.h>
#endif
#include <SDL_video.h>
#include <SDL_events.h>
#include "../../lib/int3.h"
//#include "../Graphics.h"
#include "Geometries.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)
{
if(!captureAllKeys || enteredText.size() == 0)
@ -1145,8 +1143,6 @@ void CInGameConsole::textEdited(const SDL_TextEditingEvent & event)
//do nothing here
}
#endif // VCMI_SDL1
void CInGameConsole::startEnteringText()
{
CSDL_Ext::startTextInput(&pos);

View File

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

View File

@ -174,12 +174,8 @@ public:
void keyPressed(const SDL_KeyboardEvent & key) override;
bool captureThisEvent(const SDL_KeyboardEvent & key) override;
#ifndef VCMI_SDL1
void textInputed(const SDL_TextInputEvent & event) override;
void textEdited(const SDL_TextEditingEvent & event) override;
#endif // VCMI_SDL1
//Filter that will block all characters not allowed in filenames
static void filenameFilter(std::string &text, const std::string & oldText);

View File

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