initialize and clean up ODE properly

git-svn-id: svn://anubis/dwscr/trunk@123 5bef9df8-b654-44bb-925b-0ff18baa8f8c
This commit is contained in:
josh 2010-10-26 20:13:34 +00:00
parent 580597f389
commit 639e4c9f23

View File

@ -12,6 +12,7 @@
#include <string> #include <string>
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h> #include <SDL_syswm.h>
#include <ode/ode.h>
#include "displayinfo.h" #include "displayinfo.h"
#include "ss/SSMain.h" #include "ss/SSMain.h"
using namespace std; using namespace std;
@ -67,11 +68,11 @@ int main(int argc, char * argv[])
/* make the SDL window appear in the top-left corner of the screen */ /* make the SDL window appear in the top-left corner of the screen */
if (!windowed) if (!windowed)
putenv("SDL_VIDEO_WINDOW_POS=0,0"); putenv((char *) "SDL_VIDEO_WINDOW_POS=0,0");
/* do not disable power management (this will allow monitors /* do not disable power management (this will allow monitors
* to power off at the normally configured timeout) */ * to power off at the normally configured timeout) */
putenv("SDL_VIDEO_ALLOW_SCREENSAVER=1"); putenv((char *) "SDL_VIDEO_ALLOW_SCREENSAVER=1");
if (!start) if (!start)
return 0; return 0;
@ -109,12 +110,15 @@ int main(int argc, char * argv[])
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
} }
dInitODE();
/* after our window is created and SDL and OpenGL are initialized, /* after our window is created and SDL and OpenGL are initialized,
* start the main screensaver functionality */ * start the main screensaver functionality */
int num_monitors = windowed ? 1 : getNumMonitors(); int num_monitors = windowed ? 1 : getNumMonitors();
SSMain ss(width, height, num_monitors, sdlSurface); SSMain ss(width, height, num_monitors, sdlSurface);
ss.run(); ss.run();
dCloseODE();
SDL_Quit(); SDL_Quit();
return 0; return 0;
} }