SDL: Move init() method into base

This commit is contained in:
Dave Vasilevsky 2013-04-24 01:53:50 -04:00
parent 19529cacd4
commit 9e807c884c

View File

@ -600,7 +600,7 @@ static void migrate_screen_prefs(void)
class driver_base { class driver_base {
public: public:
driver_base(SDL_monitor_desc &m); driver_base(SDL_monitor_desc &m);
virtual void init(); void init();
~driver_base(); ~driver_base();
void update_palette(void); void update_palette(void);
@ -631,13 +631,11 @@ static void update_display_static(driver_base *drv);
class driver_window : public driver_base { class driver_window : public driver_base {
public: public:
driver_window(SDL_monitor_desc &monitor); driver_window(SDL_monitor_desc &monitor);
virtual void init();
}; };
class driver_fullscreen : public driver_base { class driver_fullscreen : public driver_base {
public: public:
driver_fullscreen(SDL_monitor_desc &monitor); driver_fullscreen(SDL_monitor_desc &monitor);
virtual void init();
}; };
static driver_base *drv = NULL; // Pointer to currently used driver object static driver_base *drv = NULL; // Pointer to currently used driver object
@ -657,6 +655,16 @@ void driver_base::init()
{ {
int aligned_height = (VIDEO_MODE_Y + 15) & ~15; int aligned_height = (VIDEO_MODE_Y + 15) & ~15;
int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH); int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
int width = VIDEO_MODE_X, height = VIDEO_MODE_Y;
ADBSetRelMouseMode(mouse_grabbed);
// Create surface
int flags = SDL_HWSURFACE;
if (display_type == DISPLAY_SCREEN)
flags |= SDL_FULLSCREEN;
if ((s = SDL_SetVideoMode(width, height, depth, flags)) == NULL)
return;
#ifdef ENABLE_VOSF #ifdef ENABLE_VOSF
use_vosf = true; use_vosf = true;
@ -796,21 +804,6 @@ driver_window::driver_window(SDL_monitor_desc &m)
{ {
} }
void driver_window::init()
{
int width = VIDEO_MODE_X, height = VIDEO_MODE_Y;
// Set absolute mouse mode
ADBSetRelMouseMode(mouse_grabbed);
// Create surface
int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
if ((s = SDL_SetVideoMode(width, height, depth, SDL_HWSURFACE)) == NULL)
return;
driver_base::init();
}
// Toggle mouse grab // Toggle mouse grab
void driver_base::toggle_mouse_grab(void) void driver_base::toggle_mouse_grab(void)
{ {
@ -856,21 +849,6 @@ driver_fullscreen::driver_fullscreen(SDL_monitor_desc &m)
{ {
} }
void driver_fullscreen::init()
{
int width = VIDEO_MODE_X, height = VIDEO_MODE_Y;
// Set absolute mouse mode
ADBSetRelMouseMode(false);
// Create surface
int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
if ((s = SDL_SetVideoMode(width, height, depth, SDL_HWSURFACE | SDL_FULLSCREEN)) == NULL)
return;
driver_base::init();
}
/* /*
* Initialization * Initialization