trunk/src/osd/sdl/drawbgfx.c
| r243393 | r243394 | |
| 79 | 79 | m_last_blit_time(0), m_last_blit_pixels(0) |
| 80 | 80 | {} |
| 81 | 81 | |
| 82 | | /* virtual */ int create(const int width, const int height); |
| 82 | /* virtual */ int create(); |
| 83 | 83 | /* virtual */ int draw(const UINT32 dc, const int update); |
| 84 | 84 | /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); |
| 85 | 85 | /* virtual */ void destroy_all_textures(); |
| r243393 | r243394 | |
| 134 | 134 | // sdl_info_bgfx::create |
| 135 | 135 | //============================================================ |
| 136 | 136 | |
| 137 | | int sdl_info_bgfx::create(int width, int height) |
| 137 | int sdl_info_bgfx::create() |
| 138 | 138 | { |
| 139 | 139 | // create renderer |
| 140 | 140 | |
trunk/src/osd/sdl/drawsdl.c
| r243393 | r243394 | |
| 70 | 70 | m_last_height(0) |
| 71 | 71 | { } |
| 72 | 72 | |
| 73 | | /* virtual */ int create(const int width, const int height); |
| 73 | /* virtual */ int create(); |
| 74 | 74 | /* virtual */ int draw(const UINT32 dc, const int update); |
| 75 | 75 | /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); |
| 76 | 76 | /* virtual */ void destroy_all_textures(); |
| r243393 | r243394 | |
| 419 | 419 | // a |
| 420 | 420 | //============================================================ |
| 421 | 421 | |
| 422 | | int sdl_info::create(int width, int height) |
| 422 | int sdl_info::create() |
| 423 | 423 | { |
| 424 | 424 | |
| 425 | 425 | #if (SDLMAME_SDL2) |
| r243393 | r243394 | |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | | setup_texture(width, height); |
| 468 | setup_texture(window().width(), window().height()); |
| 469 | 469 | #else |
| 470 | 470 | #endif |
| 471 | 471 | |
trunk/src/osd/sdl/window.c
| r243393 | r243394 | |
| 708 | 708 | #endif |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | | static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt ) |
| 711 | OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt ) |
| 712 | 712 | { |
| 713 | 713 | worker_param * wp = (worker_param *) param; |
| 714 | 714 | sdl_window_info * window = wp->window(); |
| r243393 | r243394 | |
| 1020 | 1020 | // adjust the cursor state |
| 1021 | 1021 | //sdlwindow_update_cursor_state(machine, window); |
| 1022 | 1022 | |
| 1023 | | execute_async(&sdlwindow_update_cursor_state_wt, worker_param(this)); |
| 1023 | execute_async(&update_cursor_state_wt, worker_param(this)); |
| 1024 | 1024 | |
| 1025 | 1025 | // if we're visible and running and not in the middle of a resize, draw |
| 1026 | 1026 | if (m_target != NULL) |
| r243393 | r243394 | |
| 1276 | 1276 | #endif |
| 1277 | 1277 | |
| 1278 | 1278 | // initialize the drawing backend |
| 1279 | | if (window->renderer().create(window->width(), window->height())) |
| 1279 | if (window->renderer().create()) |
| 1280 | 1280 | return (void *) &result[1]; |
| 1281 | 1281 | |
| 1282 | 1282 | // Make sure we have a consistent state |
trunk/src/osd/sdl/window.h
| r243393 | r243394 | |
| 57 | 57 | int flags() const { return m_flags; } |
| 58 | 58 | bool check_flag(const int flag) { return ((m_flags & flag)) == flag; } |
| 59 | 59 | |
| 60 | | virtual int create(const int width, const int height) = 0; |
| 60 | virtual int create() = 0; |
| 61 | 61 | virtual int draw(const UINT32 dc, const int update) = 0; |
| 62 | 62 | virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0; |
| 63 | 63 | virtual void destroy_all_textures() = 0; |
| r243393 | r243394 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | int window_init(); |
| 118 | | void destroy(); |
| 119 | 118 | |
| 120 | 119 | void update(); |
| 121 | 120 | void toggle_full_screen(); |
| 122 | 121 | void modify_prescale(int dir); |
| 123 | 122 | void resize(INT32 width, INT32 height); |
| 123 | void destroy(); |
| 124 | 124 | void clear(); |
| 125 | 125 | int xy_to_render_target(int x, int y, int *xt, int *yt); |
| 126 | 126 | |
| 127 | | void get_min_bounds(int *window_width, int *window_height, int constrain); |
| 128 | | void get_max_bounds(int *window_width, int *window_height, int constrain); |
| 129 | | |
| 130 | 127 | running_machine &machine() const { return m_machine; } |
| 131 | 128 | sdl_monitor_info *monitor() const { return m_monitor; } |
| 132 | 129 | int fullscreen() const { return m_fullscreen; } |
| 133 | 130 | |
| 134 | | void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; } |
| 135 | | void update_cursor_state(); |
| 136 | | |
| 137 | | void blit_surface_size(int window_width, int window_height); |
| 138 | | void pick_best_mode(int *fswidth, int *fsheight); |
| 139 | | void set_starting_view(running_machine &machine, int index, const char *defview, const char *view); |
| 140 | | |
| 141 | 131 | int index() const { return m_index; } |
| 142 | 132 | |
| 143 | | |
| 144 | | |
| 145 | 133 | render_target *target() { return m_target; } |
| 146 | 134 | #if (SDLMAME_SDL2) |
| 147 | 135 | SDL_Window *sdl_window() { return m_sdl_window; } |
| r243393 | r243394 | |
| 171 | 159 | private: |
| 172 | 160 | // window handle and info |
| 173 | 161 | char m_title[256]; |
| 162 | int m_startmaximized; |
| 174 | 163 | |
| 175 | 164 | // diverse flags |
| 176 | 165 | int m_minwidth, m_minheight; |
| 177 | 166 | int m_maxwidth, m_maxheight; |
| 178 | | int m_depth; |
| 179 | 167 | int m_refresh; |
| 168 | int m_depth; |
| 180 | 169 | int m_windowed_width; |
| 181 | 170 | int m_windowed_height; |
| 182 | | int m_startmaximized; |
| 183 | 171 | |
| 184 | 172 | // rendering info |
| 185 | 173 | osd_event * m_rendered_event; |
| r243393 | r243394 | |
| 218 | 206 | osd_renderer &renderer() { return *m_renderer; } |
| 219 | 207 | private: |
| 220 | 208 | void constrain_to_aspect_ratio(int *window_width, int *window_height, int adjustment); |
| 209 | void update_cursor_state(); |
| 210 | void blit_surface_size(int window_width, int window_height); |
| 211 | void pick_best_mode(int *fswidth, int *fsheight); |
| 212 | void set_starting_view(running_machine &machine, int index, const char *defview, const char *view); |
| 213 | void get_min_bounds(int *window_width, int *window_height, int constrain); |
| 214 | void get_max_bounds(int *window_width, int *window_height, int constrain); |
| 215 | void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; } |
| 221 | 216 | |
| 217 | |
| 218 | |
| 219 | |
| 222 | 220 | // Pointer to machine |
| 223 | 221 | running_machine & m_machine; |
| 224 | 222 | // monitor info |
| r243393 | r243394 | |
| 235 | 233 | static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt ); |
| 236 | 234 | static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt ); |
| 237 | 235 | static OSDWORK_CALLBACK( destroy_all_textures_wt ); |
| 236 | static OSDWORK_CALLBACK( update_cursor_state_wt ); |
| 238 | 237 | |
| 239 | 238 | void measure_fps(UINT32 dc, int update); |
| 240 | 239 | |
trunk/src/osd/windows/window.h
| r243393 | r243394 | |
| 32 | 32 | // TYPE DEFINITIONS |
| 33 | 33 | //============================================================ |
| 34 | 34 | |
| 35 | | class osd_renderer; |
| 35 | class win_window_info; |
| 36 | 36 | |
| 37 | class osd_renderer |
| 38 | { |
| 39 | public: |
| 40 | |
| 41 | /* Generic flags */ |
| 42 | static const int FLAG_NONE = 0x0000; |
| 43 | static const int FLAG_NEEDS_OPENGL = 0x0001; |
| 44 | |
| 45 | /* SDL 1.2 flags */ |
| 46 | static const int FLAG_NEEDS_DOUBLEBUF = 0x0100; |
| 47 | static const int FLAG_NEEDS_ASYNCBLIT = 0x0200; |
| 48 | |
| 49 | osd_renderer(win_window_info *window, const int flags) |
| 50 | : m_window(window), m_flags(flags) { } |
| 51 | |
| 52 | virtual ~osd_renderer() { } |
| 53 | |
| 54 | win_window_info &window() { return *m_window; } |
| 55 | int flags() const { return m_flags; } |
| 56 | bool check_flag(const int flag) { return ((m_flags & flag)) == flag; } |
| 57 | |
| 58 | virtual int init() = 0; |
| 59 | virtual render_primitive_list *get_primitives() = 0; |
| 60 | virtual int draw(HDC dc, int update) = 0; |
| 61 | virtual void save() = 0; |
| 62 | virtual void record() = 0; |
| 63 | virtual void toggle_fsfx() = 0; |
| 64 | virtual void destroy() = 0; |
| 65 | |
| 66 | private: |
| 67 | win_window_info *m_window; |
| 68 | int m_flags; |
| 69 | }; |
| 70 | |
| 37 | 71 | class win_window_info |
| 38 | 72 | { |
| 39 | 73 | public: |
| r243393 | r243394 | |
| 85 | 119 | running_machine & m_machine; |
| 86 | 120 | }; |
| 87 | 121 | |
| 88 | | class osd_renderer |
| 89 | | { |
| 90 | | public: |
| 91 | | |
| 92 | | /* Generic flags */ |
| 93 | | static const int FLAG_NONE = 0x0000; |
| 94 | | static const int FLAG_NEEDS_OPENGL = 0x0001; |
| 95 | | |
| 96 | | /* SDL 1.2 flags */ |
| 97 | | static const int FLAG_NEEDS_DOUBLEBUF = 0x0100; |
| 98 | | static const int FLAG_NEEDS_ASYNCBLIT = 0x0200; |
| 99 | | |
| 100 | | osd_renderer(win_window_info *window, const int flags) |
| 101 | | : m_window(window), m_flags(flags) { } |
| 102 | | |
| 103 | | virtual ~osd_renderer() { } |
| 104 | | |
| 105 | | win_window_info &window() { return *m_window; } |
| 106 | | int flags() const { return m_flags; } |
| 107 | | bool check_flag(const int flag) { return ((m_flags & flag)) == flag; } |
| 108 | | |
| 109 | | virtual int init() = 0; |
| 110 | | virtual render_primitive_list *get_primitives() = 0; |
| 111 | | virtual int draw(HDC dc, int update) = 0; |
| 112 | | virtual void save() = 0; |
| 113 | | virtual void record() = 0; |
| 114 | | virtual void toggle_fsfx() = 0; |
| 115 | | virtual void destroy() = 0; |
| 116 | | |
| 117 | | private: |
| 118 | | win_window_info *m_window; |
| 119 | | int m_flags; |
| 120 | | }; |
| 121 | | |
| 122 | 122 | struct osd_draw_callbacks |
| 123 | 123 | { |
| 124 | 124 | osd_renderer *(*create)(win_window_info *window); |