4 * Created on: Apr 22, 2012
8 #include "InitScreen.h"
12 using std::runtime_error;
17 InitScreen::InitScreen(int width, int height, int bpp, Sint32 flags)
18 : screen(SDL_SetVideoMode(width, height, bpp, flags))
22 throw runtime_error("failed to open screen");
26 InitScreen::~InitScreen(void) {
31 SDL_Surface *InitScreen::Resize(int width, int height) {
32 SDL_Surface *newScreen(SDL_SetVideoMode(width, height, bpp, flags));
34 throw runtime_error("failed to resize screen");
36 return screen = newScreen;
39 void InitScreen::Flip(void) {
41 if (!(screen->flags & SDL_HWSURFACE)) {
42 // probably got no vsync, so suspend execution for a while