/*
-Copyright (C) 2004 Parallel Realities
+Copyright (C) 2004-2011 Parallel Realities
+Copyright (C) 2011-2015 Perpendicular Dimensions
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
*/
+void SDL_SetAlpha(SDL_Surface *surface, uint8_t value);
+
class Graphics {
private:
SDL_Surface *infoMessage;
public:
+ struct SurfaceCache {
+ char *text;
+ SDL_Surface *surface;
+ SurfaceCache(): text(NULL), surface(NULL) {}
+ };
bool takeRandomScreenShots;
+ SDL_Window *window;
+ SDL_Renderer *renderer;
+ SDL_Texture *texture;
SDL_Surface *screen, *background;
SDL_Surface *tile[MAX_TILES];
SDL_Surface *medal[4];
+ SDL_Surface *license[2];
SDL_Surface *infoBar;
Sprite *getSpriteHead();
void setTransparent(SDL_Surface *sprite);
void updateScreen();
- bool canShowMedalMessage();
+ bool canShowMedalMessage() const;
void delay(int time);
void RGBtoHSV(float r, float g, float b, float *h, float *s, float *v);
void HSVtoRGB(float *r, float *g, float *b, float h, float s, float v);
- SDL_Surface *loadImage(const char *filename);
+ SDL_Surface *loadImage(const char *filename, bool srcalpha = false);
SDL_Surface *loadImage(const char *filename, int hue, int sat, int value);
SDL_Surface *quickSprite(const char *name, SDL_Surface *image);
void fade(int amount);
Sprite *addSprite(const char *name);
Sprite *getSprite(const char *name, bool required);
void animateSprites();
- int getWaterAnim();
- int getSlimeAnim();
- int getLavaAnim();
+ int getWaterAnim() const;
+ int getSlimeAnim() const;
+ int getLavaAnim() const;
int getLavaAnim(int current);
void loadBackground(const char *filename);
void putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest);
void setFontSize(int size);
SDL_Surface *getString(const char *in, bool transparent);
void drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest);
+ void drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache);
void clearChatString();
void createChatString(const char *in);
void showMedalMessage(int type, const char *in);