diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-16 19:26:59 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-16 19:26:59 +0000 |
commit | a6db4d8004da5ad985a5ff26c0c01976a5618449 (patch) | |
tree | 5ed3dea6a28222de87840a4d1966338098123993 /src/graphics.cpp | |
parent | f4aedad02e8994f89a4137d175dba2666a7005bc (diff) | |
download | mana-a6db4d8004da5ad985a5ff26c0c01976a5618449.tar.gz mana-a6db4d8004da5ad985a5ff26c0c01976a5618449.tar.bz2 mana-a6db4d8004da5ad985a5ff26c0c01976a5618449.tar.xz mana-a6db4d8004da5ad985a5ff26c0c01976a5618449.zip |
Updated changelog, got rid of remaining extern SDL_Surface *screen cases,
fixed double free and cleaned up a bit.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 9f8981e3..2ebbc146 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -28,10 +28,9 @@ extern volatile int framesToDraw; -SDL_Surface *screen; - -Graphics::Graphics() +Graphics::Graphics(SDL_Surface *screen): + mScreen(screen) { if (useOpenGL) { #ifdef USE_OPENGL @@ -48,7 +47,7 @@ Graphics::Graphics() } else { #ifndef USE_OPENGL - setTarget(SDL_GetVideoSurface()); + setTarget(mScreen); #endif } @@ -64,17 +63,17 @@ Graphics::~Graphics() int Graphics::getWidth() { - return screen->w; + return mScreen->w; } int Graphics::getHeight() { - return screen->h; + return mScreen->h; } void Graphics::drawImage(Image *image, int x, int y) { - image->draw_deprecated(screen, x, y); + image->draw_deprecated(mScreen, x, y); } void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h) @@ -90,7 +89,7 @@ void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h) while (px < w) { int dw = (px + iw >= w) ? w - px : iw; int dh = (py + ih >= h) ? h - py : ih; - image->draw_deprecated(screen, 0, 0, x + px, y + py, dw, dh); + image->draw_deprecated(mScreen, 0, 0, x + px, y + py, dw, dh); px += iw; } py += ih; @@ -159,7 +158,7 @@ void Graphics::updateScreen() #endif } else { - SDL_Flip(screen); + SDL_Flip(mScreen); } // Decrement frame counter when using framerate limiting @@ -171,3 +170,8 @@ void Graphics::updateScreen() SDL_Delay(10); } } + +void Graphics::setScreen(SDL_Surface *screen) +{ + mScreen = screen; +} |