trunk/src/osd/modules/osdwindow.h
| r243788 | r243789 | |
| 7 | 7 | // |
| 8 | 8 | //============================================================ |
| 9 | 9 | |
| 10 | | // There is no way this code is correct or sensible - it just gets it to build on OSX |
| 11 | | // Wait for official fix from couriersud |
| 12 | | |
| 13 | 10 | #ifndef __OSDWINDOW__ |
| 14 | 11 | #define __OSDWINDOW__ |
| 15 | 12 | |
| 13 | #include "video.h" |
| 16 | 14 | #include "render.h" |
| 17 | 15 | |
| 16 | //============================================================ |
| 17 | // TYPE DEFINITIONS |
| 18 | //============================================================ |
| 18 | 19 | |
| 19 | 20 | class osd_window_config |
| 20 | 21 | { |
| 21 | 22 | public: |
| 22 | | int width; |
| 23 | | int height; |
| 24 | | int depth; |
| 25 | | int refresh; |
| 23 | osd_window_config() : aspect(0.0f), width(0), height(0), depth(0), refresh(0) {} |
| 24 | |
| 25 | float aspect; // decoded aspect ratio FIXME: not used on windows |
| 26 | int width; // decoded width |
| 27 | int height; // decoded height |
| 28 | int depth; // decoded depth - only SDL |
| 29 | int refresh; // decoded refresh |
| 26 | 30 | }; |
| 27 | 31 | |
| 28 | | |
| 29 | 32 | class osd_window |
| 30 | 33 | { |
| 31 | 34 | public: |
| 32 | | virtual void get_size(int &w, int &h) = 0; |
| 35 | osd_window() |
| 36 | : |
| 37 | #ifdef OSD_SDL |
| 38 | #else |
| 39 | m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0), |
| 40 | #endif |
| 41 | m_primlist(NULL), |
| 42 | m_prescale(1) |
| 43 | {} |
| 44 | virtual ~osd_window() { } |
| 33 | 45 | |
| 46 | virtual render_target *target() = 0; |
| 47 | virtual int fullscreen() const = 0; |
| 34 | 48 | virtual running_machine &machine() const = 0; |
| 35 | 49 | |
| 36 | | virtual render_target *target() = 0; |
| 50 | int prescale() const { return m_prescale; }; |
| 51 | |
| 52 | float aspect() const { return monitor()->aspect(); } |
| 53 | |
| 54 | virtual void get_size(int &w, int &h) = 0; |
| 55 | |
| 56 | #ifdef OSD_SDL |
| 57 | virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0; |
| 58 | virtual sdl_monitor_info *monitor() const = 0; |
| 37 | 59 | #if (SDLMAME_SDL2) |
| 38 | 60 | virtual SDL_Window *sdl_window() = 0; |
| 39 | 61 | #else |
| 40 | 62 | virtual SDL_Surface *sdl_surface() = 0; |
| 41 | 63 | #endif |
| 64 | #else |
| 65 | virtual win_monitor_info *monitor() const = 0; |
| 66 | virtual bool win_has_menu() = 0; |
| 67 | // FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ? |
| 68 | virtual win_monitor_info *winwindow_video_window_monitor(const RECT *proposed) = 0; |
| 42 | 69 | |
| 43 | | virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0; |
| 44 | | virtual int prescale() const = 0; |
| 45 | | virtual float aspect() const { return 0; } |
| 70 | // window handle and info |
| 71 | HWND m_hwnd; |
| 72 | HDC m_dc; // only used by GDI renderer! |
| 73 | // FIXME: this is the same as win_window_list->m_hwnd, i.e. first window. |
| 74 | // During modularization, this should be passed in differently |
| 75 | HWND m_focus_hwnd; |
| 46 | 76 | |
| 47 | | render_primitive_list *m_primlist; |
| 77 | int m_resize_state; |
| 78 | #endif |
| 48 | 79 | |
| 80 | render_primitive_list *m_primlist; |
| 81 | osd_window_config m_win_config; |
| 49 | 82 | protected: |
| 50 | | osd_window_config m_win_config; |
| 51 | 83 | int m_prescale; |
| 52 | 84 | }; |
| 53 | 85 | |
| 54 | | |
| 55 | 86 | class osd_renderer |
| 56 | 87 | { |
| 57 | 88 | public: |
| 58 | | enum |
| 59 | | { |
| 60 | | FLAG_NEEDS_DOUBLEBUF = 1, |
| 61 | | FLAG_NEEDS_ASYNCBLIT = 2, |
| 62 | | FLAG_NEEDS_OPENGL = 4, |
| 63 | | FLAG_HAS_VECTOR_SCREEN = 8 |
| 64 | | }; |
| 65 | 89 | |
| 66 | | void notify_changed(); |
| 90 | /* Generic flags */ |
| 91 | static const int FLAG_NONE = 0x0000; |
| 92 | static const int FLAG_NEEDS_OPENGL = 0x0001; |
| 93 | static const int FLAG_HAS_VECTOR_SCREEN = 0x0002; |
| 67 | 94 | |
| 95 | /* SDL 1.2 flags */ |
| 96 | static const int FLAG_NEEDS_DOUBLEBUF = 0x0100; |
| 97 | static const int FLAG_NEEDS_ASYNCBLIT = 0x0200; |
| 98 | |
| 99 | osd_renderer(osd_window *window, const int flags) |
| 100 | : m_window(window), m_flags(flags) { } |
| 101 | |
| 102 | virtual ~osd_renderer() { } |
| 103 | |
| 104 | osd_window &window() { return *m_window; } |
| 105 | bool has_flags(const int flag) { return ((m_flags & flag)) == flag; } |
| 106 | void set_flags(int aflag) { m_flags |= aflag; } |
| 107 | void clear_flags(int aflag) { m_flags &= ~aflag; } |
| 108 | |
| 109 | void notify_changed() { set_flags(FI_CHANGED); } |
| 110 | |
| 111 | /* Interface to be implemented by render code */ |
| 112 | |
| 68 | 113 | virtual int create() = 0; |
| 114 | virtual render_primitive_list *get_primitives() = 0; |
| 115 | |
| 69 | 116 | virtual int draw(const int update) = 0; |
| 117 | #ifdef OSD_SDL |
| 70 | 118 | virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0; |
| 119 | #else |
| 120 | virtual void save() = 0; |
| 121 | virtual void record() = 0; |
| 122 | virtual void toggle_fsfx() = 0; |
| 123 | #endif |
| 124 | |
| 71 | 125 | virtual void destroy() = 0; |
| 72 | | virtual render_primitive_list *get_primitives() = 0; |
| 73 | 126 | |
| 74 | | bool has_flags(int f) const { return (m_flags & f) == f; } |
| 75 | | void set_flags(int f) { m_flags |= f; } |
| 76 | | void clear_flags(int f) { m_flags &= ~f; } |
| 77 | | |
| 78 | 127 | protected: |
| 79 | | enum |
| 80 | | { |
| 81 | | FI_CHANGED = 16 |
| 82 | | }; |
| 128 | /* Internal flags */ |
| 129 | static const int FI_CHANGED = 0x010000; |
| 83 | 130 | |
| 84 | | osd_renderer(osd_window *w, int extra_flags) : |
| 85 | | m_window(*w), |
| 86 | | m_flags(extra_flags) |
| 87 | | { |
| 88 | | } |
| 131 | private: |
| 89 | 132 | |
| 90 | | osd_window &window() const { return m_window; } |
| 91 | | |
| 92 | | private: |
| 93 | | osd_window &m_window; |
| 133 | osd_window *m_window; |
| 94 | 134 | int m_flags; |
| 95 | 135 | }; |
| 96 | 136 | |
| 97 | | inline void osd_renderer::notify_changed() { set_flags(FI_CHANGED); } |
| 98 | 137 | |
| 99 | | #endif |
| | No newline at end of file |
| 138 | #endif /* __OSDWINDOW__ */ |