1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Removed most SDL includes from headers, removed SDL int's

This commit is contained in:
Ivan Savenko
2023-01-30 19:55:32 +02:00
parent e14290fde0
commit 9c3030603d
38 changed files with 168 additions and 144 deletions

View File

@@ -713,7 +713,7 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
if(nullptr == mainWindow)
{
#if defined(VCMI_ANDROID) || defined(VCMI_IOS)
auto createWindow = [displayIndex](Uint32 extraFlags) -> bool {
auto createWindow = [displayIndex](uint32_t extraFlags) -> bool {
mainWindow = SDL_CreateWindow(NAME.c_str(), SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex), SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex), 0, 0, SDL_WINDOW_FULLSCREEN | extraFlags);
return mainWindow != nullptr;
};
@@ -723,7 +723,7 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
SDL_SetHint(SDL_HINT_RETURN_KEY_HIDES_IME, "1");
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best");
Uint32 windowFlags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI;
uint32_t windowFlags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI;
if(!createWindow(windowFlags | SDL_WINDOW_METAL))
{
logGlobal->warn("Metal unavailable, using OpenGLES");

View File

@@ -110,7 +110,6 @@ set(client_HEADERS
gui/CIntObject.h
gui/Fonts.h
gui/TextAlignment.h
gui/SDL_Compat.h
gui/SDL_Extensions.h
gui/SDL_Pixels.h
gui/NotificationHandler.h

View File

@@ -22,6 +22,8 @@
#include "widgets/Buttons.h"
#include "widgets/TextControls.h"
#include <SDL_surface.h>
const int BETWEEN_COMPS_ROWS = 10;
const int BEFORE_COMPONENTS = 30;
const int BETWEEN_COMPS = 30;

View File

@@ -68,6 +68,7 @@
#include "../lib/CGameState.h"
#include "gui/NotificationHandler.h"
#include <SDL_events.h>
// The macro below is used to mark functions that are called by client when game state changes.
// They all assume that CPlayerInterface::pim mutex is locked.

View File

@@ -60,6 +60,8 @@
#include <windows.h>
#endif
#include <SDL_events.h>
template<typename T> class CApplyOnLobby;
const std::string CServerHandler::localhostAddress{"127.0.0.1"};

View File

@@ -16,6 +16,7 @@
#include "../lib/filesystem/Filesystem.h"
#include <SDL_render.h>
#include <SDL_events.h>
extern CGuiHandler GH; //global gui handler

View File

@@ -33,6 +33,8 @@
#include "../lib/ScriptHandler.h"
#endif
#include <SDL_surface.h>
void ClientCommandManager::handleGoSolo()
{
Settings session = settings.write["session"];

View File

@@ -2,8 +2,6 @@
#include "../Global.h"
#include "gui/SDL_Compat.h"
// This header should be treated as a pre compiled header file(PCH) in the compiler building settings.
// Here you can add specific libraries and macros which are specific to this project.

View File

@@ -48,6 +48,9 @@
#include "../../lib/CondSh.h"
#include "../../lib/mapObjects/CGTownInstance.h"
#include <SDL_surface.h>
#include <SDL_events.h>
void BattleConsole::showAll(SDL_Surface * to)
{
CIntObject::showAll(to);

View File

@@ -36,6 +36,9 @@
#include "../../lib/CConfigHandler.h"
#include "../../lib/filesystem/ResourceID.h"
#include <SDL_surface.h>
#include <SDL_events.h>
BattleWindow::BattleWindow(BattleInterface & owner):
owner(owner)
{

View File

@@ -13,7 +13,7 @@
#include "../widgets/Images.h"
#include "../gui/CAnimation.h"
#include <SDL_render.h>
#include <SDL_pixels.h>
class CIntObject;
class CreatureAnimation;

View File

@@ -23,6 +23,8 @@
#include "../../lib/CRandomGenerator.h"
#include "../../lib/vcmi_endian.h"
#include <SDL_surface.h>
class SDLImageLoader;
typedef std::map <size_t, std::vector <JsonNode> > source_map;

View File

@@ -24,6 +24,7 @@
#include <SDL_render.h>
#include <SDL_timer.h>
#include <SDL_events.h>
extern std::queue<SDL_Event> SDLEventsQueue;
extern boost::mutex eventsM;
@@ -643,7 +644,7 @@ const Point & CGuiHandler::getCursorPosition() const
void CGuiHandler::drawFPSCounter()
{
static SDL_Rect overlay = { 0, 0, 64, 32};
Uint32 black = SDL_MapRGB(screen->format, 10, 10, 10);
uint32_t black = SDL_MapRGB(screen->format, 10, 10, 10);
SDL_FillRect(screen, &overlay, black);
std::string fps = boost::lexical_cast<std::string>(mainFPSmng->fps);
graphics->fonts[FONT_BIG]->renderTextLeft(screen, fps, Colors::YELLOW, Point(10, 10));
@@ -751,7 +752,7 @@ void CFramerateManager::framerateDelay()
// FPS is higher than it should be, then wait some time
if(timeElapsed < rateticks)
{
int timeToSleep = (Uint32)ceil(this->rateticks) - timeElapsed;
int timeToSleep = (uint32_t)ceil(this->rateticks) - timeElapsed;
boost::this_thread::sleep(boost::posix_time::milliseconds(timeToSleep));
}

View File

@@ -10,8 +10,7 @@
#pragma once
#include "../../lib/Point.h"
#include <SDL_events.h>
#include "SDL_keycode.h"
VCMI_LIB_NAMESPACE_BEGIN
@@ -20,6 +19,7 @@ template <typename T> struct CondSh;
VCMI_LIB_NAMESPACE_END
union SDL_Event;
struct SDL_MouseMotionEvent;
class CFramerateManager;
class IStatusBar;

View File

@@ -15,6 +15,8 @@
#include "../CMessage.h"
#include <SDL_pixels.h>
#include <SDL_surface.h>
#include <SDL_events.h>
IShowActivatable::IShowActivatable()
{

View File

@@ -17,6 +17,7 @@
#include "../../lib/CConfigHandler.h"
#include <SDL_render.h>
#include <SDL_events.h>
#ifdef VCMI_APPLE
#include <dispatch/dispatch.h>

View File

@@ -136,7 +136,7 @@ void CBitmapFont::renderCharacter(SDL_Surface * surface, const BitmapChar & char
CSDL_Ext::TColorPutter colorPutter = CSDL_Ext::getPutterFor(surface, 0);
Uint8 bpp = surface->format->BytesPerPixel;
uint8_t bpp = surface->format->BytesPerPixel;
// start of line, may differ from 0 due to end of surface or clipped surface
int lineBegin = std::max<int>(0, clipRect.y - posY);
@@ -149,8 +149,8 @@ void CBitmapFont::renderCharacter(SDL_Surface * surface, const BitmapChar & char
//for each line in symbol
for(int dy = lineBegin; dy <lineEnd; dy++)
{
Uint8 *dstLine = (Uint8*)surface->pixels;
Uint8 *srcLine = character.pixels;
uint8_t *dstLine = (uint8_t*)surface->pixels;
uint8_t *srcLine = character.pixels;
// shift source\destination pixels to current position
dstLine += (posY+dy) * surface->pitch + posX * bpp;
@@ -159,7 +159,7 @@ void CBitmapFont::renderCharacter(SDL_Surface * surface, const BitmapChar & char
//for each column in line
for(int dx = rowBegin; dx < rowEnd; dx++)
{
Uint8* dstPixel = dstLine + dx*bpp;
uint8_t* dstPixel = dstLine + dx*bpp;
switch(srcLine[dx])
{
case 1: //black "shadow"
@@ -307,7 +307,7 @@ void CBitmapHanFont::renderCharacter(SDL_Surface * surface, int characterIndex,
CSDL_Ext::getClipRect(surface, clipRect);
CSDL_Ext::TColorPutter colorPutter = CSDL_Ext::getPutterFor(surface, 0);
Uint8 bpp = surface->format->BytesPerPixel;
uint8_t bpp = surface->format->BytesPerPixel;
// start of line, may differ from 0 due to end of surface or clipped surface
int lineBegin = std::max<int>(0, clipRect.y - posY);
@@ -320,8 +320,8 @@ void CBitmapHanFont::renderCharacter(SDL_Surface * surface, int characterIndex,
//for each line in symbol
for(int dy = lineBegin; dy <lineEnd; dy++)
{
Uint8 *dstLine = (Uint8*)surface->pixels;
Uint8 *source = data.first.get() + getCharacterDataOffset(characterIndex);
uint8_t *dstLine = (uint8_t*)surface->pixels;
uint8_t *source = data.first.get() + getCharacterDataOffset(characterIndex);
// shift source\destination pixels to current position
dstLine += (posY+dy) * surface->pitch + posX * bpp;
@@ -333,7 +333,7 @@ void CBitmapHanFont::renderCharacter(SDL_Surface * surface, int characterIndex,
// select current bit in bitmap
int bit = (source[dx / 8] << (dx % 8)) & 0x80;
Uint8* dstPixel = dstLine + dx*bpp;
uint8_t* dstPixel = dstLine + dx*bpp;
if (bit != 0)
colorPutter(dstPixel, color.r, color.g, color.b);
}

View File

@@ -1,25 +0,0 @@
/*
* SDL_Compat.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include <SDL_version.h>
#if (SDL_MAJOR_VERSION == 2)
#include <SDL_keycode.h>
typedef int SDLX_Coord;
typedef int SDLX_Size;
#else
#error "unknown or unsupported SDL version"
#endif

View File

@@ -146,12 +146,12 @@ SDL_Surface * CSDL_Ext::copySurface(SDL_Surface * mod) //returns copy of given s
template<int bpp>
SDL_Surface * CSDL_Ext::createSurfaceWithBpp(int width, int height)
{
Uint32 rMask = 0, gMask = 0, bMask = 0, aMask = 0;
uint32_t rMask = 0, gMask = 0, bMask = 0, aMask = 0;
Channels::px<bpp>::r.set((Uint8*)&rMask, 255);
Channels::px<bpp>::g.set((Uint8*)&gMask, 255);
Channels::px<bpp>::b.set((Uint8*)&bMask, 255);
Channels::px<bpp>::a.set((Uint8*)&aMask, 255);
Channels::px<bpp>::r.set((uint8_t*)&rMask, 255);
Channels::px<bpp>::g.set((uint8_t*)&gMask, 255);
Channels::px<bpp>::b.set((uint8_t*)&bMask, 255);
Channels::px<bpp>::a.set((uint8_t*)&aMask, 255);
return SDL_CreateRGBSurface(0, width, height, bpp * 8, rMask, gMask, bMask, aMask);
}
@@ -230,28 +230,28 @@ SDL_Surface * CSDL_Ext::horizontalFlip(SDL_Surface * toRot)
return ret;
}
Uint32 CSDL_Ext::getPixel(SDL_Surface *surface, const int & x, const int & y, bool colorByte)
uint32_t CSDL_Ext::getPixel(SDL_Surface *surface, const int & x, const int & y, bool colorByte)
{
int bpp = surface->format->BytesPerPixel;
/* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
uint8_t *p = (uint8_t *)surface->pixels + y * surface->pitch + x * bpp;
switch(bpp)
{
case 1:
if(colorByte)
return colorToUint32(surface->format->palette->colors+(*p));
return colorTouint32_t(surface->format->palette->colors+(*p));
else
return *p;
case 2:
return *(Uint16 *)p;
return *(uint16_t *)p;
case 3:
return p[0] | p[1] << 8 | p[2] << 16;
case 4:
return *(Uint32 *)p;
return *(uint32_t *)p;
default:
return 0; // shouldn't happen, but avoids warnings
@@ -366,13 +366,13 @@ int CSDL_Ext::blit8bppAlphaTo24bppT(const SDL_Surface * src, const Rect & srcRec
return -1; //if we cannot lock the surface
const SDL_Color *colors = src->format->palette->colors;
Uint8 *colory = (Uint8*)src->pixels + srcy*src->pitch + srcx;
Uint8 *py = (Uint8*)dst->pixels + dstRect->y*dst->pitch + dstRect->x*bpp;
uint8_t *colory = (uint8_t*)src->pixels + srcy*src->pitch + srcx;
uint8_t *py = (uint8_t*)dst->pixels + dstRect->y*dst->pitch + dstRect->x*bpp;
for(int y=h; y; y--, colory+=src->pitch, py+=dst->pitch)
{
Uint8 *color = colory;
Uint8 *p = py;
uint8_t *color = colory;
uint8_t *p = py;
for(int x = w; x; x--)
{
@@ -399,9 +399,9 @@ int CSDL_Ext::blit8bppAlphaTo24bpp(const SDL_Surface * src, const Rect & srcRect
}
}
Uint32 CSDL_Ext::colorToUint32(const SDL_Color * color)
uint32_t CSDL_Ext::colorTouint32_t(const SDL_Color * color)
{
Uint32 ret = 0;
uint32_t ret = 0;
ret+=color->a;
ret<<=8; //*=256
ret+=color->b;
@@ -432,7 +432,7 @@ static void drawLineX(SDL_Surface * sur, int x1, int y1, int x2, int y2, const S
uint8_t b = vstd::lerp(color1.b, color2.b, f);
uint8_t a = vstd::lerp(color1.a, color2.a, f);
Uint8 *p = CSDL_Ext::getPxPtr(sur, x, y);
uint8_t *p = CSDL_Ext::getPxPtr(sur, x, y);
ColorPutter<4, 0>::PutColor(p, r,g,b,a);
}
}
@@ -449,7 +449,7 @@ static void drawLineY(SDL_Surface * sur, int x1, int y1, int x2, int y2, const S
uint8_t b = vstd::lerp(color1.b, color2.b, f);
uint8_t a = vstd::lerp(color1.a, color2.a, f);
Uint8 *p = CSDL_Ext::getPxPtr(sur, x, y);
uint8_t *p = CSDL_Ext::getPxPtr(sur, x, y);
ColorPutter<4, 0>::PutColor(p, r,g,b,a);
}
}
@@ -461,7 +461,7 @@ void CSDL_Ext::drawLine(SDL_Surface * sur, int x1, int y1, int x2, int y2, const
if ( width == 0 && height == 0)
{
Uint8 *p = CSDL_Ext::getPxPtr(sur, x1, y1);
uint8_t *p = CSDL_Ext::getPxPtr(sur, x1, y1);
ColorPutter<4, 0>::PutColorAlpha(p, color1);
return;
}
@@ -579,9 +579,9 @@ CSDL_Ext::TColorPutterAlpha CSDL_Ext::getPutterAlphaFor(SDL_Surface * const &des
#undef CASE_BPP
}
Uint8 * CSDL_Ext::getPxPtr(const SDL_Surface * const &srf, const int x, const int y)
uint8_t * CSDL_Ext::getPxPtr(const SDL_Surface * const &srf, const int x, const int y)
{
return (Uint8 *)srf->pixels + y * srf->pitch + x * srf->format->BytesPerPixel;
return (uint8_t *)srf->pixels + y * srf->pitch + x * srf->format->BytesPerPixel;
}
std::string CSDL_Ext::processStr(std::string str, std::vector<std::string> & tor)
@@ -629,9 +629,9 @@ void CSDL_Ext::VflipSurf(SDL_Surface * surf)
}
}
void CSDL_Ext::putPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A)
void CSDL_Ext::putPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A)
{
Uint8 *p = getPxPtr(ekran, x, y);
uint8_t *p = getPxPtr(ekran, x, y);
getPutterFor(ekran, false)(p, R, G, B);
switch(ekran->format->BytesPerPixel)
@@ -642,7 +642,7 @@ void CSDL_Ext::putPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const i
}
}
void CSDL_Ext::putPixelWithoutRefreshIfInSurf(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A)
void CSDL_Ext::putPixelWithoutRefreshIfInSurf(SDL_Surface *ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A)
{
const SDL_Rect & rect = ekran->clip_rect;
@@ -665,7 +665,7 @@ void CSDL_Ext::applyEffectBpp(SDL_Surface * surf, const Rect & rect, int mode )
{
for(int yp = rect.y; yp < rect.y + rect.h; ++yp)
{
Uint8 * pixel = (ui8*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
uint8_t * pixel = (ui8*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
int r = Channels::px<bpp>::r.get(pixel);
int g = Channels::px<bpp>::g.get(pixel);
int b = Channels::px<bpp>::b.get(pixel);
@@ -698,7 +698,7 @@ void CSDL_Ext::applyEffectBpp(SDL_Surface * surf, const Rect & rect, int mode )
{
for(int yp = rect.y; yp < rect.y + rect.h; ++yp)
{
Uint8 * pixel = (ui8*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
uint8_t * pixel = (ui8*)surf->pixels + yp * surf->pitch + xp * surf->format->BytesPerPixel;
int r = Channels::px<bpp>::r.get(pixel);
int g = Channels::px<bpp>::g.get(pixel);
@@ -744,8 +744,8 @@ void scaleSurfaceFastInternal(SDL_Surface *surf, SDL_Surface *ret)
origY = static_cast<int>(floor(factorY * y));
// Get pointers to source pixels
Uint8 *srcPtr = (Uint8*)surf->pixels + origY * surf->pitch + origX * bpp;
Uint8 *destPtr = (Uint8*)ret->pixels + y * ret->pitch + x * bpp;
uint8_t *srcPtr = (uint8_t*)surf->pixels + origY * surf->pitch + origX * bpp;
uint8_t *destPtr = (uint8_t*)ret->pixels + y * ret->pitch + x * bpp;
memcpy(destPtr, srcPtr, bpp);
}
@@ -799,10 +799,10 @@ void scaleSurfaceInternal(SDL_Surface *surf, SDL_Surface *ret)
//assert( w11 + w12 + w21 + w22 > 0.99 && w11 + w12 + w21 + w22 < 1.01);//total weight is ~1.0
// Get pointers to source pixels
Uint8 *p11 = (Uint8*)surf->pixels + int(y1) * surf->pitch + int(x1) * bpp;
Uint8 *p12 = p11 + bpp;
Uint8 *p21 = p11 + surf->pitch;
Uint8 *p22 = p21 + bpp;
uint8_t *p11 = (uint8_t*)surf->pixels + int(y1) * surf->pitch + int(x1) * bpp;
uint8_t *p12 = p11 + bpp;
uint8_t *p21 = p11 + surf->pitch;
uint8_t *p22 = p21 + bpp;
// Calculate resulting channels
#define PX(X, PTR) Channels::px<bpp>::X.get(PTR)
int resR = static_cast<int>(PX(r, p11) * w11 + PX(r, p12) * w12 + PX(r, p21) * w21 + PX(r, p22) * w22);
@@ -811,7 +811,7 @@ void scaleSurfaceInternal(SDL_Surface *surf, SDL_Surface *ret)
int resA = static_cast<int>(PX(a, p11) * w11 + PX(a, p12) * w12 + PX(a, p21) * w21 + PX(a, p22) * w22);
//assert(resR < 256 && resG < 256 && resB < 256 && resA < 256);
#undef PX
Uint8 *dest = (Uint8*)ret->pixels + y * ret->pitch + x * bpp;
uint8_t *dest = (uint8_t*)ret->pixels + y * ret->pitch + x * bpp;
Channels::px<bpp>::r.set(dest, resR);
Channels::px<bpp>::g.set(dest, resG);
Channels::px<bpp>::b.set(dest, resB);

View File

@@ -9,11 +9,11 @@
*/
#pragma once
#include <SDL_events.h>
#include "../../lib/GameConstants.h"
#include "../../lib/Rect.h"
#include "../../lib/Color.h"
struct SDL_Rect;
struct SDL_Window;
struct SDL_Renderer;
struct SDL_Texture;
@@ -114,8 +114,8 @@ std::string makeNumberShort(IntType number, IntType maxLength = 3) //the output
Rect genRect(const int & hh, const int & ww, const int & xx, const int & yy);
typedef void (*TColorPutter)(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B);
typedef void (*TColorPutterAlpha)(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A);
typedef void (*TColorPutter)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B);
typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst=screen);
void blitAt(SDL_Surface * src, const Rect & pos, SDL_Surface * dst=screen);
@@ -131,23 +131,23 @@ typedef void (*TColorPutterAlpha)(Uint8 *&ptr, const Uint8 & R, const Uint8 & G,
void updateRect(SDL_Surface *surface, const Rect & rect);
void putPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255);
void putPixelWithoutRefreshIfInSurf(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255);
void putPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A = 255);
void putPixelWithoutRefreshIfInSurf(SDL_Surface *ekran, const int & x, const int & y, const uint8_t & R, const uint8_t & G, const uint8_t & B, uint8_t A = 255);
SDL_Surface * verticalFlip(SDL_Surface * toRot); //vertical flip
SDL_Surface * horizontalFlip(SDL_Surface * toRot); //horizontal flip
Uint32 getPixel(SDL_Surface *surface, const int & x, const int & y, bool colorByte = false);
uint32_t getPixel(SDL_Surface *surface, const int & x, const int & y, bool colorByte = false);
bool isTransparent(SDL_Surface * srf, int x, int y); //checks if surface is transparent at given position
bool isTransparent(SDL_Surface * srf, const Point & position); //checks if surface is transparent at given position
Uint8 *getPxPtr(const SDL_Surface * const &srf, const int x, const int y);
uint8_t *getPxPtr(const SDL_Surface * const &srf, const int x, const int y);
TColorPutter getPutterFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1
TColorPutterAlpha getPutterAlphaFor(SDL_Surface * const &dest, int incrementing); //incrementing: -1, 0, 1
template<int bpp>
int blit8bppAlphaTo24bppT(const SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dstPoint); //blits 8 bpp surface with alpha channel to 24 bpp surface
int blit8bppAlphaTo24bpp(const SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dstPoint); //blits 8 bpp surface with alpha channel to 24 bpp surface
Uint32 colorToUint32(const SDL_Color * color); //little endian only
uint32_t colorTouint32_t(const SDL_Color * color); //little endian only
SDL_Color makeColor(ui8 r, ui8 g, ui8 b, ui8 a);
void update(SDL_Surface * what = screen); //updates whole surface (default - main screen)

View File

@@ -12,6 +12,7 @@
#include "SDL_Extensions.h"
#include <SDL_endian.h>
#include <SDL_pixels.h>
// for accessing channels from pixel in format-independent way
//should be as fast as accessing via pointer at least for 3-4 bytes per pixel
@@ -20,20 +21,20 @@ namespace Channels
// channel not present in this format
struct channel_empty
{
static STRONG_INLINE void set(Uint8*, Uint8) {}
static STRONG_INLINE Uint8 get(const Uint8 *) { return 255;}
static STRONG_INLINE void set(uint8_t*, uint8_t) {}
static STRONG_INLINE uint8_t get(const uint8_t *) { return 255;}
};
// channel which uses whole pixel
template<int offset>
struct channel_pixel
{
static STRONG_INLINE void set(Uint8 *ptr, Uint8 value)
static STRONG_INLINE void set(uint8_t *ptr, uint8_t value)
{
ptr[offset] = value;
}
static STRONG_INLINE Uint8 get(const Uint8 *ptr)
static STRONG_INLINE uint8_t get(const uint8_t *ptr)
{
return ptr[offset];
}
@@ -44,16 +45,16 @@ namespace Channels
struct channel_subpx
{
static void STRONG_INLINE set(Uint8 *ptr, Uint8 value)
static void STRONG_INLINE set(uint8_t *ptr, uint8_t value)
{
Uint16 * const pixel = (Uint16*)ptr;
Uint8 subpx = value >> (8 - bits);
uint16_t * const pixel = (uint16_t*)ptr;
uint8_t subpx = value >> (8 - bits);
*pixel = (*pixel & ~mask) | ((subpx << shift) & mask );
}
static Uint8 STRONG_INLINE get(const Uint8 *ptr)
static uint8_t STRONG_INLINE get(const uint8_t *ptr)
{
Uint8 subpx = (*((Uint16 *)ptr) & mask) >> shift;
uint8_t subpx = (*((uint16_t *)ptr) & mask) >> shift;
return (subpx << (8 - bits)) | (subpx >> (2*bits - 8));
}
};
@@ -122,39 +123,39 @@ namespace Channels
template<int bpp, int incrementPtr>
struct ColorPutter
{
static STRONG_INLINE void PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B);
static STRONG_INLINE void PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A);
static STRONG_INLINE void PutColorAlphaSwitch(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A);
static STRONG_INLINE void PutColor(Uint8 *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorAlpha(Uint8 *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorRow(Uint8 *&ptr, const SDL_Color & Color, size_t count);
static STRONG_INLINE void PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B);
static STRONG_INLINE void PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
static STRONG_INLINE void PutColorAlphaSwitch(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
static STRONG_INLINE void PutColor(uint8_t *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorAlpha(uint8_t *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorRow(uint8_t *&ptr, const SDL_Color & Color, size_t count);
};
template <int incrementPtr>
struct ColorPutter<2, incrementPtr>
{
static STRONG_INLINE void PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B);
static STRONG_INLINE void PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A);
static STRONG_INLINE void PutColorAlphaSwitch(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A);
static STRONG_INLINE void PutColor(Uint8 *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorAlpha(Uint8 *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorRow(Uint8 *&ptr, const SDL_Color & Color, size_t count);
static STRONG_INLINE void PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B);
static STRONG_INLINE void PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
static STRONG_INLINE void PutColorAlphaSwitch(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
static STRONG_INLINE void PutColor(uint8_t *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorAlpha(uint8_t *&ptr, const SDL_Color & Color);
static STRONG_INLINE void PutColorRow(uint8_t *&ptr, const SDL_Color & Color, size_t count);
};
template<int bpp, int incrementPtr>
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorAlpha(Uint8 *&ptr, const SDL_Color & Color)
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorAlpha(uint8_t *&ptr, const SDL_Color & Color)
{
PutColor(ptr, Color.r, Color.g, Color.b, Color.a);
}
template<int bpp, int incrementPtr>
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(Uint8 *&ptr, const SDL_Color & Color)
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(uint8_t *&ptr, const SDL_Color & Color)
{
PutColor(ptr, Color.r, Color.g, Color.b);
}
template<int bpp, int incrementPtr>
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorAlphaSwitch(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A)
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorAlphaSwitch(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A)
{
switch (A)
{
@@ -166,9 +167,9 @@ STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorAlphaSwitch(Uint8 *&p
return;
case 128: // optimized
PutColor(ptr,
((Uint16)R + Channels::px<bpp>::r.get(ptr)) >> 1,
((Uint16)G + Channels::px<bpp>::g.get(ptr)) >> 1,
((Uint16)B + Channels::px<bpp>::b.get(ptr)) >> 1);
((uint16_t)R + Channels::px<bpp>::r.get(ptr)) >> 1,
((uint16_t)G + Channels::px<bpp>::g.get(ptr)) >> 1,
((uint16_t)B + Channels::px<bpp>::b.get(ptr)) >> 1);
return;
default:
PutColor(ptr, R, G, B, A);
@@ -177,16 +178,16 @@ STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorAlphaSwitch(Uint8 *&p
}
template<int bpp, int incrementPtr>
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A)
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A)
{
PutColor(ptr, ((((Uint32)R - (Uint32)Channels::px<bpp>::r.get(ptr))*(Uint32)A) >> 8 ) + (Uint32)Channels::px<bpp>::r.get(ptr),
((((Uint32)G - (Uint32)Channels::px<bpp>::g.get(ptr))*(Uint32)A) >> 8 ) + (Uint32)Channels::px<bpp>::g.get(ptr),
((((Uint32)B - (Uint32)Channels::px<bpp>::b.get(ptr))*(Uint32)A) >> 8 ) + (Uint32)Channels::px<bpp>::b.get(ptr));
PutColor(ptr, ((((uint32_t)R - (uint32_t)Channels::px<bpp>::r.get(ptr))*(uint32_t)A) >> 8 ) + (uint32_t)Channels::px<bpp>::r.get(ptr),
((((uint32_t)G - (uint32_t)Channels::px<bpp>::g.get(ptr))*(uint32_t)A) >> 8 ) + (uint32_t)Channels::px<bpp>::g.get(ptr),
((((uint32_t)B - (uint32_t)Channels::px<bpp>::b.get(ptr))*(uint32_t)A) >> 8 ) + (uint32_t)Channels::px<bpp>::b.get(ptr));
}
template<int bpp, int incrementPtr>
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B)
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B)
{
static_assert(incrementPtr >= -1 && incrementPtr <= +1, "Invalid incrementPtr value!");
@@ -204,11 +205,11 @@ STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColor(Uint8 *&ptr, const U
}
template<int bpp, int incrementPtr>
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorRow(Uint8 *&ptr, const SDL_Color & Color, size_t count)
STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorRow(uint8_t *&ptr, const SDL_Color & Color, size_t count)
{
if (count)
{
Uint8 *pixel = ptr;
uint8_t *pixel = ptr;
PutColor(ptr, Color.r, Color.g, Color.b);
for (size_t i=0; i<count-1; i++)
@@ -220,12 +221,12 @@ STRONG_INLINE void ColorPutter<bpp, incrementPtr>::PutColorRow(Uint8 *&ptr, cons
}
template <int incrementPtr>
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B)
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B)
{
if(incrementPtr == -1)
ptr -= 2;
Uint16 * const px = (Uint16*)ptr;
uint16_t * const px = (uint16_t*)ptr;
*px = (B>>3) + ((G>>2) << 5) + ((R>>3) << 11); //drop least significant bits of 24 bpp encoded color
if(incrementPtr == 1)
@@ -233,7 +234,7 @@ STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(Uint8 *&ptr, const Uin
}
template <int incrementPtr>
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColorAlphaSwitch(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A)
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColorAlphaSwitch(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A)
{
switch (A)
{
@@ -250,17 +251,17 @@ STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColorAlphaSwitch(Uint8 *&ptr
}
template <int incrementPtr>
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(Uint8 *&ptr, const Uint8 & R, const Uint8 & G, const Uint8 & B, const Uint8 & A)
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A)
{
const int rbit = 5, gbit = 6, bbit = 5; //bits per color
const int rmask = 0xF800, gmask = 0x7E0, bmask = 0x1F;
const int rshift = 11, gshift = 5, bshift = 0;
const Uint8 r5 = (*((Uint16 *)ptr) & rmask) >> rshift,
b5 = (*((Uint16 *)ptr) & bmask) >> bshift,
g5 = (*((Uint16 *)ptr) & gmask) >> gshift;
const uint8_t r5 = (*((uint16_t *)ptr) & rmask) >> rshift,
b5 = (*((uint16_t *)ptr) & bmask) >> bshift,
g5 = (*((uint16_t *)ptr) & gmask) >> gshift;
const Uint32 r8 = (r5 << (8 - rbit)) | (r5 >> (2*rbit - 8)),
const uint32_t r8 = (r5 << (8 - rbit)) | (r5 >> (2*rbit - 8)),
g8 = (g5 << (8 - gbit)) | (g5 >> (2*gbit - 8)),
b8 = (b5 << (8 - bbit)) | (b5 >> (2*bbit - 8));
@@ -271,22 +272,22 @@ STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(Uint8 *&ptr, const Uin
}
template <int incrementPtr>
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColorAlpha(Uint8 *&ptr, const SDL_Color & Color)
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColorAlpha(uint8_t *&ptr, const SDL_Color & Color)
{
PutColor(ptr, Color.r, Color.g, Color.b, Color.a);
}
template <int incrementPtr>
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(Uint8 *&ptr, const SDL_Color & Color)
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColor(uint8_t *&ptr, const SDL_Color & Color)
{
PutColor(ptr, Color.r, Color.g, Color.b);
}
template <int incrementPtr>
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColorRow(Uint8 *&ptr, const SDL_Color & Color, size_t count)
STRONG_INLINE void ColorPutter<2, incrementPtr>::PutColorRow(uint8_t *&ptr, const SDL_Color & Color, size_t count)
{
//drop least significant bits of 24 bpp encoded color
Uint16 pixel = (Color.b>>3) + ((Color.g>>2) << 5) + ((Color.r>>3) << 11);
uint16_t pixel = (Color.b>>3) + ((Color.g>>2) << 5) + ((Color.r>>3) << 11);
for (size_t i=0; i<count; i++)
{

View File

@@ -44,6 +44,8 @@
#include "../../lib/mapping/CMapInfo.h"
#include "../../lib/serializer/Connection.h"
#include <SDL_events.h>
ISelectionScreenInfo::ISelectionScreenInfo(ESelectionScreen ScreenType)
: screenType(ScreenType)
{

View File

@@ -36,6 +36,7 @@
#include "../../lib/mapping/CMapInfo.h"
#include "../../lib/serializer/Connection.h"
#include <SDL_events.h>
bool mapSorter::operator()(const std::shared_ptr<CMapInfo> aaa, const std::shared_ptr<CMapInfo> bbb)
{

View File

@@ -56,6 +56,7 @@
#include "../../lib/CondSh.h"
#include "../../lib/mapping/CCampaignHandler.h"
#include <SDL_events.h>
namespace fs = boost::filesystem;

View File

@@ -43,6 +43,10 @@
#include "../../lib/mapping/CMap.h"
#include "ClientCommandManager.h"
#include <SDL_surface.h>
#include <SDL_keyboard.h>
#include <SDL_events.h>
CList::CListItem::CListItem(CList * Parent)
: CIntObject(LCLICK | RCLICK | HOVER),
parent(Parent),
@@ -187,7 +191,7 @@ CHeroList::CEmptyHeroItem::CEmptyHeroItem()
mana = std::make_shared<CAnimImage>("IMANA", 0, 0, movement->pos.w + portrait->pos.w + 2, 1 );
pos.w = mana->pos.w + mana->pos.x - pos.x;
pos.h = std::max(std::max<SDLX_Size>(movement->pos.h + 1, mana->pos.h + 1), portrait->pos.h);
pos.h = std::max(std::max<int>(movement->pos.h + 1, mana->pos.h + 1), portrait->pos.h);
}
CHeroList::CHeroItem::CHeroItem(CHeroList *parent, const CGHeroInstance * Hero)
@@ -200,7 +204,7 @@ CHeroList::CHeroItem::CHeroItem(CHeroList *parent, const CGHeroInstance * Hero)
mana = std::make_shared<CAnimImage>("IMANA", 0, 0, movement->pos.w + portrait->pos.w + 2, 1);
pos.w = mana->pos.w + mana->pos.x - pos.x;
pos.h = std::max(std::max<SDLX_Size>(movement->pos.h + 1, mana->pos.h + 1), portrait->pos.h);
pos.h = std::max(std::max<int>(movement->pos.h + 1, mana->pos.h + 1), portrait->pos.h);
update();
}
@@ -409,7 +413,7 @@ void CMinimapInstance::blitTileWithColor(const SDL_Color &color, const int3 &til
for (int y=yBegin; y<yEnd; y++)
{
Uint8 *ptr = (Uint8*)to->pixels + y * to->pitch + xBegin * minimap->format->BytesPerPixel;
uint8_t *ptr = (uint8_t*)to->pixels + y * to->pitch + xBegin * minimap->format->BytesPerPixel;
for (int x=xBegin; x<xEnd; x++)
ColorPutter<4, 1>::PutColor(ptr, color);
@@ -446,7 +450,7 @@ void CMinimapInstance::drawScaled(int level)
for (int y=yBegin; y<yEnd; y++)
{
Uint8 *ptr = (Uint8*)minimap->pixels + y * minimap->pitch + xBegin * minimap->format->BytesPerPixel;
uint8_t *ptr = (uint8_t*)minimap->pixels + y * minimap->pitch + xBegin * minimap->format->BytesPerPixel;
for (int x=xBegin; x<xEnd; x++)
ColorPutter<4, 1>::PutColor(ptr, color);
@@ -948,7 +952,7 @@ void CInGameConsole::show(SDL_Surface * to)
{
int number = 0;
std::vector<std::list< std::pair< std::string, Uint32 > >::iterator> toDel;
std::vector<std::list< std::pair< std::string, uint32_t > >::iterator> toDel;
boost::unique_lock<boost::mutex> lock(texts_mx);
for(auto it = texts.begin(); it != texts.end(); ++it, ++number)

View File

@@ -405,7 +405,7 @@ public:
class CInGameConsole : public CIntObject
{
private:
std::list< std::pair< std::string, Uint32 > > texts; //list<text to show, time of add>
std::list< std::pair< std::string, uint32_t > > texts; //list<text to show, time of add>
boost::mutex texts_mx; // protects texts
std::vector< std::string > previouslyEntered; //previously entered texts, for up/down arrows to work
int prevEntDisp; //displayed entry from previouslyEntered - if none it's -1

View File

@@ -24,6 +24,8 @@
#include "../../lib/CConfigHandler.h"
#include "../../lib/CGeneralTextHandler.h"
#include <SDL_events.h>
void CButton::update()
{
if (overlay)

View File

@@ -13,6 +13,8 @@
#include "../gui/SDL_Extensions.h"
#include "../../lib/FunctionList.h"
#include <SDL_pixels.h>
VCMI_LIB_NAMESPACE_BEGIN
namespace config

View File

@@ -32,6 +32,8 @@
#define SDL_SCANCODE_LCTRL SDL_SCANCODE_LGUI
#endif
#include <SDL_keyboard.h>
void CGarrisonSlot::setHighlight(bool on)
{
if (on)
@@ -437,7 +439,7 @@ void CGarrisonSlot::splitIntoParts(CGarrisonSlot::EGarrisonType type, int amount
bool CGarrisonSlot::handleSplittingShortcuts()
{
const Uint8 * state = SDL_GetKeyboardState(NULL);
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];

View File

@@ -24,6 +24,8 @@
#include "lib/CAndroidVMHelper.h"
#endif
#include <SDL_events.h>
std::string CLabel::visibleText()
{
return text;

View File

@@ -14,6 +14,8 @@
#include "../gui/SDL_Extensions.h"
#include "../../lib/FunctionList.h"
#include <SDL_pixels.h>
class IImage;
class CSlider;

View File

@@ -55,6 +55,9 @@
#include "../../lib/mapping/CMapInfo.h"
#include "../../lib/TerrainHandler.h"
#include <SDL_surface.h>
#include <SDL_events.h>
#define ADVOPT (conf.go()->ac)
using namespace CSDL_Ext;

View File

@@ -44,6 +44,8 @@
#include "../../lib/mapObjects/CGHeroInstance.h"
#include "../../lib/mapObjects/CGTownInstance.h"
#include <SDL_events.h>
CBuildingRect::CBuildingRect(CCastleBuildings * Par, const CGTownInstance * Town, const CStructure * Str)
: CShowableAnim(0, 0, Str->defName, CShowableAnim::BASE),
parent(Par),
@@ -153,10 +155,10 @@ void CBuildingRect::clickRight(tribool down, bool previousState)
SDL_Color multiplyColors(const SDL_Color & b, const SDL_Color & a, double f)
{
SDL_Color ret;
ret.r = static_cast<Uint8>(a.r * f + b.r * (1 - f));
ret.g = static_cast<Uint8>(a.g * f + b.g * (1 - f));
ret.b = static_cast<Uint8>(a.b * f + b.b * (1 - f));
ret.a = static_cast<Uint8>(a.a * f + b.b * (1 - f));
ret.r = static_cast<uint8_t>(a.r * f + b.r * (1 - f));
ret.g = static_cast<uint8_t>(a.g * f + b.g * (1 - f));
ret.b = static_cast<uint8_t>(a.b * f + b.b * (1 - f));
ret.a = static_cast<uint8_t>(a.a * f + b.b * (1 - f));
return ret;
}

View File

@@ -42,6 +42,8 @@
#include "../../lib/mapObjects/CGHeroInstance.h"
#include <SDL_events.h>
CSpellWindow::InteractiveArea::InteractiveArea(const Rect & myRect, std::function<void()> funcL, int helpTextId, CSpellWindow * _owner)
{
addUsedEvents(LCLICK | RCLICK | HOVER);

View File

@@ -84,7 +84,7 @@ class CSpellWindow : public CWindowObject
int sitesPerTabBattle[5];
bool battleSpellsOnly; //if true, only battle spells are displayed; if false, only adventure map spells are displayed
Uint8 selectedTab; // 0 - air magic, 1 - fire magic, 2 - water magic, 3 - earth magic, 4 - all schools
uint8_t selectedTab; // 0 - air magic, 1 - fire magic, 2 - water magic, 3 - earth magic, 4 - all schools
int currentPage; //changes when corners are clicked
std::vector<const CSpell *> mySpells; //all spels in this spellbook

View File

@@ -35,6 +35,8 @@
#include "../../lib/CConfigHandler.h"
#include "../../lib/CGeneralTextHandler.h" //for Unicode related stuff
#include <SDL_surface.h>
CWindowObject::CWindowObject(int options_, std::string imageName, Point centerAt):
WindowBase(getUsedEvents(options_), Point()),
options(options_),
@@ -138,7 +140,7 @@ void CWindowObject::setShadow(bool on)
//helper to set last row
auto blitAlphaRow = [](SDL_Surface *surf, size_t row)
{
Uint8 * ptr = (Uint8*)surf->pixels + surf->pitch * (row);
uint8_t * ptr = (uint8_t*)surf->pixels + surf->pitch * (row);
for (size_t i=0; i< surf->w; i++)
{
@@ -150,7 +152,7 @@ void CWindowObject::setShadow(bool on)
// helper to set last column
auto blitAlphaCol = [](SDL_Surface *surf, size_t col)
{
Uint8 * ptr = (Uint8*)surf->pixels + 4 * (col);
uint8_t * ptr = (uint8_t*)surf->pixels + 4 * (col);
for (size_t i=0; i< surf->h; i++)
{

View File

@@ -61,6 +61,8 @@
#include "../lib/NetPacksBase.h"
#include "../lib/StartInfo.h"
#include <SDL_events.h>
using namespace CSDL_Ext;
std::list<CFocusable*> CFocusable::focusables;

View File

@@ -39,6 +39,8 @@
#include "../../lib/mapObjects/CGTownInstance.h"
#include "../../lib/mapObjects/MiscObjects.h"
#include <SDL_surface.h>
void CSimpleWindow::show(SDL_Surface * to)
{
if(bitmap)