24 #include <core/exception.h> 25 #include <core/threading/mutex.h> 26 #include <core/threading/mutex_locker.h> 27 #include <fvwidgets/sdl_keeper.h> 33 namespace firevision {
35 unsigned int SDLKeeper::_refcount = 0;
36 Mutex SDLKeeper::_mutex;
48 SDLKeeper::SDLKeeper()
58 SDLKeeper::init(
unsigned int flags)
62 unsigned int alive_subsys = SDL_WasInit(SDL_INIT_EVERYTHING);
63 if ((alive_subsys & flags) != flags) {
66 if (SDL_Init(flags) != 0) {
67 throw Exception(
"SDL: initialization failed");
70 unsigned int still_to_init = ~alive_subsys & flags;
71 if (SDL_Init(still_to_init) != 0) {
72 throw Exception(
"SDL: initialization failed");
85 SDLKeeper::quit() throw()
89 if ((_refcount > 0) && (--_refcount == 0)) {
98 SDLKeeper::force_quit()
Fawkes library namespace.
Base class for exceptions in Fawkes.
Mutex mutual exclusion lock.