1
0
Fork 0

Melchior FRANZ:

Use a suggested exit method as described in the SDL_Quit man page. (fgOSExit() is still uncalled in both fg_os.cxx (glut) and fg_os_sdl.cxx, which makes these functions kind-of useless.) The other changes are fixes for gcc 3.3.4 warnings.
This commit is contained in:
ehofman 2004-11-20 13:04:26 +00:00
parent b859e77072
commit 4de23ad628

View file

@ -70,6 +70,7 @@ void fgOSOpenWindow(int w, int h, int bpp,
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) == -1) if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) == -1)
throw sg_throwable(string("Failed to initialize SDL: ") throw sg_throwable(string("Failed to initialize SDL: ")
+ SDL_GetError()); + SDL_GetError());
atexit(SDL_Quit);
SDL_WM_SetCaption("FlightGear", "FlightGear"); SDL_WM_SetCaption("FlightGear", "FlightGear");
@ -175,12 +176,9 @@ static void handleKey(int key, int raw, int keyup)
(*KeyHandler)(key, keymod, CurrentMouseX, CurrentMouseY); (*KeyHandler)(key, keymod, CurrentMouseX, CurrentMouseY);
} }
// FIXME: need to export this and get the rest of FlightGear to use // FIXME: Integrate with existing fgExit() in util.cxx.
// it, the SDL hook is required to do things like reset the video
// mode and key repeat. Integrate with existing fgExit() in util.cxx.
void fgOSExit(int code) void fgOSExit(int code)
{ {
SDL_Quit();
exit(code); exit(code);
} }
@ -341,7 +339,7 @@ void fgSetMouseCursor(int cursor)
return; return;
} }
SDL_ShowCursor(SDL_ENABLE); SDL_ShowCursor(SDL_ENABLE);
for(int i=0; i<NCURSORS; i++) { for(unsigned int i=0; i<NCURSORS; i++) {
if(cursor == cursors[i].name) { if(cursor == cursors[i].name) {
CurrentMouseCursor = cursor; CurrentMouseCursor = cursor;
SDL_SetCursor(cursors[i].sdlCursor); SDL_SetCursor(cursors[i].sdlCursor);
@ -361,8 +359,7 @@ int fgGetMouseCursor()
static void initCursors() static void initCursors()
{ {
unsigned char mask[128], img[128]; unsigned char mask[128], img[128];
int i=0; for(unsigned int i=0; i<NCURSORS; i++) {
for(int i=0; i<NCURSORS; i++) {
if(cursors[i].name == MOUSE_CURSOR_NONE) break; if(cursors[i].name == MOUSE_CURSOR_NONE) break;
for(int j=0; j<128; j++) mask[j] = img[j] = 0; for(int j=0; j<128; j++) mask[j] = img[j] = 0;
for(int y=0; y<cursors[i].h; y++) { for(int y=0; y<cursors[i].h; y++) {