2 Copyright © 2004 Parallel Realities
3 Copyright © 2007-2008 Kővágó Zoltán <DirtY.iCE.hu@gmail.com>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <SDL/SDL_ttf.h>
38 SDL_Color fontForeground
, fontBackground
;
52 char chatString
[1024];
54 SDL_Surface
*fadeBlack
;
55 SDL_Surface
*infoMessage
;
57 bool background_tile
; ///< Wheter to tile or not the background image
59 bool resized
; ///< True, if the window was resized
62 bool takeRandomScreenShots
;
64 SDL_Surface
*screen
, *background
;
65 SDL_Surface
*tile
[MAX_TILES
];
69 int red
, yellow
, green
, darkGreen
, skyBlue
, blue
, cyan
, white
, lightGrey
, grey
, darkGrey
, black
;
75 void registerEngine(Engine
*engine
);
77 Sprite
*getSpriteHead();
78 void setTransparent(SDL_Surface
*sprite
);
81 void RGBtoHSV(float r
, float g
, float b
, float *h
, float *s
, float *v
);
82 void HSVtoRGB(float *r
, float *g
, float *b
, float h
, float s
, float v
);
83 SDL_Surface
*loadImage(const char *filename
, bool colorkey
= true);
84 SDL_Surface
* loadImage(const std::string
& name
, const bool colorkey
= true) { return loadImage(name
.c_str(), colorkey
); };
85 SDL_Surface
*loadImage(const char *filename
, int hue
, int sat
, int value
);
86 SDL_Surface
*quickSprite(const char *name
, SDL_Surface
*image
);
87 void fade(int amount
);
89 void loadMapTiles(const char *baseDir
);
90 void loadFont(int i
, const char *filename
, int pixelSize
);
91 Sprite
*addSprite(const char *name
);
92 Sprite
*getSprite(const char *name
, const bool& required
);
93 void animateSprites();
97 int getLavaAnim(int current
);
98 void loadBackground(const char *filename
, bool tile
= true);
99 void putPixel(int x
, int y
, Uint32 pixel
, SDL_Surface
*dest
);
100 Uint32
getPixel(SDL_Surface
*surface
, int x
, int y
);
101 void drawLine(float startX
, float startY
, float endX
, float endY
, int color
, SDL_Surface
*dest
);
102 void blit(SDL_Surface
*image
, int x
, int y
, SDL_Surface
*dest
, bool centered
);
103 void drawBackground();
104 void drawBackground(SDL_Rect
*r
);
105 void drawRect(int x
, int y
, int w
, int h
, int color
, SDL_Surface
*dest
);
106 void drawRect(int x
, int y
, int w
, int h
, int color
, int borderColor
, SDL_Surface
*dest
);
107 void setFontColor(int red
, int green
, int blue
, int red2
, int green2
, int blue2
);
108 void setFontSize(int size
);
109 SDL_Surface
*getString(const char *in
, bool transparent
);
110 SDL_Surface
*getString(const std::string
& in
, bool transparent
) { return getString(in
.c_str(), transparent
); };
111 int GetStringWidth(const std::string
& text
);
112 void drawString(const char *in
, int x
, int y
, int alignment
, SDL_Surface
*dest
);
113 void drawString(std::string str
, int x
, int y
, int align
, SDL_Surface
* dest
) { drawString(str
.c_str(), x
, y
, align
, dest
); };
114 void clearChatString();
115 void createChatString(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_str
, const char *param
);
126 void showErrorAndExit(std::string error_str
, std::string param
) { showErrorAndExit(error_str
.c_str(), param
.c_str()); };
127 void showLicenseErrorAndExit();
134 #define bx ((graphics.width/2)-(640/2))
135 #define by ((graphics.height/2)-(480/2))
137 extern Graphics graphics
;