mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +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)
|
||||
{}
|
||||
|
||||
/* virtual */ int create(const int width, const int height);
|
||||
/* virtual */ int create();
|
||||
/* 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 */ void destroy_all_textures();
|
||||
@ -572,7 +572,7 @@ static void drawsdl2_exit(void)
|
||||
// a
|
||||
//============================================================
|
||||
|
||||
int sdl_info13::create(int width, int height)
|
||||
int sdl_info13::create()
|
||||
{
|
||||
#if (SDLMAME_SDL2)
|
||||
// create renderer
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
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 xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
||||
/* virtual */ void destroy_all_textures();
|
||||
@ -134,7 +134,7 @@ int drawbgfx_init(running_machine &machine, sdl_draw_info *callbacks)
|
||||
// sdl_info_bgfx::create
|
||||
//============================================================
|
||||
|
||||
int sdl_info_bgfx::create(int width, int height)
|
||||
int sdl_info_bgfx::create()
|
||||
{
|
||||
// create renderer
|
||||
|
||||
|
@ -252,7 +252,7 @@ public:
|
||||
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 xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
||||
/* virtual */ void destroy_all_textures();
|
||||
@ -711,7 +711,7 @@ void sdl_info_ogl::initialize_gl()
|
||||
// a
|
||||
//============================================================
|
||||
|
||||
int sdl_info_ogl::create(int width, int height)
|
||||
int sdl_info_ogl::create()
|
||||
{
|
||||
|
||||
#if (SDLMAME_SDL2)
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
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 xy_to_render_target(const int x, const int y, int *xt, int *yt);
|
||||
/* virtual */ void destroy_all_textures();
|
||||
@ -419,7 +419,7 @@ static void drawsdl_show_info(struct SDL_RendererInfo *render_info)
|
||||
// a
|
||||
//============================================================
|
||||
|
||||
int sdl_info::create(int width, int height)
|
||||
int sdl_info::create()
|
||||
{
|
||||
|
||||
#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
|
||||
#endif
|
||||
|
||||
|
@ -708,7 +708,7 @@ void sdl_window_info::update_cursor_state()
|
||||
#endif
|
||||
}
|
||||
|
||||
static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
|
||||
OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt )
|
||||
{
|
||||
worker_param * wp = (worker_param *) param;
|
||||
sdl_window_info * window = wp->window();
|
||||
@ -1020,7 +1020,7 @@ void sdl_window_info::update()
|
||||
// adjust the cursor state
|
||||
//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 (m_target != NULL)
|
||||
@ -1276,7 +1276,7 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
|
||||
#endif
|
||||
|
||||
// initialize the drawing backend
|
||||
if (window->renderer().create(window->width(), window->height()))
|
||||
if (window->renderer().create())
|
||||
return (void *) &result[1];
|
||||
|
||||
// Make sure we have a consistent state
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
int flags() const { return m_flags; }
|
||||
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 xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
|
||||
virtual void destroy_all_textures() = 0;
|
||||
@ -115,33 +115,21 @@ public:
|
||||
}
|
||||
|
||||
int window_init();
|
||||
void destroy();
|
||||
|
||||
void update();
|
||||
void toggle_full_screen();
|
||||
void modify_prescale(int dir);
|
||||
void resize(INT32 width, INT32 height);
|
||||
void destroy();
|
||||
void clear();
|
||||
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; }
|
||||
sdl_monitor_info *monitor() const { return m_monitor; }
|
||||
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; }
|
||||
|
||||
|
||||
|
||||
render_target *target() { return m_target; }
|
||||
#if (SDLMAME_SDL2)
|
||||
SDL_Window *sdl_window() { return m_sdl_window; }
|
||||
@ -171,15 +159,15 @@ public:
|
||||
private:
|
||||
// window handle and info
|
||||
char m_title[256];
|
||||
int m_startmaximized;
|
||||
|
||||
// diverse flags
|
||||
int m_minwidth, m_minheight;
|
||||
int m_maxwidth, m_maxheight;
|
||||
int m_depth;
|
||||
int m_refresh;
|
||||
int m_depth;
|
||||
int m_windowed_width;
|
||||
int m_windowed_height;
|
||||
int m_startmaximized;
|
||||
|
||||
// rendering info
|
||||
osd_event * m_rendered_event;
|
||||
@ -218,6 +206,16 @@ protected:
|
||||
osd_renderer &renderer() { return *m_renderer; }
|
||||
private:
|
||||
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
|
||||
running_machine & m_machine;
|
||||
@ -235,6 +233,7 @@ private:
|
||||
static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt );
|
||||
static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt );
|
||||
static OSDWORK_CALLBACK( destroy_all_textures_wt );
|
||||
static OSDWORK_CALLBACK( update_cursor_state_wt );
|
||||
|
||||
void measure_fps(UINT32 dc, int update);
|
||||
|
||||
|
@ -32,7 +32,41 @@
|
||||
// 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
|
||||
{
|
||||
@ -85,40 +119,6 @@ private:
|
||||
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
|
||||
{
|
||||
osd_renderer *(*create)(win_window_info *window);
|
||||
|
Loading…
Reference in New Issue
Block a user