]> git.mxchange.org Git - quix0rs-blobwars.git/blob - src/CGraphics.h
Import of version 1.14 minus music and sounds.
[quix0rs-blobwars.git] / src / CGraphics.h
1 /*
2 Copyright (C) 2004 Parallel Realities
3
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.
8
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.
12
13 See the GNU General Public License for more details.
14
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.
18
19 */
20
21 class Graphics {
22
23         private:
24
25                 Engine *engine;
26                 SDL_Rect gRect;
27                 TTF_Font *font[5];
28                 SDL_Color fontForeground, fontBackground;
29
30                 List spriteList;
31
32                 int fontSize;
33                 
34                 int waterAnim;
35                 int slimeAnim;
36                 int lavaAnim;
37
38                 int currentLoading;
39
40                 int screenShotNumber;
41                 char screenshot[100];
42                 char chatString[1024];
43
44                 SDL_Surface *fadeBlack;
45                 SDL_Surface *infoMessage;
46
47         public:
48
49                 bool takeRandomScreenShots;
50
51                 SDL_Surface *screen, *background;
52                 SDL_Surface *tile[MAX_TILES];
53                 
54                 SDL_Surface *infoBar;
55
56                 int red, yellow, green, darkGreen, skyBlue, blue, cyan, white, lightGrey, grey, darkGrey, black;
57
58         Graphics();
59         void free();
60         void destroy();
61         void registerEngine(Engine *engine);
62         void mapColors();
63         Sprite *getSpriteHead();
64         void setTransparent(SDL_Surface *sprite);
65         void updateScreen();
66         void delay(int time);
67         void RGBtoHSV(float r, float g, float b, float *h, float *s, float *v);
68         void HSVtoRGB(float *r, float *g, float *b, float h, float s, float v);
69         SDL_Surface *loadImage(const char *filename);
70         SDL_Surface *loadImage(const char *filename, int hue, int sat, int value);
71         SDL_Surface *quickSprite(const char *name, SDL_Surface *image);
72         void fade(int amount);
73         void fadeToBlack();
74         void loadMapTiles(const char *baseDir);
75         void loadFont(int i, const char *filename, int pixelSize);
76         Sprite *addSprite(const char *name);
77         Sprite *getSprite(const char *name, bool required);
78         void animateSprites();
79         int getWaterAnim();
80         int getSlimeAnim();
81         int getLavaAnim();
82         int getLavaAnim(int current);
83         void loadBackground(const char *filename);
84         void putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest);
85         Uint32 getPixel(SDL_Surface *surface, int x, int y);
86         void drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest);
87         void blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered);
88         void drawBackground();
89         void drawBackground(SDL_Rect *r);
90         void drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest);
91         void drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest);
92         void setFontColor(int red, int green, int blue, int red2, int green2, int blue2);
93         void setFontSize(int size);
94         SDL_Surface *getString(const char *in, bool transparent);
95         void drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest);
96         void clearChatString();
97         void createChatString(const char *in);
98         void drawChatString(SDL_Surface *surface, int y);
99         void drawWidgetRect(int x, int y, int w, int h);
100         SDL_Surface *createSurface(int width, int height);
101         SDL_Surface *alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue);
102         void colorize(SDL_Surface *image, int red, int green, int blue);
103         void lock(SDL_Surface *surface);
104         void unlock(SDL_Surface *surface);
105         void resetLoading();
106         void showLoading(int amount, int max);
107         void showErrorAndExit(const char *error, const char *param);
108         void showLicenseErrorAndExit();
109         void showRootWarning();
110
111 };