#include "headers.h"
+void SDL_SetAlpha(SDL_Surface *surface, uint8_t value) {
+ SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
+ SDL_SetSurfaceAlphaMod(surface, value);
+}
+
Graphics::Graphics()
{
for (int i = 0 ; i < MAX_TILES ; i++)
void Graphics::setTransparent(SDL_Surface *sprite)
{
- SDL_SetColorKey(sprite, SDL_RLEACCEL, SDL_MapRGB(sprite->format, 0, 0, 0));
+ SDL_SetColorKey(sprite, SDL_TRUE, SDL_MapRGB(sprite->format, 0, 0, 0));
}
bool Graphics::canShowMedalMessage() const
}
if(srcalpha)
- SDL_SetSurfaceAlphaMod(newImage, 255);
+ SDL_SetAlpha(newImage, 255);
else
setTransparent(newImage);
void Graphics::fade(int amount)
{
- SDL_SetSurfaceAlphaMod(fadeBlack, amount);
+ SDL_SetAlpha(fadeBlack, amount);
blit(fadeBlack, 0, 0, screen, false);
}
while (start < 50)
{
- SDL_SetSurfaceAlphaMod(fadeBlack, start);
+ SDL_SetAlpha(fadeBlack, start);
blit(fadeBlack, 0, 0, screen, false);
delay(60);
start++;
{
if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
{
- SDL_SetSurfaceAlphaMod(tile[i], 130);
+ SDL_SetAlpha(tile[i], 130);
}
}
else
SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
- SDL_SetSurfaceAlphaMod(surface, 130);
+ SDL_SetAlpha(surface, 130);
return surface;
}
blit(alpha, 0, 0, image, false);
- SDL_SetColorKey(image, SDL_RLEACCEL, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
+ SDL_SetColorKey(image, SDL_TRUE, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
}
void Graphics::lock(SDL_Surface *surface)
*/
+void SDL_SetAlpha(SDL_Surface *surface, uint8_t value);
+
class Graphics {
private:
float panelAlpha = 0;
- SDL_SetSurfaceAlphaMod(panel, 0);
+ SDL_SetAlpha(panel, 0);
engine.clearInput();
engine.flushInput();
if (panelAlpha < 256)
{
panelAlpha += (1 * engine.getTimeDifference());
- SDL_SetSurfaceAlphaMod(panel, panelAlpha);
+ SDL_SetAlpha(panel, panelAlpha);
if (image != NULL)
{
- SDL_SetSurfaceAlphaMod(image, panelAlpha);
+ SDL_SetAlpha(image, panelAlpha);
graphics.blit(image, 0, 0, graphics.screen, false);
}
graphics.blit(panel, 0, 390, graphics.screen, false);
Math::addBit(&map.boss[0]->flags, ENT_AIMS);
- SDL_SetSurfaceAlphaMod(graphics.getSprite("GaldovInvsLeft", true)->image[0], 100);
- SDL_SetSurfaceAlphaMod(graphics.getSprite("GaldovInvsRight", true)->image[0], 100);
+ SDL_SetAlpha(graphics.getSprite("GaldovInvsLeft", true)->image[0], 100);
+ SDL_SetAlpha(graphics.getSprite("GaldovInvsRight", true)->image[0], 100);
for (int i = 1 ; i < 10 ; i++)
{
SDL_Surface *panel = graphics.createSurface(400, 300);
SDL_Surface *panelBack = graphics.alphaRect(400, 300, 0x00, 0x00, 0x00);
- SDL_SetColorKey(panel, SDL_RLEACCEL, SDL_MapRGB(panel->format, 0, 0, 0));
+ SDL_SetColorKey(panel, SDL_TRUE, SDL_MapRGB(panel->format, 0, 0, 0));
graphics.drawRect(1, 1, 398, 298, graphics.black, graphics.white, panelBack);
SDL_Surface *panel = graphics.createSurface(320, 240);
SDL_Surface *background = graphics.loadImage("gfx/main/mapBackground.png");
- SDL_SetSurfaceAlphaMod(background, 130);
+ SDL_SetAlpha(background, 130);
graphics.blit(background, 0, 0, panel, false);
debug(("Setting Alpha for Tile %d\n", param[0]));
- SDL_SetSurfaceAlphaMod(graphics.tile[param[0]], 130);
+ SDL_SetAlpha(graphics.tile[param[0]], 130);
while (true)
{
graphics.loadBackground("gfx/main/areaClearBackGround.jpg");
SDL_Surface *panel = graphics.alphaRect(550, 420, 0x00, 0x00, 0x00);
- SDL_SetSurfaceAlphaMod(panel, 180);
+ SDL_SetAlpha(panel, 180);
graphics.drawRect(1, 1, panel->w - 2, panel->h - 2 , graphics.black, graphics.white, panel);
graphics.blit(panel, (640 - panel->w) / 2, (480 - panel->h) / 2, graphics.background, false);
snprintf(v, sizeof v, _("Version %s"), STRINGIFY_VALUE(VERSION));
SDL_Surface *version = graphics.quickSprite("Version", graphics.getString(v, true));
- SDL_SetSurfaceAlphaMod(title, 0);
+ SDL_SetAlpha(title, 0);
audio.loadMusic("music/title");
graphics.loadBackground("gfx/main/CircuitBoard.jpg");
- SDL_SetSurfaceAlphaMod(graphics.background, 0);
+ SDL_SetAlpha(graphics.background, 0);
int startNewGame, options, quit, help, easy, normal, hard, extreme, back, practice;
int load, cont, save[5], slot[6];
engine.clearInput();
backAlpha = 255;
titleAlpha = 255;
- SDL_SetSurfaceAlphaMod(graphics.background, backAlpha);
- SDL_SetSurfaceAlphaMod(title, titleAlpha);
+ SDL_SetAlpha(graphics.background, backAlpha);
+ SDL_SetAlpha(title, titleAlpha);
}
}
if (backAlpha < 255)
{
backAlpha++;
- SDL_SetSurfaceAlphaMod(graphics.background, backAlpha);
+ SDL_SetAlpha(graphics.background, backAlpha);
}
}
if (titleAlpha < 255)
{
titleAlpha++;
- SDL_SetSurfaceAlphaMod(title, titleAlpha);
+ SDL_SetAlpha(title, titleAlpha);
}
else
{