• R/O
  • SSH
  • HTTPS

deeangband: Commit


Commit MetaInfo

Revision9210 (tree)
Time2014-02-20 21:00:21
Authordeskull

Log Message

Implementing Redraw() in GameSurfaceSDL class.

Change Summary

Incremental Difference

--- source/branch/new_source/Deeangband/Deeangband/GameSurfaceSDL.h (revision 9209)
+++ source/branch/new_source/Deeangband/Deeangband/GameSurfaceSDL.h (revision 9210)
@@ -28,10 +28,18 @@
2828 SDL_RWops *rwop;
2929 string error;
3030 SDL_Window *window;
31+ TTF_Font* font;
32+ SDL_Surface *surface, *surface2;
33+ SDL_Color color;
34+ SDL_Rect src;
35+ SDL_Rect title;
36+
3137 bool SDL_event(void);
38+
3239 public:
40+ void initInterfaces(void);
41+ void Redraw(void);
3342 GameSurfaceSDL(void);
3443 ~GameSurfaceSDL(void);
35- void test(void);
3644 GameCommand GetCommand(void);
3745 };
--- source/branch/new_source/Deeangband/Deeangband/Deeangband.cpp (revision 9209)
+++ source/branch/new_source/Deeangband/Deeangband/Deeangband.cpp (revision 9210)
@@ -16,7 +16,8 @@
1616 {
1717 GameSurfaceSDL gSurface;
1818 GameWorld gWorld(&gSurface);
19- gSurface.test();
19+ gSurface.initInterfaces();
20+ gSurface.Redraw();
2021 return 0;
2122 }
2223
--- source/branch/new_source/Deeangband/Deeangband/GameSurfaceSDL.cpp (revision 9209)
+++ source/branch/new_source/Deeangband/Deeangband/GameSurfaceSDL.cpp (revision 9210)
@@ -62,17 +62,17 @@
6262 SDL_Quit();
6363 }
6464
65-void GameSurfaceSDL::test(void)
65+void GameSurfaceSDL::initInterfaces(void)
6666 {
67- TTF_Font* font = TTF_OpenFont("ttf\\ipam.ttf", 18);
68- SDL_Surface *surface, *surface2;
69- SDL_Color color;
70- SDL_Rect src = {0, 0, 300, 200};
71- SDL_Rect title = {0, 0, 512, 512};
72-
73- renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
74-
75- SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
67+ font = TTF_OpenFont("ttf\\ipam.ttf", 18);
68+ src.x = 0;
69+ src.y = 0;
70+ src.w = 300;
71+ src.h = 200;
72+ title.x = 0;
73+ title.y = 0;
74+ title.w = 512;
75+ title.h = 512;
7676 color.r = 255;
7777 color.g = 223;
7878 color.b = 200;
@@ -84,7 +84,13 @@
8484 rwop = SDL_RWFromFile("img\\Title.png", "rb");
8585 error = IMG_GetError();
8686 surface2 = IMG_LoadPNG_RW(rwop);
87+}
8788
89+void GameSurfaceSDL::Redraw()
90+{
91+ renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
92+ SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
93+
8894 SDL_BlitSurface(surface, &src, SDL_GetWindowSurface(window), &src);
8995 SDL_BlitSurface(surface2, &title, SDL_GetWindowSurface(window), &title);
9096 SDL_RenderPresent(renderer);
Show on old repository browser