mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
A bit more alignment between windows and sdl. (nw)
This commit is contained in:
parent
984e40296b
commit
f5a41bb547
@ -149,7 +149,7 @@ public:
|
|||||||
m_last_blit_time(0), m_last_blit_pixels(0)
|
m_last_blit_time(0), m_last_blit_pixels(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/* virtual */ int create(const int width, const int height);
|
/* virtual */ int create();
|
||||||
/* virtual */ int draw(const UINT32 dc, const int update);
|
/* virtual */ int draw(const UINT32 dc, const int update);
|
||||||
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
||||||
/* virtual */ void destroy_all_textures();
|
/* virtual */ void destroy_all_textures();
|
||||||
@ -572,7 +572,7 @@ static void drawsdl2_exit(void)
|
|||||||
// a
|
// a
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int sdl_info13::create(int width, int height)
|
int sdl_info13::create()
|
||||||
{
|
{
|
||||||
#if (SDLMAME_SDL2)
|
#if (SDLMAME_SDL2)
|
||||||
// create renderer
|
// create renderer
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
m_last_blit_time(0), m_last_blit_pixels(0)
|
m_last_blit_time(0), m_last_blit_pixels(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/* virtual */ int create(const int width, const int height);
|
/* virtual */ int create();
|
||||||
/* virtual */ int draw(const UINT32 dc, const int update);
|
/* virtual */ int draw(const UINT32 dc, const int update);
|
||||||
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
||||||
/* virtual */ void destroy_all_textures();
|
/* virtual */ void destroy_all_textures();
|
||||||
@ -134,7 +134,7 @@ int drawbgfx_init(running_machine &machine, sdl_draw_info *callbacks)
|
|||||||
// sdl_info_bgfx::create
|
// sdl_info_bgfx::create
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int sdl_info_bgfx::create(int width, int height)
|
int sdl_info_bgfx::create()
|
||||||
{
|
{
|
||||||
// create renderer
|
// create renderer
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ public:
|
|||||||
m_texVerticex[i] = 0.0f;
|
m_texVerticex[i] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ int create(const int width, const int height);
|
/* virtual */ int create();
|
||||||
/* virtual */ int draw(const UINT32 dc, const int update);
|
/* virtual */ int draw(const UINT32 dc, const int update);
|
||||||
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
||||||
/* virtual */ void destroy_all_textures();
|
/* virtual */ void destroy_all_textures();
|
||||||
@ -711,7 +711,7 @@ void sdl_info_ogl::initialize_gl()
|
|||||||
// a
|
// a
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int sdl_info_ogl::create(int width, int height)
|
int sdl_info_ogl::create()
|
||||||
{
|
{
|
||||||
|
|
||||||
#if (SDLMAME_SDL2)
|
#if (SDLMAME_SDL2)
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
m_last_height(0)
|
m_last_height(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/* virtual */ int create(const int width, const int height);
|
/* virtual */ int create();
|
||||||
/* virtual */ int draw(const UINT32 dc, const int update);
|
/* virtual */ int draw(const UINT32 dc, const int update);
|
||||||
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
||||||
/* virtual */ void destroy_all_textures();
|
/* virtual */ void destroy_all_textures();
|
||||||
@ -419,7 +419,7 @@ static void drawsdl_show_info(struct SDL_RendererInfo *render_info)
|
|||||||
// a
|
// a
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int sdl_info::create(int width, int height)
|
int sdl_info::create()
|
||||||
{
|
{
|
||||||
|
|
||||||
#if (SDLMAME_SDL2)
|
#if (SDLMAME_SDL2)
|
||||||
@ -465,7 +465,7 @@ int sdl_info::create(int width, int height)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_texture(width, height);
|
setup_texture(window().width(), window().height());
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ void sdl_window_info::update_cursor_state()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
|
OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt )
|
||||||
{
|
{
|
||||||
worker_param * wp = (worker_param *) param;
|
worker_param * wp = (worker_param *) param;
|
||||||
sdl_window_info * window = wp->window();
|
sdl_window_info * window = wp->window();
|
||||||
@ -1020,7 +1020,7 @@ void sdl_window_info::update()
|
|||||||
// adjust the cursor state
|
// adjust the cursor state
|
||||||
//sdlwindow_update_cursor_state(machine, window);
|
//sdlwindow_update_cursor_state(machine, window);
|
||||||
|
|
||||||
execute_async(&sdlwindow_update_cursor_state_wt, worker_param(this));
|
execute_async(&update_cursor_state_wt, worker_param(this));
|
||||||
|
|
||||||
// if we're visible and running and not in the middle of a resize, draw
|
// if we're visible and running and not in the middle of a resize, draw
|
||||||
if (m_target != NULL)
|
if (m_target != NULL)
|
||||||
@ -1276,7 +1276,7 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// initialize the drawing backend
|
// initialize the drawing backend
|
||||||
if (window->renderer().create(window->width(), window->height()))
|
if (window->renderer().create())
|
||||||
return (void *) &result[1];
|
return (void *) &result[1];
|
||||||
|
|
||||||
// Make sure we have a consistent state
|
// Make sure we have a consistent state
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
int flags() const { return m_flags; }
|
int flags() const { return m_flags; }
|
||||||
bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
|
bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
|
||||||
|
|
||||||
virtual int create(const int width, const int height) = 0;
|
virtual int create() = 0;
|
||||||
virtual int draw(const UINT32 dc, const int update) = 0;
|
virtual int draw(const UINT32 dc, const int update) = 0;
|
||||||
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
|
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
|
||||||
virtual void destroy_all_textures() = 0;
|
virtual void destroy_all_textures() = 0;
|
||||||
@ -115,33 +115,21 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int window_init();
|
int window_init();
|
||||||
void destroy();
|
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void toggle_full_screen();
|
void toggle_full_screen();
|
||||||
void modify_prescale(int dir);
|
void modify_prescale(int dir);
|
||||||
void resize(INT32 width, INT32 height);
|
void resize(INT32 width, INT32 height);
|
||||||
|
void destroy();
|
||||||
void clear();
|
void clear();
|
||||||
int xy_to_render_target(int x, int y, int *xt, int *yt);
|
int xy_to_render_target(int x, int y, int *xt, int *yt);
|
||||||
|
|
||||||
void get_min_bounds(int *window_width, int *window_height, int constrain);
|
|
||||||
void get_max_bounds(int *window_width, int *window_height, int constrain);
|
|
||||||
|
|
||||||
running_machine &machine() const { return m_machine; }
|
running_machine &machine() const { return m_machine; }
|
||||||
sdl_monitor_info *monitor() const { return m_monitor; }
|
sdl_monitor_info *monitor() const { return m_monitor; }
|
||||||
int fullscreen() const { return m_fullscreen; }
|
int fullscreen() const { return m_fullscreen; }
|
||||||
|
|
||||||
void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
|
|
||||||
void update_cursor_state();
|
|
||||||
|
|
||||||
void blit_surface_size(int window_width, int window_height);
|
|
||||||
void pick_best_mode(int *fswidth, int *fsheight);
|
|
||||||
void set_starting_view(running_machine &machine, int index, const char *defview, const char *view);
|
|
||||||
|
|
||||||
int index() const { return m_index; }
|
int index() const { return m_index; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
render_target *target() { return m_target; }
|
render_target *target() { return m_target; }
|
||||||
#if (SDLMAME_SDL2)
|
#if (SDLMAME_SDL2)
|
||||||
SDL_Window *sdl_window() { return m_sdl_window; }
|
SDL_Window *sdl_window() { return m_sdl_window; }
|
||||||
@ -171,15 +159,15 @@ public:
|
|||||||
private:
|
private:
|
||||||
// window handle and info
|
// window handle and info
|
||||||
char m_title[256];
|
char m_title[256];
|
||||||
|
int m_startmaximized;
|
||||||
|
|
||||||
// diverse flags
|
// diverse flags
|
||||||
int m_minwidth, m_minheight;
|
int m_minwidth, m_minheight;
|
||||||
int m_maxwidth, m_maxheight;
|
int m_maxwidth, m_maxheight;
|
||||||
int m_depth;
|
|
||||||
int m_refresh;
|
int m_refresh;
|
||||||
|
int m_depth;
|
||||||
int m_windowed_width;
|
int m_windowed_width;
|
||||||
int m_windowed_height;
|
int m_windowed_height;
|
||||||
int m_startmaximized;
|
|
||||||
|
|
||||||
// rendering info
|
// rendering info
|
||||||
osd_event * m_rendered_event;
|
osd_event * m_rendered_event;
|
||||||
@ -218,6 +206,16 @@ protected:
|
|||||||
osd_renderer &renderer() { return *m_renderer; }
|
osd_renderer &renderer() { return *m_renderer; }
|
||||||
private:
|
private:
|
||||||
void constrain_to_aspect_ratio(int *window_width, int *window_height, int adjustment);
|
void constrain_to_aspect_ratio(int *window_width, int *window_height, int adjustment);
|
||||||
|
void update_cursor_state();
|
||||||
|
void blit_surface_size(int window_width, int window_height);
|
||||||
|
void pick_best_mode(int *fswidth, int *fsheight);
|
||||||
|
void set_starting_view(running_machine &machine, int index, const char *defview, const char *view);
|
||||||
|
void get_min_bounds(int *window_width, int *window_height, int constrain);
|
||||||
|
void get_max_bounds(int *window_width, int *window_height, int constrain);
|
||||||
|
void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Pointer to machine
|
// Pointer to machine
|
||||||
running_machine & m_machine;
|
running_machine & m_machine;
|
||||||
@ -235,6 +233,7 @@ private:
|
|||||||
static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt );
|
static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt );
|
||||||
static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt );
|
static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt );
|
||||||
static OSDWORK_CALLBACK( destroy_all_textures_wt );
|
static OSDWORK_CALLBACK( destroy_all_textures_wt );
|
||||||
|
static OSDWORK_CALLBACK( update_cursor_state_wt );
|
||||||
|
|
||||||
void measure_fps(UINT32 dc, int update);
|
void measure_fps(UINT32 dc, int update);
|
||||||
|
|
||||||
|
@ -32,7 +32,41 @@
|
|||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
class osd_renderer;
|
class win_window_info;
|
||||||
|
|
||||||
|
class osd_renderer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* Generic flags */
|
||||||
|
static const int FLAG_NONE = 0x0000;
|
||||||
|
static const int FLAG_NEEDS_OPENGL = 0x0001;
|
||||||
|
|
||||||
|
/* SDL 1.2 flags */
|
||||||
|
static const int FLAG_NEEDS_DOUBLEBUF = 0x0100;
|
||||||
|
static const int FLAG_NEEDS_ASYNCBLIT = 0x0200;
|
||||||
|
|
||||||
|
osd_renderer(win_window_info *window, const int flags)
|
||||||
|
: m_window(window), m_flags(flags) { }
|
||||||
|
|
||||||
|
virtual ~osd_renderer() { }
|
||||||
|
|
||||||
|
win_window_info &window() { return *m_window; }
|
||||||
|
int flags() const { return m_flags; }
|
||||||
|
bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
|
||||||
|
|
||||||
|
virtual int init() = 0;
|
||||||
|
virtual render_primitive_list *get_primitives() = 0;
|
||||||
|
virtual int draw(HDC dc, int update) = 0;
|
||||||
|
virtual void save() = 0;
|
||||||
|
virtual void record() = 0;
|
||||||
|
virtual void toggle_fsfx() = 0;
|
||||||
|
virtual void destroy() = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
win_window_info *m_window;
|
||||||
|
int m_flags;
|
||||||
|
};
|
||||||
|
|
||||||
class win_window_info
|
class win_window_info
|
||||||
{
|
{
|
||||||
@ -85,40 +119,6 @@ private:
|
|||||||
running_machine & m_machine;
|
running_machine & m_machine;
|
||||||
};
|
};
|
||||||
|
|
||||||
class osd_renderer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
/* Generic flags */
|
|
||||||
static const int FLAG_NONE = 0x0000;
|
|
||||||
static const int FLAG_NEEDS_OPENGL = 0x0001;
|
|
||||||
|
|
||||||
/* SDL 1.2 flags */
|
|
||||||
static const int FLAG_NEEDS_DOUBLEBUF = 0x0100;
|
|
||||||
static const int FLAG_NEEDS_ASYNCBLIT = 0x0200;
|
|
||||||
|
|
||||||
osd_renderer(win_window_info *window, const int flags)
|
|
||||||
: m_window(window), m_flags(flags) { }
|
|
||||||
|
|
||||||
virtual ~osd_renderer() { }
|
|
||||||
|
|
||||||
win_window_info &window() { return *m_window; }
|
|
||||||
int flags() const { return m_flags; }
|
|
||||||
bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
|
|
||||||
|
|
||||||
virtual int init() = 0;
|
|
||||||
virtual render_primitive_list *get_primitives() = 0;
|
|
||||||
virtual int draw(HDC dc, int update) = 0;
|
|
||||||
virtual void save() = 0;
|
|
||||||
virtual void record() = 0;
|
|
||||||
virtual void toggle_fsfx() = 0;
|
|
||||||
virtual void destroy() = 0;
|
|
||||||
|
|
||||||
private:
|
|
||||||
win_window_info *m_window;
|
|
||||||
int m_flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct osd_draw_callbacks
|
struct osd_draw_callbacks
|
||||||
{
|
{
|
||||||
osd_renderer *(*create)(win_window_info *window);
|
osd_renderer *(*create)(win_window_info *window);
|
||||||
|
Loading…
Reference in New Issue
Block a user