2 Copyright (C) 2004-2011 Parallel Realities
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 SDL_Color fontForeground, fontBackground;
42 char chatString[1024];
44 SDL_Surface *medalMessage;
45 int medalMessageTimer;
48 SDL_Surface *fadeBlack;
49 SDL_Surface *infoMessage;
55 SurfaceCache(): text(NULL), surface(NULL) {}
58 bool takeRandomScreenShots;
61 SDL_Renderer *renderer;
63 SDL_Surface *screen, *background;
64 SDL_Surface *tile[MAX_TILES];
66 SDL_Surface *medal[4];
67 SDL_Surface *license[2];
71 int red, yellow, green, darkGreen, skyBlue, blue, cyan, white, lightGrey, grey, darkGrey, black;
76 void registerEngine(Engine *engine);
78 Sprite *getSpriteHead();
79 void setTransparent(SDL_Surface *sprite);
81 bool canShowMedalMessage() const;
83 void RGBtoHSV(float r, float g, float b, float *h, float *s, float *v);
84 void HSVtoRGB(float *r, float *g, float *b, float h, float s, float v);
85 SDL_Surface *loadImage(const char *filename, bool srcalpha = false);
86 SDL_Surface *loadImage(const char *filename, int hue, int sat, int value);
87 SDL_Surface *quickSprite(const char *name, SDL_Surface *image);
88 void fade(int amount);
90 void loadMapTiles(const char *baseDir);
91 void loadFont(int i, const char *filename, int pixelSize);
92 Sprite *addSprite(const char *name);
93 Sprite *getSprite(const char *name, bool required);
94 void animateSprites();
95 int getWaterAnim() const;
96 int getSlimeAnim() const;
97 int getLavaAnim() const;
98 int getLavaAnim(int current);
99 void loadBackground(const char *filename);
100 void putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest);
101 Uint32 getPixel(SDL_Surface *surface, int x, int y);
102 void drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest);
103 void blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered);
104 void drawBackground();
105 void drawBackground(SDL_Rect *r);
106 void drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest);
107 void drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest);
108 void setFontColor(int red, int green, int blue, int red2, int green2, int blue2);
109 void setFontSize(int size);
110 SDL_Surface *getString(const char *in, bool transparent);
111 void drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest);
112 void drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache);
113 void clearChatString();
114 void createChatString(const char *in);
115 void showMedalMessage(int type, const char *in);
116 void drawChatString(SDL_Surface *surface, int y);
117 void drawWidgetRect(int x, int y, int w, int h);
118 SDL_Surface *createSurface(int width, int height);
119 SDL_Surface *alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue);
120 void colorize(SDL_Surface *image, int red, int green, int blue);
121 void lock(SDL_Surface *surface);
122 void unlock(SDL_Surface *surface);
124 void showLoading(int amount, int max);
125 void showErrorAndExit(const char *error, const char *param);
126 void showLicenseErrorAndExit();
127 void showRootWarning();