mirror of
https://github.com/encounter/SDL.git
synced 2025-12-09 13:37:56 +00:00
Merge audio capture work back into the mainline.
This commit is contained in:
@@ -34,11 +34,11 @@ void android_egl_context_backup();
|
||||
void android_egl_context_restore();
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ANDROID
|
||||
void AndroidAUD_ResumeDevices(void);
|
||||
void AndroidAUD_PauseDevices(void);
|
||||
void ANDROIDAUDIO_ResumeDevices(void);
|
||||
void ANDROIDAUDIO_PauseDevices(void);
|
||||
#else
|
||||
static void AndroidAUD_ResumeDevices(void) {}
|
||||
static void AndroidAUD_PauseDevices(void) {}
|
||||
static void ANDROIDAUDIO_ResumeDevices(void) {}
|
||||
static void ANDROIDAUDIO_PauseDevices(void) {}
|
||||
#endif
|
||||
|
||||
void
|
||||
@@ -83,14 +83,14 @@ Android_PumpEvents(_THIS)
|
||||
if (isPaused && !isPausing) {
|
||||
/* Make sure this is the last thing we do before pausing */
|
||||
android_egl_context_backup();
|
||||
AndroidAUD_PauseDevices();
|
||||
ANDROIDAUDIO_PauseDevices();
|
||||
if(SDL_SemWait(Android_ResumeSem) == 0) {
|
||||
#else
|
||||
if (isPaused) {
|
||||
if(SDL_SemTryWait(Android_ResumeSem) == 0) {
|
||||
#endif
|
||||
isPaused = 0;
|
||||
AndroidAUD_ResumeDevices();
|
||||
ANDROIDAUDIO_ResumeDevices();
|
||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
||||
if (!SDL_HasEvent(SDL_QUIT)) {
|
||||
android_egl_context_restore();
|
||||
@@ -113,7 +113,7 @@ Android_PumpEvents(_THIS)
|
||||
#else
|
||||
if(SDL_SemTryWait(Android_PauseSem) == 0) {
|
||||
android_egl_context_backup();
|
||||
AndroidAUD_PauseDevices();
|
||||
ANDROIDAUDIO_PauseDevices();
|
||||
isPaused = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -391,11 +391,24 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo
|
||||
x = touchEvent->touches[i].canvasX / (float)window_data->windowed_width;
|
||||
y = touchEvent->touches[i].canvasY / (float)window_data->windowed_height;
|
||||
|
||||
if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
|
||||
SDL_SendTouchMotion(deviceId, id, x, y, 1.0f);
|
||||
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) {
|
||||
if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) {
|
||||
if (!window_data->finger_touching) {
|
||||
window_data->finger_touching = SDL_TRUE;
|
||||
window_data->first_finger = id;
|
||||
SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y);
|
||||
SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f);
|
||||
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
|
||||
if ((window_data->finger_touching) && (window_data->first_finger == id)) {
|
||||
SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y);
|
||||
}
|
||||
SDL_SendTouchMotion(deviceId, id, x, y, 1.0f);
|
||||
} else {
|
||||
if ((window_data->finger_touching) && (window_data->first_finger == id)) {
|
||||
SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
window_data->finger_touching = SDL_FALSE;
|
||||
}
|
||||
SDL_SendTouch(deviceId, id, SDL_FALSE, x, y, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define _SDL_emscriptenvideo_h
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../../events/SDL_touch_c.h"
|
||||
#include <emscripten/emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
|
||||
@@ -45,6 +46,9 @@ typedef struct SDL_WindowData
|
||||
SDL_bool external_size;
|
||||
|
||||
int requested_fullscreen_mode;
|
||||
|
||||
SDL_bool finger_touching; /* for mapping touch events to mice */
|
||||
SDL_FingerID first_finger;
|
||||
} SDL_WindowData;
|
||||
|
||||
#endif /* _SDL_emscriptenvideo_h */
|
||||
|
||||
Reference in New Issue
Block a user