Previous 199869 Revisions Next

r34882 Friday 6th February, 2015 at 01:20:19 UTC by Couriersud
A bit more alignment between windows and sdl. (nw)
[src/osd/sdl]draw13.c drawbgfx.c drawogl.c drawsdl.c window.c window.h
[src/osd/windows]window.h

trunk/src/osd/sdl/draw13.c
r243393r243394
149149      m_last_blit_time(0), m_last_blit_pixels(0)
150150    {}
151151
152   /* virtual */ int create(const int width, const int height);
152   /* virtual */ int create();
153153   /* virtual */ int draw(const UINT32 dc, const int update);
154154   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
155155   /* virtual */ void destroy_all_textures();
r243393r243394
572572// a
573573//============================================================
574574
575int sdl_info13::create(int width, int height)
575int sdl_info13::create()
576576{
577577#if (SDLMAME_SDL2)
578578   // create renderer
trunk/src/osd/sdl/drawbgfx.c
r243393r243394
7979      m_last_blit_time(0), m_last_blit_pixels(0)
8080    {}
8181
82   /* virtual */ int create(const int width, const int height);
82   /* virtual */ int create();
8383   /* virtual */ int draw(const UINT32 dc, const int update);
8484   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
8585   /* virtual */ void destroy_all_textures();
r243393r243394
134134//  sdl_info_bgfx::create
135135//============================================================
136136
137int sdl_info_bgfx::create(int width, int height)
137int sdl_info_bgfx::create()
138138{
139139   // create renderer
140140
trunk/src/osd/sdl/drawogl.c
r243393r243394
252252         m_texVerticex[i] = 0.0f;
253253   }
254254
255   /* virtual */ int create(const int width, const int height);
255   /* virtual */ int create();
256256   /* virtual */ int draw(const UINT32 dc, const int update);
257257   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
258258   /* virtual */ void destroy_all_textures();
r243393r243394
711711// a
712712//============================================================
713713
714int sdl_info_ogl::create(int width, int height)
714int sdl_info_ogl::create()
715715{
716716
717717#if (SDLMAME_SDL2)
trunk/src/osd/sdl/drawsdl.c
r243393r243394
7070   m_last_height(0)
7171   { }
7272
73   /* virtual */ int create(const int width, const int height);
73   /* virtual */ int create();
7474   /* virtual */ int draw(const UINT32 dc, const int update);
7575   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
7676   /* virtual */ void destroy_all_textures();
r243393r243394
419419// a
420420//============================================================
421421
422int sdl_info::create(int width, int height)
422int sdl_info::create()
423423{
424424
425425#if (SDLMAME_SDL2)
r243393r243394
465465      }
466466   }
467467
468   setup_texture(width, height);
468   setup_texture(window().width(), window().height());
469469#else
470470#endif
471471
trunk/src/osd/sdl/window.c
r243393r243394
708708#endif
709709}
710710
711static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
711OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt )
712712{
713713   worker_param *      wp = (worker_param *) param;
714714   sdl_window_info *   window = wp->window();
r243393r243394
10201020   // adjust the cursor state
10211021   //sdlwindow_update_cursor_state(machine, window);
10221022
1023   execute_async(&sdlwindow_update_cursor_state_wt, worker_param(this));
1023   execute_async(&update_cursor_state_wt, worker_param(this));
10241024
10251025   // if we're visible and running and not in the middle of a resize, draw
10261026   if (m_target != NULL)
r243393r243394
12761276#endif
12771277
12781278   // initialize the drawing backend
1279   if (window->renderer().create(window->width(), window->height()))
1279   if (window->renderer().create())
12801280      return (void *) &result[1];
12811281
12821282   // Make sure we have a consistent state
trunk/src/osd/sdl/window.h
r243393r243394
5757   int flags() const { return m_flags; }
5858   bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
5959
60   virtual int create(const int width, const int height) = 0;
60   virtual int create() = 0;
6161   virtual int draw(const UINT32 dc, const int update) = 0;
6262   virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
6363   virtual void destroy_all_textures() = 0;
r243393r243394
115115   }
116116
117117   int window_init();
118   void destroy();
119118
120119   void update();
121120   void toggle_full_screen();
122121   void modify_prescale(int dir);
123122   void resize(INT32 width, INT32 height);
123   void destroy();
124124   void clear();
125125   int xy_to_render_target(int x, int y, int *xt, int *yt);
126126
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
130127   running_machine &machine() const { return m_machine; }
131128   sdl_monitor_info *monitor() const { return m_monitor; }
132129   int fullscreen() const { return m_fullscreen; }
133130
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
141131   int index() const { return m_index; }
142132
143
144
145133   render_target *target() { return m_target; }
146134#if (SDLMAME_SDL2)
147135   SDL_Window *sdl_window() { return m_sdl_window; }
r243393r243394
171159private:
172160   // window handle and info
173161   char                m_title[256];
162   int                 m_startmaximized;
174163
175164   // diverse flags
176165   int                 m_minwidth, m_minheight;
177166   int                 m_maxwidth, m_maxheight;
178   int                 m_depth;
179167   int                 m_refresh;
168   int                 m_depth;
180169   int                 m_windowed_width;
181170   int                 m_windowed_height;
182   int                 m_startmaximized;
183171
184172   // rendering info
185173   osd_event *         m_rendered_event;
r243393r243394
218206   osd_renderer &renderer() { return *m_renderer; }
219207private:
220208   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; }
221216
217
218
219
222220   // Pointer to machine
223221   running_machine &   m_machine;
224222   // monitor info
r243393r243394
235233   static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt );
236234   static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt );
237235   static OSDWORK_CALLBACK( destroy_all_textures_wt );
236   static OSDWORK_CALLBACK( update_cursor_state_wt );
238237
239238   void measure_fps(UINT32 dc, int update);
240239
trunk/src/osd/windows/window.h
r243393r243394
3232//  TYPE DEFINITIONS
3333//============================================================
3434
35class osd_renderer;
35class win_window_info;
3636
37class osd_renderer
38{
39public:
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
66private:
67   win_window_info *m_window;
68   int m_flags;
69};
70
3771class win_window_info
3872{
3973public:
r243393r243394
85119   running_machine &   m_machine;
86120};
87121
88class osd_renderer
89{
90public:
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
117private:
118   win_window_info *m_window;
119   int m_flags;
120};
121
122122struct osd_draw_callbacks
123123{
124124   osd_renderer *(*create)(win_window_info *window);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team