added in quitting from game if window close button pressed

This commit is contained in:
Dave White 2003-09-26 11:52:42 +00:00
parent 5c1b18c70d
commit 4a271ee0a5
3 changed files with 10 additions and 0 deletions

View file

@ -428,6 +428,8 @@ int main(int argc, char** argv)
std::cerr << e.message << "\n";
} catch(gui::button::error&) {
std::cerr << "Could not create button: Image could not be found\n";
} catch(CVideo::quit&) {
//just means the game should quit
}
return 0;

View file

@ -230,6 +230,12 @@ void pump_events()
resize_dimensions.first = resize->w;
resize_dimensions.second = resize->h;
}
break;
}
case SDL_QUIT: {
throw CVideo::quit();
}
}
}

View file

@ -51,6 +51,8 @@ class CVideo {
struct error {};
struct quit {};
private:
SDL_Surface* frameBuffer;