trunk/src/osd/modules/osdwindow.h
| r0 | r243788 | |
| 1 | //============================================================ |
| 2 | // |
| 3 | // osdwindow.h - SDL window handling |
| 4 | // |
| 5 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | // |
| 8 | //============================================================ |
| 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 | #ifndef __OSDWINDOW__ |
| 14 | #define __OSDWINDOW__ |
| 15 | |
| 16 | #include "render.h" |
| 17 | |
| 18 | |
| 19 | class osd_window_config |
| 20 | { |
| 21 | public: |
| 22 | int width; |
| 23 | int height; |
| 24 | int depth; |
| 25 | int refresh; |
| 26 | }; |
| 27 | |
| 28 | |
| 29 | class osd_window |
| 30 | { |
| 31 | public: |
| 32 | virtual void get_size(int &w, int &h) = 0; |
| 33 | |
| 34 | virtual running_machine &machine() const = 0; |
| 35 | |
| 36 | virtual render_target *target() = 0; |
| 37 | #if (SDLMAME_SDL2) |
| 38 | virtual SDL_Window *sdl_window() = 0; |
| 39 | #else |
| 40 | virtual SDL_Surface *sdl_surface() = 0; |
| 41 | #endif |
| 42 | |
| 43 | virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0; |
| 44 | virtual int prescale() const = 0; |
| 45 | virtual float aspect() const { return 0; } |
| 46 | |
| 47 | render_primitive_list *m_primlist; |
| 48 | |
| 49 | protected: |
| 50 | osd_window_config m_win_config; |
| 51 | int m_prescale; |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | class osd_renderer |
| 56 | { |
| 57 | 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 | |
| 66 | void notify_changed(); |
| 67 | |
| 68 | virtual int create() = 0; |
| 69 | virtual int draw(const int update) = 0; |
| 70 | virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0; |
| 71 | virtual void destroy() = 0; |
| 72 | virtual render_primitive_list *get_primitives() = 0; |
| 73 | |
| 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 | protected: |
| 79 | enum |
| 80 | { |
| 81 | FI_CHANGED = 16 |
| 82 | }; |
| 83 | |
| 84 | osd_renderer(osd_window *w, int extra_flags) : |
| 85 | m_window(*w), |
| 86 | m_flags(extra_flags) |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | osd_window &window() const { return m_window; } |
| 91 | |
| 92 | private: |
| 93 | osd_window &m_window; |
| 94 | int m_flags; |
| 95 | }; |
| 96 | |
| 97 | inline void osd_renderer::notify_changed() { set_flags(FI_CHANGED); } |
| 98 | |
| 99 | #endif |
| | No newline at end of file |