using namespace std;
-void init_GL(int w = 640, int h = 480)
+void Game::resize(int w = 640, int h = 480)
{
+ mScreen = SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_RESIZABLE);
+ if (!mScreen) {
+ printf ("Couldn't set video mode: %s\n", SDL_GetError ());
+ exit (2);
+ }
+
// Set the OpenGL state after creating the context with SDL_SetVideoMode
glClearColor( 0, 0, 0, 0 );
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
- /** Set 800x600 video mode */
- mScreen = SDL_SetVideoMode(screenwidth, screenheight, 32, SDL_OPENGL | SDL_RESIZABLE);
- if (!mScreen) {
- printf ("Couldn't set video mode: %s\n", SDL_GetError ());
- exit (2);
- }
/** Set the title of our application window handler */
SDL_WM_SetCaption("Ivan's Game", NULL);
SDL_ShowCursor(0);
- init_GL(screenwidth, screenheight);
+ resize(screenwidth, screenheight);
/** Load Resources */
LoadResources();
break;
case SDL_VIDEORESIZE :
- init_GL( event.resize.w, event.resize.h ) ;
+ resize( event.resize.w, event.resize.h ) ;
break ;
case SDL_USEREVENT: