Move SDL input driver init to sdlwrap.

This commit is contained in:
Themaister 2012-05-25 22:11:44 +02:00
parent b2c7b766ae
commit 1e73ba4661
3 changed files with 16 additions and 9 deletions

View File

@ -1381,15 +1381,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
memcpy(gl->prev_info[i].coord, tex_coords, sizeof(tex_coords));
}
// Hook up SDL input driver to get SDL_QUIT events and RESIZE.
sdl_input_t *sdl_input = (sdl_input_t*)input_sdl.init();
if (sdl_input)
{
*input = &input_sdl;
*input_data = sdl_input;
}
else
*input = NULL;
sdlwrap_input_driver(input, input_data);
gl_init_font(gl, g_settings.video.font_path, g_settings.video.font_size);

View File

@ -359,3 +359,15 @@ bool sdlwrap_window_has_focus(void)
#endif
}
void sdlwrap_input_driver(const input_driver_t **input, void **input_data)
{
void *sdl_input = input_sdl.init();
if (sdl_input)
{
*input = &input_sdl;
*input_data = sdl_input;
}
else
*input = NULL;
}

View File

@ -23,6 +23,7 @@
#include "../boolean.h"
#include "../driver.h"
#include "SDL.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
@ -64,5 +65,7 @@ bool sdlwrap_get_wm_info(SDL_SysWMinfo *info);
bool sdlwrap_window_has_focus(void);
void sdlwrap_input_driver(const input_driver_t **input, void **input_data);
#endif