mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-15 11:46:56 +02:00
Replaced SDL access with VCMI methods
This commit is contained in:
parent
3fef2a5e1f
commit
d87fb43dcd
@ -66,6 +66,14 @@ SDL_Color CSDL_Ext::toSDL(const ColorRGBA & color)
|
||||
return result;
|
||||
}
|
||||
|
||||
Rect CSDL_Ext::getDisplayBounds()
|
||||
{
|
||||
SDL_Rect displayBounds;
|
||||
SDL_GetDisplayBounds(std::max(0, SDL_GetWindowDisplayIndex(mainWindow)), &displayBounds);
|
||||
|
||||
return fromSDL(displayBounds);
|
||||
}
|
||||
|
||||
void CSDL_Ext::setColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors)
|
||||
{
|
||||
SDL_SetPaletteColors(surface->format->palette,colors,firstcolor,ncolors);
|
||||
|
@ -108,6 +108,9 @@ typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_
|
||||
uint32_t colorTouint32_t(const SDL_Color * color); //little endian only
|
||||
SDL_Color makeColor(ui8 r, ui8 g, ui8 b, ui8 a);
|
||||
|
||||
/// returns dimensions of display on which VCMI window is located
|
||||
Rect getDisplayBounds();
|
||||
|
||||
void update(SDL_Surface * what = screen); //updates whole surface (default - main screen)
|
||||
void drawLine(SDL_Surface * sur, int x1, int y1, int x2, int y2, const SDL_Color & color1, const SDL_Color & color2);
|
||||
void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color &color, int depth = 1);
|
||||
|
@ -28,12 +28,6 @@
|
||||
|
||||
#include "../../lib/CGameState.h"
|
||||
|
||||
#ifdef VCMI_MAC
|
||||
#define SDL_SCANCODE_LCTRL SDL_SCANCODE_LGUI
|
||||
#endif
|
||||
|
||||
#include <SDL_keyboard.h>
|
||||
|
||||
void CGarrisonSlot::setHighlight(bool on)
|
||||
{
|
||||
if (on)
|
||||
@ -439,10 +433,9 @@ void CGarrisonSlot::splitIntoParts(CGarrisonSlot::EGarrisonType type, int amount
|
||||
|
||||
bool CGarrisonSlot::handleSplittingShortcuts()
|
||||
{
|
||||
const uint8_t * state = SDL_GetKeyboardState(NULL);
|
||||
const bool isAlt = !!state[SDL_SCANCODE_LALT];
|
||||
const bool isLShift = !!state[SDL_SCANCODE_LSHIFT];
|
||||
const bool isLCtrl = !!state[SDL_SCANCODE_LCTRL];
|
||||
const bool isAlt = GH.isKeyboardAltDown();
|
||||
const bool isLShift = GH.isKeyboardShiftDown();
|
||||
const bool isLCtrl = GH.isKeyboardCtrlDown();
|
||||
|
||||
if(!isAlt && !isLShift && !isLCtrl)
|
||||
return false; // This is only case when return false
|
||||
|
@ -63,8 +63,6 @@
|
||||
#include "../lib/NetPacksBase.h"
|
||||
#include "../lib/StartInfo.h"
|
||||
|
||||
#include <SDL_video.h>
|
||||
|
||||
using namespace CSDL_Ext;
|
||||
|
||||
CRecruitmentWindow::CCreatureCard::CCreatureCard(CRecruitmentWindow * window, const CCreature * crea, int totalAmount)
|
||||
@ -561,8 +559,7 @@ void CSystemOptionsWindow::selectGameRes()
|
||||
std::vector<std::string> items;
|
||||
|
||||
#ifndef VCMI_IOS
|
||||
SDL_Rect displayBounds;
|
||||
SDL_GetDisplayBounds(std::max(0, SDL_GetWindowDisplayIndex(mainWindow)), &displayBounds);
|
||||
Rect displayBounds = CSDL_Ext::getDisplayBounds();
|
||||
#endif
|
||||
|
||||
size_t currentResolutionIndex = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user