workaround a problem with the harmattan gcc
[drnoksnes] / platform / sdlvexit.cpp
1 #include <SDL.h>
2 #include <SDL_image.h>
3
4 #include "platform.h"
5 #include "sdlv.h"
6
7 #define BACK_BUTTON_IMG_PATH \
8         "/usr/share/icons/hicolor/scalable/hildon/general_overlay_back.png"
9
10 #define DIE(format, ...) do { \
11                 fprintf(stderr, "Died at %s:%d: ", __FILE__, __LINE__ ); \
12                 fprintf(stderr, format "\n", ## __VA_ARGS__); \
13                 abort(); \
14         } while (0);
15
16 static SDL_Surface* buttonSrf = 0;
17 static SDL_Rect buttonRect;
18
19 static const unsigned long totalAnimLen = 1;
20
21 static unsigned long frameCounter = 0;
22
23 void ExitBtnReset()
24 {
25         frameCounter = 0;
26         if (!buttonSrf) {
27                 buttonSrf = IMG_Load(BACK_BUTTON_IMG_PATH);
28         }
29
30         buttonRect.x = GUI.Width - buttonSrf->w;
31         buttonRect.y = 0;
32         buttonRect.w = buttonSrf->w;
33         buttonRect.h = buttonSrf->h;
34 }
35
36 bool ExitBtnRequiresDraw()
37 {
38         if (!Config.fullscreen) return false;
39         if (frameCounter > totalAnimLen) {
40                 return false;
41         } else {
42                 frameCounter++;
43                 return true;
44         }
45         
46 };
47
48 void ExitBtnDraw(SDL_Surface* where)
49 {
50         SDL_BlitSurface(buttonSrf, 0, where, &buttonRect);
51         SDL_UpdateRects(where, 1, &buttonRect);
52 };
53