]> git.localhorst.tv Git - l2e.git/blob - src/sdl/InitScreen.cpp
added linkage type and some getters to Interpreter
[l2e.git] / src / sdl / InitScreen.cpp
1 /*
2  * InitScreen.cpp
3  *
4  *  Created on: Apr 22, 2012
5  *      Author: holy
6  */
7
8 #include "InitScreen.h"
9
10 #include <stdexcept>
11
12 using std::runtime_error;
13
14
15 namespace sdl {
16
17 InitScreen::InitScreen(int width, int height, int bpp, Sint32 flags)
18 : screen(SDL_SetVideoMode(width, height, bpp, flags))
19 , bpp(bpp)
20 , flags(flags) {
21         if (!screen) {
22                 throw runtime_error("failed to open screen");
23         }
24 }
25
26 InitScreen::~InitScreen(void) {
27
28 }
29
30 SDL_Surface *InitScreen::Resize(int width, int height) {
31         SDL_Surface *newScreen(SDL_SetVideoMode(width, height, bpp, flags));
32         if (!newScreen) {
33                 throw runtime_error("failed to resize screen");
34         }
35         return screen = newScreen;
36 }
37
38 }