summaryrefslogtreecommitdiff
path: root/lib/base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/base.cc')
-rw-r--r--lib/base.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/base.cc b/lib/base.cc
index 7a6c854..acfc654 100644
--- a/lib/base.cc
+++ b/lib/base.cc
@@ -17,7 +17,7 @@ mogltk::base::base(int w, int h, int flags) throw(GeneralException) : surface(0)
throw GeneralException(String("Couldn't initialise Video SubSystem: ") + SDL_GetError());
}
- if (!(surface = SDL_SetVideoMode(width, height, 0, flags))) {
+ if (!(surface = SDL_SetVideoMode(width, height, 0, flags | SDL_HWSURFACE))) {
throw GeneralException(String("Couldn't set SDL mode: ") + SDL_GetError());
}
@@ -94,3 +94,17 @@ void mogltk::base::changeviewport(int x, int y, unsigned int w, unsigned int h)
SDL_SetClipRect(surface, &r);
}
+
+void mogltk::base::ToggleFullscreen() {
+ int newflags = surface->flags;
+
+ if (surface->flags & SDL_FULLSCREEN)
+ newflags &= ~SDL_FULLSCREEN;
+ else
+ newflags |= SDL_FULLSCREEN;
+
+ texture::Taintall();
+
+ surface = SDL_SetVideoMode(surface->w, surface->h, surface->format->BitsPerPixel,
+ SDL_HWSURFACE | newflags);
+}