]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/CGraphics.h
Prevent a segmentation fault when using the -map option without specifying a map.
[quix0rs-blobwars.git] / src / CGraphics.h
old mode 100755 (executable)
new mode 100644 (file)
index 5b1a5b5..151f355
@@ -1,5 +1,6 @@
 /*
-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
@@ -18,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 */
 
+void SDL_SetAlpha(SDL_Surface *surface, uint8_t value);
+
 class Graphics {
 
        private:
@@ -49,13 +52,22 @@ class Graphics {
                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;
 
@@ -69,11 +81,11 @@ class Graphics {
        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);
@@ -83,9 +95,9 @@ class Graphics {
        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);
@@ -100,6 +112,7 @@ class Graphics {
        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);