Permalink
Browse files

Changes to the newer SDL code to compile with emscripten

  • Loading branch information...
1 parent 6d0dcc4 commit 7a654b762b30e6fe4200efc1bce98aa41c129664 @DopefishJustin DopefishJustin committed Jul 27, 2012
Showing with 8 additions and 5 deletions.
  1. +1 −1 src/osd/sdl/drawogl.c
  2. +2 −0 src/osd/sdl/gl_shader_mgr.c
  3. +4 −3 src/osd/sdl/input.c
  4. +1 −1 src/osd/sdl/window.c
View
@@ -596,7 +596,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
sdl->extra_flags |= SDL_OPENGL | SDL_DOUBLEBUF;
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
- #if (SDL_VERSION_ATLEAST(1,2,10))
+ #if (SDL_VERSION_ATLEAST(1,2,10)) && !defined(SDLMAME_EMSCRIPTEN)
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0);
#endif
@@ -1,4 +1,6 @@
+#include <stdlib.h>
+#include <stdio.h>
#include "sdlinc.h"
#include "osd_opengl.h"
View
@@ -36,6 +36,7 @@
// Emscripten requires the SDL2 API for inputs, but nothing else
#ifdef SDLMAME_EMSCRIPTEN
+#undef SDLMAME_SDL2
#define SDLMAME_SDL2 1
#endif
@@ -1221,7 +1222,7 @@ sdl_window_info *sdlinput_get_focus_window(running_machine &machine)
// sdlinput_poll
//============================================================
-#if (SDLMAME_SDL2)
+#if (SDLMAME_SDL2) && !defined(SDLMAME_EMSCRIPTEN)
INLINE sdl_window_info * window_from_id(Uint32 windowID)
{
sdl_window_info *w;
@@ -1511,7 +1512,7 @@ void sdlinput_poll(running_machine &machine)
devinfo->joystick.balls[event.jball.ball * 2] = event.jball.xrel * INPUT_RELATIVE_PER_PIXEL;
devinfo->joystick.balls[event.jball.ball * 2 + 1] = event.jball.yrel * INPUT_RELATIVE_PER_PIXEL;
break;
-#if (!SDLMAME_SDL2)
+#if (!SDLMAME_SDL2) || defined(SDLMAME_EMSCRIPTEN)
case SDL_APPMOUSEFOCUS:
app_has_mouse_focus = event.active.gain;
if (!event.active.gain)
@@ -1588,7 +1589,7 @@ void sdlinput_poll(running_machine &machine)
#endif
}
}
-#if (SDLMAME_SDL2)
+#if (SDLMAME_SDL2) && !defined(SDLMAME_EMSCRIPTEN)
resize_all_windows();
#endif
}
View
@@ -88,7 +88,7 @@ static sdl_window_info **last_window_ptr;
static int multithreading_enabled;
static osd_work_queue *work_queue;
-#if !(SDLMAME_SDL2)
+#if !(SDLMAME_SDL2) && !defined(SDLMAME_EMSCRIPTEN)
typedef int SDL_threadID;
#endif

0 comments on commit 7a654b7

Please sign in to comment.