Previous 199869 Revisions Next

r35277 Thursday 26th February, 2015 at 07:26:58 UTC by Couriersud
Fix other builds. Still fighting a bit with eGit. (nw)
[src/osd/modules]osdwindow.h

trunk/src/osd/modules/osdwindow.h
r243788r243789
77//
88//============================================================
99
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
1310#ifndef __OSDWINDOW__
1411#define __OSDWINDOW__
1512
13#include "video.h"
1614#include "render.h"
1715
16//============================================================
17//  TYPE DEFINITIONS
18//============================================================
1819
1920class osd_window_config
2021{
2122public:
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
2630};
2731
28
2932class osd_window
3033{
3134public:
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() { }
3345
46   virtual render_target *target() = 0;
47   virtual int fullscreen() const = 0;
3448   virtual running_machine &machine() const = 0;
3549
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;
3759#if (SDLMAME_SDL2)
3860   virtual SDL_Window *sdl_window() = 0;
3961#else
4062   virtual SDL_Surface *sdl_surface() = 0;
4163#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;
4269
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;
4676
47   render_primitive_list   *m_primlist;
77   int                     m_resize_state;
78#endif
4879
80   render_primitive_list   *m_primlist;
81   osd_window_config      m_win_config;
4982protected:
50   osd_window_config      m_win_config;
5183   int                  m_prescale;
5284};
5385
54
5586class osd_renderer
5687{
5788public:
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   };
6589
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;
6794
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
68113   virtual int create() = 0;
114   virtual render_primitive_list *get_primitives() = 0;
115
69116   virtual int draw(const int update) = 0;
117#ifdef OSD_SDL
70118   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
71125   virtual void destroy() = 0;
72   virtual render_primitive_list *get_primitives() = 0;
73126
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
78127protected:
79   enum
80   {
81      FI_CHANGED            = 16
82   };
128   /* Internal flags */
129   static const int FI_CHANGED                 = 0x010000;
83130
84   osd_renderer(osd_window *w, int extra_flags) :
85      m_window(*w),
86      m_flags(extra_flags)
87   {
88   }
131private:
89132
90   osd_window &window() const { return m_window; }
91
92private:
93   osd_window   &m_window;
133   osd_window      *m_window;
94134   int         m_flags;
95135};
96136
97inline void osd_renderer::notify_changed() { set_flags(FI_CHANGED); }
98137
99#endif
No newline at end of file
138#endif /* __OSDWINDOW__ */


Previous 199869 Revisions Next


© 1997-2024 The MAME Team