44#include < SDL.h>
55#include < vector>
66
7- int min (int lhs, int rhs);
8- int max (int lhs, int rhs);
7+ // clang-format off
8+ #ifdef FC_USE_SDL_GPU
9+ #pragma clang diagnostic push
10+ #pragma clang diagnostic ignored "-Wunused-function"
11+ #include " SDL_gpu.h"
12+ #pragma clang diagnostic pop
13+ #endif
14+ // clang-format on
15+
16+ #ifdef FC_USE_SDL_GPU
17+ typedef GPU_Image NX_Texture;
18+ typedef GPU_Rect NX_Rect;
19+ typedef GPU_Target NX_Target;
20+ #else
21+ typedef SDL_Texture NX_Texture;
22+ typedef SDL_Rect NX_Rect;
23+ typedef SDL_Renderer NX_Target;
24+ #endif
925
1026class Renderer {
1127public:
@@ -17,28 +33,35 @@ class Renderer {
1733 int clear ();
1834 void flip ();
1935
36+ #ifdef FC_USE_SDL_GPU
37+ GPU_Target* getRenderer () { return renderer; }
38+ #else
2039 SDL_Renderer* getRenderer () { return renderer; }
40+ #endif
2141 int getWidth () const { return width; }
2242 int getHeight () const { return height; }
2343
2444 int setDrawColor (uint8_t r = 0x40 , uint8_t g = 0x40 , uint8_t b = 0xE0 , uint8_t a = 0x00 );
2545
26- void drawTexture (SDL_Texture * tex, SDL_Rect & src, SDL_Rect & dst);
27- void drawTexture (SDL_Texture * tex, SDL_Rect & dst);
28- void drawTexture (SDL_Texture * tex, int x, int y);
46+ void drawTexture (NX_Texture * tex, NX_Rect & src, NX_Rect & dst);
47+ void drawTexture (NX_Texture * tex, NX_Rect & dst);
48+ void drawTexture (NX_Texture * tex, int x, int y);
2949
30- void fillRectangle (const SDL_Rect & dst);
50+ void fillRectangle (const NX_Rect & dst);
3151 void fillRectangle (const SDL_FRect& dst);
3252
3353 void blitSurface (SDL_Surface* bg, SDL_Surface* fg, int offset);
3454
3555 void drawBackground ();
3656
3757private:
38- SDL_Renderer* renderer = nullptr ;
58+ NX_Target* renderer = nullptr ;
59+ NX_Texture* background = nullptr ;
60+
3961 SDL_Window* window = nullptr ;
40- SDL_Texture* background = nullptr ;
62+ # ifndef FC_USE_SDL_GPU
4163 Uint32 renderFlags = 0 ;
64+ #endif
4265 Uint32 windowFlags = 0 ;
4366
4467 int height = 0 ;
@@ -48,6 +71,10 @@ class Renderer {
4871 size_t menuItemCount = 0 ;
4972 size_t lowerHalf = 0 ;
5073 size_t upperHalf = 0 ;
74+
75+ #ifdef FC_USE_SDL_GPU
76+ SDL_Color drawColor;
77+ #endif
5178};
5279
5380#endif
0 commit comments