mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 12:40:28 +02:00
Updated SDL2 to changeset 69a5f3a540af (dev version of 2.0.4)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -24,8 +24,11 @@
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_audio.h"
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -75,14 +78,23 @@ poked(int sig)
|
||||
done = 1;
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
void
|
||||
loop()
|
||||
{
|
||||
if(done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING))
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
char filename[4096];
|
||||
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
|
||||
/* Load the SDL library */
|
||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||
@@ -117,7 +129,7 @@ main(int argc, char *argv[])
|
||||
/* Show the list of available drivers */
|
||||
SDL_Log("Available audio drivers:");
|
||||
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
|
||||
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
|
||||
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
|
||||
}
|
||||
|
||||
/* Initialize fillerup() variables */
|
||||
@@ -131,8 +143,13 @@ main(int argc, char *argv[])
|
||||
|
||||
/* Let the audio run */
|
||||
SDL_PauseAudio(0);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING))
|
||||
SDL_Delay(1000);
|
||||
#endif
|
||||
|
||||
/* Clean up on signal */
|
||||
SDL_CloseAudio();
|
||||
|
||||
Reference in New Issue
Block a user