Previous 199869 Revisions Next

r34796 Sunday 1st February, 2015 at 14:28:19 UTC by Couriersud
Aligned code. Once done the window creation code should be in window.c
to avoid having near identical code in each render driver. (nw)
[src/osd/sdl]draw13.c drawogl.c drawsdl.c

trunk/src/osd/sdl/draw13.c
r243307r243308
144144public:
145145    sdl_info13(sdl_window_info *w)
146146    : osd_renderer(w), m_blittimer(0), m_renderer(NULL),
147      m_hofs(0), m_vofs(0),
147      m_last_hofs(0), m_last_vofs(0),
148148      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
149149      m_last_blit_time(0), m_last_blit_pixels(0)
150150    {}
r243307r243308
164164    texture_info *texture_update(const render_primitive &prim);
165165
166166   INT32           m_blittimer;
167   UINT32          m_extra_flags;
167168
168169   SDL_Renderer *  m_renderer;
169170   simple_list<texture_info>  m_texlist;                // list of active textures
170171
171   float           m_hofs;
172   float           m_vofs;
172   float           m_last_hofs;
173   float           m_last_vofs;
173174
174175   // resize information
175176
r243307r243308
556557}
557558
558559//============================================================
559//  sdl_info13::create
560//  sdl_info::create
561// a
562// a
563// a
564// a
565// a
566// a
567// a
568// a
569// a
570// a
571// a
572// a
573// a
574// a
575// a
576// a
577// a
578// a
579// a
580// a
581// a
582// a
583// a
584// a
585// a
586// a
560587//============================================================
561588
562589int sdl_info13::create(int width, int height)
r243307r243308
570597
571598   osd_printf_verbose("Enter sdl_info13::create\n");
572599
573   UINT32 extra_flags = (window().fullscreen() ?
600   // create the SDL window
601   m_extra_flags = (window().fullscreen() ?
574602         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
575603
576604#if defined(SDLMAME_WIN32)
r243307r243308
579607   // create the SDL window
580608   window().m_sdl_window = SDL_CreateWindow(window().m_title,
581609         window().monitor()->position_size().x, window().monitor()->position_size().y,
582         width, height, extra_flags);
610         width, height, m_extra_flags);
583611
612   if  (!window().m_sdl_window )
613   {
614      osd_printf_error("Window creation failed: %s\n", SDL_GetError());
615      return 1;
616   }
617
584618   if (window().fullscreen() && video_config.switchres)
585619   {
586620      SDL_DisplayMode mode;
r243307r243308
591625      mode.h = height;
592626      if (window().m_refresh)
593627         mode.refresh_rate = window().m_refresh;
594#if 0
595      if (window().depth)
596      {
597         switch (window().depth)
598         {
599         case 15:
600            mode.format = SDL_PIXELFORMAT_RGB555;
601            break;
602         case 16:
603            mode.format = SDL_PIXELFORMAT_RGB565;
604            break;
605         case 24:
606            mode.format = SDL_PIXELFORMAT_RGB24;
607            break;
608         case 32:
609            mode.format = SDL_PIXELFORMAT_RGB888;
610            break;
611         default:
612            osd_printf_warning("Ignoring depth %d\n", window().depth);
613         }
614      }
615#endif
616628
617629      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
618630#ifndef SDLMAME_WIN32
r243307r243308
625637   }
626638   else
627639   {
628      //SDL_SetWindowDisplayMode(window().sdl_window, NULL); // Use desktop
640      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
629641   }
630642   // create renderer
631643
r243307r243308
640652   }
641653
642654   //SDL_SelectRenderer(window().sdl_window);
655
656   // show window
657
643658   SDL_ShowWindow(window().m_sdl_window);
644   //SDL_SetWindowFullscreen(window().window_id, window().fullscreen);
659   //SDL_SetWindowFullscreen(window().sdl_window, window().fullscreen);
645660   SDL_RaiseWindow(window().m_sdl_window);
646661
647662   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
r243307r243308
654669}
655670
656671//============================================================
657//  sdl_info13::resize
672//  sdl_info::resize
658673//============================================================
659674
660675void sdl_info13::resize(int width, int height)
r243307r243308
677692int sdl_info13::xy_to_render_target(int x, int y, int *xt, int *yt)
678693{
679694
680   *xt = x - m_hofs;
681   *yt = y - m_vofs;
695   *xt = x - m_last_hofs;
696   *yt = y - m_last_vofs;
682697   if (*xt<0 || *xt >= window().m_blitwidth)
683698      return 0;
684699   if (*yt<0 || *yt >= window().m_blitheight)
r243307r243308
687702}
688703
689704//============================================================
690//  sdl_info13::get_primitives
705//  sdl_info::get_primitives
691706//============================================================
692707
693708void sdl_info13::set_target_bounds()
r243307r243308
696711}
697712
698713//============================================================
699//  sdl_info13::draw
714//  sdl_info::draw
700715//============================================================
701716
702717int sdl_info13::draw(UINT32 dc, int update)
r243307r243308
761776      }
762777   }
763778
764   m_hofs = hofs;
765   m_vofs = vofs;
779   m_last_hofs = hofs;
780   m_last_vofs = vofs;
766781
767782   window().m_primlist->acquire_lock();
768783
trunk/src/osd/sdl/drawogl.c
r243307r243308
223223#if (SDLMAME_SDL2)
224224      m_gl_context_id(0),
225225#else
226      sdlsurf(NULL),
226      m_sdlsurf(NULL),
227227#endif
228228      m_initialized(0),
229229      m_last_blendmode(0),
r243307r243308
258258   /* virtual */ void clear();
259259
260260   void loadGLExtensions();
261   void initialize_gl();
261262   void set_blendmode(int blendmode);
262263   void texture_compute_type_subroutine(const render_texinfo *texsource, texture_info *texture, UINT32 flags);
263264   void texture_compute_size_subroutine(texture_info *texture, UINT32 flags,
r243307r243308
277278   INT32           m_blittimer;
278279   UINT32          m_extra_flags;
279280
281
280282#if (SDLMAME_SDL2)
283   // Original display_mode
284   SDL_DisplayMode m_original_mode;
285
281286   SDL_GLContext   m_gl_context_id;
282287#else
283288   // SDL surface
284   SDL_Surface         *sdlsurf;
289   SDL_Surface         *m_sdlsurf;
285290#endif
286291
287292   int             m_initialized;        // is everything well initialized, i.e. all GL stuff etc.
r243307r243308
464469
465470
466471//============================================================
467//  drawogl_attach
468//============================================================
469
470//============================================================
471472// Load the OGL function addresses
472473//============================================================
473474
r243307r243308
528529#endif
529530}
530531
531//============================================================
532//  sdl_info::create
533//============================================================
534
535int sdl_info_ogl::create(int width, int height)
532void sdl_info_ogl::initialize_gl()
536533{
537   char *extstr;
538   char *vendor;
539534   int has_and_allow_texturerect = 0;
540535
541#if (SDLMAME_SDL2)
542   m_extra_flags = (window().fullscreen() ?
543         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
544   m_extra_flags |= SDL_WINDOW_OPENGL;
536   char *extstr = (char *)glGetString(GL_EXTENSIONS);
537   char *vendor = (char *)glGetString(GL_VENDOR);
545538
546   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
547
548   /* FIXME: A reminder that gamma is wrong throughout MAME. Currently, SDL2.0 doesn't seem to
549    * support the following attribute although my hardware lists GL_ARB_framebuffer_sRGB as an extension.
550    *
551    * SDL_GL_SetAttribute( SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1 );
552    *
553    */
554
555   //Moved into init
556   //load_gl_lib(window().machine());
557
558   // create the SDL window
559   window().m_sdl_window = SDL_CreateWindow(window().m_title,
560         window().monitor()->position_size().x, window().monitor()->position_size().y,
561         width, height, m_extra_flags);
562
563   if  (!window().m_sdl_window )
564   {
565      osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
566      return 1;
567   }
568
569   if (window().fullscreen() && video_config.switchres)
570   {
571      SDL_DisplayMode mode;
572      SDL_GetCurrentDisplayMode(window().monitor()->handle(), &mode);
573      mode.w = width;
574      mode.h = height;
575      if (window().m_refresh)
576         mode.refresh_rate = window().m_refresh;
577      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
578   }
579   else
580      SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
581
582   SDL_ShowWindow(window().m_sdl_window);
583   //SDL_SetWindowFullscreen(window().sdl_window, window().fullscreen);
584   SDL_RaiseWindow(window().m_sdl_window);
585   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
586
587   m_gl_context_id = SDL_GL_CreateContext(window().m_sdl_window);
588   if  (!m_gl_context_id)
589   {
590      osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
591      return 1;
592   }
593
594   SDL_GL_SetSwapInterval(video_config.waitvsync ? 2 : 0);
595
596#else
597   m_extra_flags = (window().fullscreen() ?  SDL_FULLSCREEN : SDL_RESIZABLE);
598   m_extra_flags |= SDL_OPENGL | SDL_DOUBLEBUF;
599
600   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
601   #if (SDL_VERSION_ATLEAST(1,2,10)) && (!defined(SDLMAME_EMSCRIPTEN))
602   SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0);
603   #endif
604
605   load_gl_lib(window().machine());
606
607   // create the SDL surface (which creates the window in windowed mode)
608   sdlsurf = SDL_SetVideoMode(width, height,
609                     0, SDL_SWSURFACE  | SDL_ANYFORMAT | m_extra_flags);
610
611   if (!sdlsurf)
612      return 1;
613
614   window().m_width = sdlsurf->w;
615   window().m_height = sdlsurf->h;
616
617   window().m_screen_width = 0;
618   window().m_screen_height = 0;
619
620   if ( (video_config.mode  == VIDEO_MODE_OPENGL) && !(sdlsurf->flags & SDL_OPENGL) )
621   {
622      osd_printf_error("OpenGL not supported on this driver!\n");
623      return 1;
624   }
625
626   // set the window title
627   SDL_WM_SetCaption(window().m_title, "SDLMAME");
628
629#endif
630   m_blittimer = 0;
631   m_surf_w = 0;
632   m_surf_h = 0;
633
634   m_initialized = 0;
635
636   // in case any textures try to come up before these are validated,
637   // OpenGL guarantees all implementations can handle something this size.
638   m_texture_max_width = 64;
639   m_texture_max_height = 64;
640
641   /* load any GL function addresses
642    * this must be done here because we need a context
643    */
644   loadgl_functions();
645
646   extstr = (char *)glGetString(GL_EXTENSIONS);
647   vendor = (char *)glGetString(GL_VENDOR);
648
649539   //printf("%s\n", extstr);
650540
651541   // print out the driver info for debugging
r243307r243308
787677
788678   shown_video_info = 1;
789679
680}
681//============================================================
682//  sdl_info::create
683// a
684// a
685// a
686// a
687// a
688// a
689// a
690// a
691// a
692// a
693// a
694// a
695// a
696// a
697// a
698// a
699// a
700// a
701// a
702// a
703// a
704// a
705// a
706// a
707// a
708// a
709//============================================================
710
711int sdl_info_ogl::create(int width, int height)
712{
713#if (SDLMAME_SDL2)
714
715   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
716
717   /* FIXME: A reminder that gamma is wrong throughout MAME. Currently, SDL2.0 doesn't seem to
718    * support the following attribute although my hardware lists GL_ARB_framebuffer_sRGB as an extension.
719    *
720    * SDL_GL_SetAttribute( SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1 );
721    *
722    */
723
724   osd_printf_verbose("Enter sdl_info_ogl::create\n");
725
726   // create the SDL window
727   // soft driver also used | SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_MOUSE_FOCUS
728   m_extra_flags = (window().fullscreen() ?
729         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
730
731   m_extra_flags |= SDL_WINDOW_OPENGL;
732
733
734#if defined(SDLMAME_WIN32)
735   SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
736#endif
737   // create the SDL window
738   window().m_sdl_window = SDL_CreateWindow(window().m_title,
739         window().monitor()->position_size().x, window().monitor()->position_size().y,
740         width, height, m_extra_flags);
741   //window().m_sdl_window = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
742   //      width, height, m_extra_flags);
743
744   if  (!window().m_sdl_window )
745   {
746      osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
747      return 1;
748   }
749
750   if (window().fullscreen() && video_config.switchres)
751   {
752      SDL_DisplayMode mode;
753      //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
754      SDL_GetWindowDisplayMode(window().m_sdl_window, &mode);
755      m_original_mode = mode;
756      mode.w = width;
757      mode.h = height;
758      if (window().m_refresh)
759         mode.refresh_rate = window().m_refresh;
760
761      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
762#ifndef SDLMAME_WIN32
763      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
764       * is in place after the mode switch - which will most likely be the case
765       * This is a hack to work around a deficiency in SDL2
766       */
767      SDL_WarpMouseInWindow(window().m_sdl_window, 1, 1);
768#endif
769   }
770   else
771   {
772      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
773   }
774   // create renderer
775
776   //SDL_SelectRenderer(window().sdl_window);
777
778   // show window
779
780   SDL_ShowWindow(window().m_sdl_window);
781   //SDL_SetWindowFullscreen(window().m_sdl_window, window().fullscreen);
782   SDL_RaiseWindow(window().m_sdl_window);
783
784   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
785
786
787   m_gl_context_id = SDL_GL_CreateContext(window().m_sdl_window);
788   if  (!m_gl_context_id)
789   {
790      osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError());
791      return 1;
792   }
793
794   SDL_GL_SetSwapInterval(video_config.waitvsync ? 2 : 0);
795
796#else
797   m_extra_flags = (window().fullscreen() ?  SDL_FULLSCREEN : SDL_RESIZABLE);
798   m_extra_flags |= SDL_OPENGL | SDL_DOUBLEBUF;
799
800   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
801   #if (SDL_VERSION_ATLEAST(1,2,10)) && (!defined(SDLMAME_EMSCRIPTEN))
802   SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0);
803   #endif
804
805   load_gl_lib(window().machine());
806
807   // create the SDL surface (which creates the window in windowed mode)
808   m_sdlsurf = SDL_SetVideoMode(width, height,
809                     0, SDL_SWSURFACE  | SDL_ANYFORMAT | m_extra_flags);
810
811   if (!m_sdlsurf)
812      return 1;
813
814   window().m_width = m_sdlsurf->w;
815   window().m_height = m_sdlsurf->h;
816
817   window().m_screen_width = 0;
818   window().m_screen_height = 0;
819
820   if ( (video_config.mode  == VIDEO_MODE_OPENGL) && !(m_sdlsurf->flags & SDL_OPENGL) )
821   {
822      osd_printf_error("OpenGL not supported on this driver!\n");
823      return 1;
824   }
825
826   // set the window title
827   SDL_WM_SetCaption(window().m_title, "SDLMAME");
828
829#endif
830
831   m_blittimer = 0;
832   m_surf_w = 0;
833   m_surf_h = 0;
834
835   m_initialized = 0;
836
837   // in case any textures try to come up before these are validated,
838   // OpenGL guarantees all implementations can handle something this size.
839   m_texture_max_width = 64;
840   m_texture_max_height = 64;
841
842   /* load any GL function addresses
843    * this must be done here because we need a context
844    */
845   loadgl_functions();
846   initialize_gl();
847
848
790849   m_init_context = 0;
791850
851   osd_printf_verbose("Leave sdl_info_ogl::create\n");
792852   return 0;
793853}
794854
r243307r243308
804864   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
805865   m_blittimer = 3;
806866#else
807   SDL_FreeSurface(sdlsurf);
867   SDL_FreeSurface(m_sdlsurf);
808868
809   sdlsurf = SDL_SetVideoMode(width, height, 0,
869   m_sdlsurf = SDL_SetVideoMode(width, height, 0,
810870         SDL_SWSURFACE | SDL_ANYFORMAT | m_extra_flags);
811871
812   window().m_width = sdlsurf->w;
813   window().m_height = sdlsurf->h;
872   window().m_width = m_sdlsurf->w;
873   window().m_height = m_sdlsurf->h;
814874#endif
815875   m_init_context = 1;
816876
r243307r243308
11511211}
11521212
11531213//============================================================
1214//  sdl_info::destroy
1215//============================================================
1216
1217void sdl_info_ogl::destroy()
1218{
1219
1220   // free the memory in the window
1221
1222   destroy_all_textures();
1223
1224#if (SDLMAME_SDL2)
1225   SDL_GL_DeleteContext(m_gl_context_id);
1226   if (window().fullscreen() && video_config.switchres)
1227   {
1228      SDL_SetWindowFullscreen(window().m_sdl_window, 0);    // Try to set mode
1229      SDL_SetWindowDisplayMode(window().m_sdl_window, &m_original_mode);    // Try to set mode
1230      SDL_SetWindowFullscreen(window().m_sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
1231   }
1232
1233   SDL_DestroyWindow(window().m_sdl_window);
1234#else
1235   if (m_sdlsurf)
1236   {
1237      SDL_FreeSurface(m_sdlsurf);
1238      m_sdlsurf = NULL;
1239   }
1240#endif
1241}
1242
1243//============================================================
11541244//  sdl_info::draw
11551245//============================================================
11561246
r243307r243308
16181708}
16191709
16201710//============================================================
1621//  sdl_info::destroy
1622//============================================================
1623
1624void sdl_info_ogl::destroy()
1625{
1626
1627   // free the memory in the window
1628
1629   destroy_all_textures();
1630
1631#if (SDLMAME_SDL2)
1632   SDL_GL_DeleteContext(m_gl_context_id);
1633   SDL_DestroyWindow(window().m_sdl_window);
1634#else
1635   if (sdlsurf)
1636   {
1637      SDL_FreeSurface(sdlsurf);
1638      sdlsurf = NULL;
1639   }
1640#endif
1641}
1642
1643//============================================================
16441711//  texture_compute_size and type
16451712//============================================================
16461713
trunk/src/osd/sdl/drawsdl.c
r243307r243308
9696   UINT32              m_extra_flags;
9797
9898#if (SDLMAME_SDL2)
99   // Original display_mode
100   SDL_DisplayMode    m_original_mode;
101
99102   SDL_Renderer        *m_sdl_renderer;
100103   SDL_Texture         *m_texture_id;
101104#else
r243307r243308
399402#endif
400403
401404//============================================================
402//  drawsdl_window_create
405//  sdl_info::create
406// a
407// a
408// a
409// a
410// a
411// a
412// a
413// a
414// a
415// a
416// a
417// a
418// a
419// a
420// a
421// a
422// a
423// a
424// a
425// a
426// a
427// a
428// a
429// a
430// a
431// a
403432//============================================================
404433
405434int sdl_info::create(int width, int height)
r243307r243308
408437
409438#if (SDLMAME_SDL2)
410439
440   osd_printf_verbose("Enter sdl_info::create\n");
441
411442   /* set hints ... */
412
413443   SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, sm->sdl_scale_mode);
414444
445   // create the SDL window
446   // soft driver also used | SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_MOUSE_FOCUS
415447   m_extra_flags = (window().fullscreen() ?
416         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS
417         | SDL_WINDOW_INPUT_GRABBED : SDL_WINDOW_RESIZABLE);
448         SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
418449
419   window().m_sdl_window = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
450#if defined(SDLMAME_WIN32)
451   SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
452#endif
453   window().m_sdl_window = SDL_CreateWindow(window().m_title,
454         window().monitor()->position_size().x, window().monitor()->position_size().y,
420455         width, height, m_extra_flags);
456   //window().m_sdl_window = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
457   //      width, height, m_extra_flags);
421458
459   if  (!window().m_sdl_window )
460   {
461      osd_printf_error("Unable to create window: %s\n", SDL_GetError());
462      return 1;
463   }
464
422465   if (window().fullscreen() && video_config.switchres)
423466   {
424467      SDL_DisplayMode mode;
425      SDL_GetCurrentDisplayMode(window().monitor()->handle(), &mode);
468      //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
469      SDL_GetWindowDisplayMode(window().m_sdl_window, &mode);
470      m_original_mode = mode;
426471      mode.w = width;
427472      mode.h = height;
428473      if (window().m_refresh)
429474         mode.refresh_rate = window().m_refresh;
475
430476      SDL_SetWindowDisplayMode(window().m_sdl_window, &mode);    // Try to set mode
477#ifndef SDLMAME_WIN32
478      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
479       * is in place after the mode switch - which will most likely be the case
480       * This is a hack to work around a deficiency in SDL2
481       */
482      SDL_WarpMouseInWindow(window().m_sdl_window, 1, 1);
483#endif
431484   }
432485   else
433      SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
486   {
487      //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
488   }
489   // create renderer
434490
491   //SDL_SelectRenderer(window().sdl_window);
492
493   // show window
494
435495   SDL_ShowWindow(window().m_sdl_window);
496   //SDL_SetWindowFullscreen(window().m_sdl_window, window().fullscreen);
497   SDL_RaiseWindow(window().m_sdl_window);
436498
437   SDL_SetWindowFullscreen(window().m_sdl_window, (SDL_bool) window().fullscreen());
438499   SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
439   SDL_RaiseWindow(window().m_sdl_window);
440500
441501   /* FIXME: Bug in SDL 1.3 */
442502   if (window().fullscreen())
r243307r243308
495555
496556   // set the window title
497557   SDL_WM_SetCaption(window().m_title, "SDLMAME");
558
498559#endif
560
499561   m_yuv_lookup = NULL;
500562   m_blittimer = 0;
501563
502564   yuv_init();
565   osd_printf_verbose("Leave sdl_info::create\n");
503566   return 0;
504567}
505568
506569//============================================================
507//  drawsdl_window_resize
570//  sdl_info::resize
508571//============================================================
509572
510573void sdl_info::resize(int width, int height)
r243307r243308
523586      m_yuvsurf = NULL;
524587   }
525588   SDL_FreeSurface(m_sdlsurf);
526   //printf("SetVideoMode %d %d\n", wp->resize_new_width, wp->resize_new_height);
527
589   
528590   m_sdlsurf = SDL_SetVideoMode(width, height, 0,
529591         SDL_SWSURFACE | SDL_ANYFORMAT | m_extra_flags);
530592   window().m_width = m_sdlsurf->w;
r243307r243308
540602
541603
542604//============================================================
543//  drawsdl_window_destroy
605//  sdl_info::destroy
544606//============================================================
545607
546608void sdl_info::destroy()
r243307r243308
550612   //SDL_SelectRenderer(window().sdl_window);
551613   SDL_DestroyTexture(m_texture_id);
552614   //SDL_DestroyRenderer(window().sdl_window);
615   if (window().fullscreen() && video_config.switchres)
616   {
617      SDL_SetWindowFullscreen(window().m_sdl_window, 0);    // Try to set mode
618      SDL_SetWindowDisplayMode(window().m_sdl_window, &m_original_mode);    // Try to set mode
619      SDL_SetWindowFullscreen(window().m_sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
620   }
621
553622   SDL_DestroyWindow(window().m_sdl_window);
554623#else
555624   if (m_yuvsurf != NULL)
r243307r243308
579648}
580649
581650//============================================================
582//  drawsdl_window_clear
651//  sdl_info::draw
583652//============================================================
584653
585654void sdl_info::clear()


Previous 199869 Revisions Next


© 1997-2024 The MAME Team