summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/sdl/window.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/sdl/window.h')
-rw-r--r--src/osd/sdl/window.h83
1 files changed, 66 insertions, 17 deletions
diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h
index 3314e005d1d..39f518eab09 100644
--- a/src/osd/sdl/window.h
+++ b/src/osd/sdl/window.h
@@ -34,12 +34,62 @@ typedef UINT32 HashT;
struct sdl_window_info
{
- // Pointer to next window
+
+ sdl_window_info(running_machine *a_machine, sdl_monitor_info *a_monitor,
+ int index, const sdl_window_config *config)
+ : next(NULL), m_minwidth(0), m_minheight(0),
+ startmaximized(0),
+ rendered_event(0), target(0), primlist(NULL), dxdata(NULL),
+ width(0), height(0), blitwidth(0), blitheight(0),
+ start_viewscreen(0),
+#if (SDLMAME_SDL2)
+ sdl_window(NULL),
+ resize_width(0),
+ resize_height(0),
+ last_resize(0),
+#else
+ screen_width(0), screen_height(0),
+#endif
+ m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0), m_index(0)
+ {
+ m_maxwidth = config->width;
+ m_maxheight = config->height;
+ depth = config->depth;
+ refresh = config->refresh;
+ m_index = index;
+
+ //FIXME: these should be per_window in config-> or even better a bit set
+ m_fullscreen = !video_config.windowed;
+ prescale = video_config.prescale;
+
+ if (!m_fullscreen)
+ {
+ windowed_width = config->width;
+ windowed_height = config->height;
+ }
+ }
+
+ void video_window_update(running_machine &machine);
+ void blit_surface_size(int window_width, int window_height);
+ void toggle_full_screen(running_machine &machine);
+ void modify_prescale(running_machine &machine, int dir);
+ void window_resize(INT32 width, INT32 height);
+ void window_clear();
+
+ void video_window_destroy(running_machine &machine);
+ void pick_best_mode(int *fswidth, int *fsheight);
+ void get_min_bounds(int *window_width, int *window_height, int constrain);
+ void get_max_bounds(int *window_width, int *window_height, int constrain);
+
+ // Pointer to next window
sdl_window_info * next;
- // Pointer to machine
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
- running_machine * m_machine;
+ sdl_monitor_info *monitor() const { return m_monitor; }
+ int fullscreen() const { return m_fullscreen; }
+ int index() const { return m_index; }
+
+ void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
// Draw Callbacks
int (*create)(sdl_window_info *window, int width, int height);
@@ -54,14 +104,9 @@ struct sdl_window_info
// window handle and info
char title[256];
- // monitor info
- sdl_monitor_info * monitor;
- int fullscreen;
- int index;
-
// diverse flags
- int minwidth, minheight;
- int maxwidth, maxheight;
+ int m_minwidth, m_minheight;
+ int m_maxwidth, m_maxheight;
int depth;
int refresh;
int windowed_width;
@@ -100,6 +145,17 @@ struct sdl_window_info
int screen_width;
int screen_height;
#endif
+
+private:
+ void constrain_to_aspect_ratio(int *window_width, int *window_height, int adjustment);
+
+ // Pointer to machine
+ running_machine * m_machine;
+ // monitor info
+ sdl_monitor_info * m_monitor;
+ int m_fullscreen;
+ int m_index;
+
};
struct sdl_draw_info
@@ -121,13 +177,6 @@ extern sdl_window_info *sdl_window_list;
// creation/deletion of windows
int sdlwindow_video_window_create(running_machine &machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config);
-void sdlwindow_video_window_update(running_machine &machine, sdl_window_info *window);
-void sdlwindow_blit_surface_size(sdl_window_info *window, int window_width, int window_height);
-void sdlwindow_toggle_full_screen(running_machine &machine, sdl_window_info *window);
-void sdlwindow_modify_prescale(running_machine &machine, sdl_window_info *window, int dir);
-void sdlwindow_resize(sdl_window_info *window, INT32 width, INT32 height);
-void sdlwindow_clear(sdl_window_info *window);
-
//============================================================
// PROTOTYPES - drawsdl.c