Define SDL_PLATFORM_* macros instead of underscored ones (#8875)
This commit is contained in:
committed by
GitHub
parent
ceccf24519
commit
31d133db40
@@ -15,14 +15,14 @@
|
||||
pump the event loop and catch keystrokes.
|
||||
*/
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static SDLTest_TextWindow *textwin;
|
||||
static int done;
|
||||
@@ -228,7 +228,7 @@ static void loop(void)
|
||||
/* Slow down framerate */
|
||||
SDL_Delay(100);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -266,7 +266,7 @@ int main(int argc, char *argv[])
|
||||
SDL_GetWindowSize(state->windows[0], &w, &h);
|
||||
textwin = SDLTest_TextWindowCreate(0.f, 0.f, (float)w, (float)h);
|
||||
|
||||
#ifdef __IOS__
|
||||
#ifdef SDL_PLATFORM_IOS
|
||||
{
|
||||
int i;
|
||||
/* Creating the context creates the view, which we need to show keyboard */
|
||||
@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
|
||||
/* Watch keystrokes */
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
pump the event loop and catch keystrokes.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int done;
|
||||
|
||||
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
||||
@@ -214,7 +214,7 @@ static void loop(void)
|
||||
}
|
||||
(void)fprintf(stderr, "exiting event loop\n");
|
||||
(void)fflush(stderr);
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -279,7 +279,7 @@ int main(int argc, char *argv[])
|
||||
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
#ifdef __IOS__
|
||||
#ifdef SDL_PLATFORM_IOS
|
||||
/* Creating the context creates the view, which we need to show keyboard */
|
||||
SDL_GL_CreateContext(window);
|
||||
#endif
|
||||
@@ -295,7 +295,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
thread = SDL_CreateThread(ping_thread, "PingThread", NULL);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -644,7 +644,7 @@ static Thing *LoadWavThing(const char *fname, float x, float y)
|
||||
static const ThingType can_be_dropped_onto[] = { THING_TRASHCAN, THING_NULL };
|
||||
char *titlebar = NULL;
|
||||
const char *nodirs = SDL_strrchr(fname, '/');
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef SDL_PLATFORM_WINDOWS
|
||||
const char *nodirs2 = SDL_strrchr(nodirs ? nodirs : fname, '\\');
|
||||
if (nodirs2) {
|
||||
nodirs = nodirs2;
|
||||
|
||||
@@ -12,21 +12,21 @@
|
||||
|
||||
/* Program to test hotplugging of audio devices */
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include "testutils.h"
|
||||
|
||||
static SDL_AudioSpec spec;
|
||||
static Uint8 *sound = NULL; /* Pointer to wave data */
|
||||
static Uint32 soundlen = 0; /* Length of wave data */
|
||||
@@ -101,7 +101,7 @@ static void iteration(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
static void loop(void)
|
||||
{
|
||||
if (done)
|
||||
@@ -194,7 +194,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable.\n");
|
||||
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
@@ -219,7 +219,7 @@ static void loop(void)
|
||||
|
||||
while (SDL_PollEvent(&e)) {
|
||||
SDLTest_CommonEvent(state, &e, &done);
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -432,7 +432,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
SDL_BindAudioStream(state->audio_id, stream);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -340,11 +340,11 @@ static int rwops_testFileRead(void *arg)
|
||||
}
|
||||
|
||||
/* Check type */
|
||||
#ifdef __ANDROID__
|
||||
#ifdef SDL_PLATFORM_ANDROID
|
||||
SDLTest_AssertCheck(
|
||||
rw->type == SDL_RWOPS_STDFILE || rw->type == SDL_RWOPS_JNIFILE,
|
||||
"Verify RWops type is SDL_RWOPS_STDFILE or SDL_RWOPS_JNIFILE; expected: %d|%d, got: %d", SDL_RWOPS_STDFILE, SDL_RWOPS_JNIFILE, rw->type);
|
||||
#elif defined(__WIN32__)
|
||||
#elif defined(SDL_PLATFORM_WIN32)
|
||||
SDLTest_AssertCheck(
|
||||
rw->type == SDL_RWOPS_WINFILE,
|
||||
"Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type);
|
||||
@@ -387,11 +387,11 @@ static int rwops_testFileWrite(void *arg)
|
||||
}
|
||||
|
||||
/* Check type */
|
||||
#ifdef __ANDROID__
|
||||
#ifdef SDL_PLATFORM_ANDROID
|
||||
SDLTest_AssertCheck(
|
||||
rw->type == SDL_RWOPS_STDFILE || rw->type == SDL_RWOPS_JNIFILE,
|
||||
"Verify RWops type is SDL_RWOPS_STDFILE or SDL_RWOPS_JNIFILE; expected: %d|%d, got: %d", SDL_RWOPS_STDFILE, SDL_RWOPS_JNIFILE, rw->type);
|
||||
#elif defined(__WIN32__)
|
||||
#elif defined(SDL_PLATFORM_WIN32)
|
||||
SDLTest_AssertCheck(
|
||||
rw->type == SDL_RWOPS_WINFILE,
|
||||
"Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type);
|
||||
|
||||
@@ -839,7 +839,7 @@ static int stdlib_sscanf(void *arg)
|
||||
|
||||
#ifdef _WIN64
|
||||
#define SIZE_FORMAT "I64u"
|
||||
#elif defined(__WIN32__)
|
||||
#elif defined(SDL_PLATFORM_WIN32)
|
||||
#define SIZE_FORMAT "I32u"
|
||||
#else
|
||||
#define SIZE_FORMAT "zu"
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include <SDL3/SDL_test_font.h>
|
||||
|
||||
#include "gamepadutils.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "gamepadutils.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#if 0
|
||||
#define DEBUG_AXIS_MAPPING
|
||||
#endif
|
||||
@@ -1883,7 +1883,7 @@ static void loop(void *arg)
|
||||
SDL_Delay(16);
|
||||
SDL_RenderPresent(screen);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -2090,7 +2090,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Loop, getting gamepad events! */
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop_arg(loop, NULL, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -9,15 +9,16 @@
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Stolen from the mailing list */
|
||||
/* Creates a new mouse cursor from an XPM */
|
||||
|
||||
@@ -329,7 +330,7 @@ static void loop(void)
|
||||
}
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -411,7 +412,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Main render loop */
|
||||
done = 0;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
/* Simple program: draw as many random objects on the screen as possible */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define NUM_OBJECTS 100
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
@@ -200,7 +200,7 @@ static void loop(void)
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -300,7 +300,7 @@ int main(int argc, char *argv[])
|
||||
next_fps_check = SDL_GetTicks() + fps_check_delay;
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
|
||||
/* Sample program: Draw a Chess Board by using SDL_CreateSoftwareRenderer API */
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
static SDL_Window *window;
|
||||
static SDL_Renderer *renderer;
|
||||
static SDL_Surface *surface;
|
||||
@@ -79,7 +79,7 @@ static void loop(void)
|
||||
|
||||
if (e.type == SDL_EVENT_QUIT) {
|
||||
done = 1;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_cancel_main_loop();
|
||||
#endif
|
||||
return;
|
||||
@@ -87,7 +87,7 @@ static void loop(void)
|
||||
|
||||
if ((e.type == SDL_EVENT_KEY_DOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
|
||||
done = 1;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_cancel_main_loop();
|
||||
#endif
|
||||
return;
|
||||
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Draw the Image on rendering surface */
|
||||
done = 0;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
#include "testffmpeg_videotoolbox.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
#define COBJMACROS
|
||||
#include <libavutil/hwcontext_d3d11va.h>
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* SDL_PLATFORM_WIN32 */
|
||||
|
||||
#include "icon.h"
|
||||
|
||||
@@ -74,10 +74,10 @@ static SDL_bool has_EGL_EXT_image_dma_buf_import;
|
||||
static PFNGLACTIVETEXTUREARBPROC glActiveTextureARBFunc;
|
||||
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOESFunc;
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
static SDL_bool has_videotoolbox_output;
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
static ID3D11Device *d3d11_device;
|
||||
static ID3D11DeviceContext *d3d11_context;
|
||||
static const GUID SDL_IID_ID3D11Resource = { 0xdc8e63f3, 0xd12b, 0x4952, { 0xb4, 0x7b, 0x5e, 0x45, 0x02, 0x6a, 0x86, 0x2d } };
|
||||
@@ -140,11 +140,11 @@ static SDL_bool CreateWindowAndRenderer(Uint32 window_flags, const char *driver)
|
||||
}
|
||||
#endif /* HAVE_EGL */
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
has_videotoolbox_output = SetupVideoToolboxOutput(renderer);
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
d3d11_device = (ID3D11Device *)SDL_GetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER, NULL);
|
||||
if (d3d11_device) {
|
||||
ID3D11Device_AddRef(d3d11_device);
|
||||
@@ -259,12 +259,12 @@ static SDL_bool SupportedPixelFormat(enum AVPixelFormat format)
|
||||
(format == AV_PIX_FMT_VAAPI || format == AV_PIX_FMT_DRM_PRIME)) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
if (has_videotoolbox_output && format == AV_PIX_FMT_VIDEOTOOLBOX) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
if (d3d11_device && format == AV_PIX_FMT_D3D11) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
@@ -351,7 +351,7 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
if (d3d11_device && type == AV_HWDEVICE_TYPE_D3D11VA) {
|
||||
AVD3D11VADeviceContext *device_context;
|
||||
|
||||
@@ -598,7 +598,7 @@ static SDL_bool GetTextureForVAAPIFrame(AVFrame *frame, SDL_Texture **texture)
|
||||
|
||||
static SDL_bool GetTextureForD3D11Frame(AVFrame *frame, SDL_Texture **texture)
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
int texture_width = 0, texture_height = 0;
|
||||
ID3D11Texture2D *pTexture = (ID3D11Texture2D *)frame->data[0];
|
||||
UINT iSliceIndex = (UINT)(uintptr_t)frame->data[1];
|
||||
@@ -672,7 +672,7 @@ static void DisplayVideoTexture(AVFrame *frame)
|
||||
|
||||
static void DisplayVideoToolbox(AVFrame *frame)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
SDL_Rect viewport;
|
||||
SDL_GetRenderViewport(renderer, &viewport);
|
||||
DisplayVideoToolboxFrame(renderer, frame->data[3], 0, 0, frame->width, frame->height, viewport.x, viewport.y, viewport.w, viewport.h);
|
||||
@@ -908,9 +908,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
window_flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
window_flags |= SDL_WINDOW_METAL;
|
||||
#elif !defined(__WIN32__)
|
||||
#elif !defined(SDL_PLATFORM_WIN32)
|
||||
window_flags |= SDL_WINDOW_OPENGL;
|
||||
#endif
|
||||
#ifdef HAVE_EGL
|
||||
@@ -919,12 +919,12 @@ int main(int argc, char *argv[])
|
||||
CreateWindowAndRenderer(window_flags, "opengles2");
|
||||
}
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
if (!window) {
|
||||
CreateWindowAndRenderer(window_flags, "metal");
|
||||
}
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
if (!window) {
|
||||
CreateWindowAndRenderer(window_flags, "direct3d11");
|
||||
}
|
||||
@@ -1111,10 +1111,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
return_code = 0;
|
||||
quit:
|
||||
#ifdef __APPLE__
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
CleanupVideoToolboxOutput();
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
if (d3d11_context) {
|
||||
ID3D11DeviceContext_Release(d3d11_device);
|
||||
d3d11_context = NULL;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/* WARNING ! those 2 files will be destroyed by this test program */
|
||||
|
||||
#ifdef __IOS__
|
||||
#ifdef SDL_PLATFORM_IOS
|
||||
#define FBASENAME1 "../Documents/sdldata1" /* this file will be created during tests */
|
||||
#define FBASENAME2 "../Documents/sdldata2" /* this file should not exist before starting test */
|
||||
#else
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
/* Simple program: draw a RGB triangle, with texture */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static SDL_bool use_texture = SDL_FALSE;
|
||||
static SDL_Texture **sprites;
|
||||
@@ -174,7 +174,7 @@ static void loop(void)
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -266,7 +266,7 @@ int main(int argc, char *argv[])
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#if defined(__IOS__) || defined(__ANDROID__)
|
||||
#if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_ANDROID)
|
||||
#define HAVE_OPENGLES
|
||||
#endif
|
||||
|
||||
@@ -335,7 +335,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("%2.2f frames per second\n",
|
||||
((double)frames * 1000) / (now - then));
|
||||
}
|
||||
#ifndef __ANDROID__
|
||||
#ifndef SDL_PLATFORM_ANDROID
|
||||
quit(0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -9,16 +9,17 @@
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#if defined(__IOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__WINDOWS__) || defined(__LINUX__)
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_ANDROID) || defined(SDL_PLATFORM_EMSCRIPTEN) || defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_LINUX)
|
||||
#define HAVE_OPENGLES2
|
||||
#endif
|
||||
|
||||
@@ -535,7 +536,7 @@ Render(unsigned int width, unsigned int height, shader_data *data)
|
||||
static int done;
|
||||
static Uint32 frames;
|
||||
static shader_data *datas;
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
||||
static thread_data *threads;
|
||||
#endif
|
||||
|
||||
@@ -560,7 +561,7 @@ render_window(int index)
|
||||
++frames;
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
||||
static int SDLCALL
|
||||
render_thread_fn(void *render_ctx)
|
||||
{
|
||||
@@ -652,7 +653,7 @@ loop(void)
|
||||
render_window(i);
|
||||
}
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
else {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -912,7 +913,7 @@ int main(int argc, char *argv[])
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
if (threaded) {
|
||||
@@ -950,7 +951,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("%2.2f frames per second\n",
|
||||
((double)frames * 1000) / (now - then));
|
||||
}
|
||||
#ifndef __ANDROID__
|
||||
#ifndef SDL_PLATFORM_ANDROID
|
||||
quit(0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -9,17 +9,18 @@
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#if defined(__IOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__WINDOWS__) || defined(__LINUX__)
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_ANDROID) || defined(SDL_PLATFORM_EMSCRIPTEN) || defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_LINUX)
|
||||
#define HAVE_OPENGLES2
|
||||
#endif
|
||||
|
||||
@@ -425,7 +426,7 @@ static void loop(void)
|
||||
SDL_GL_SwapWindow(state->windows[i]);
|
||||
}
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
else {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -769,7 +770,7 @@ int main(int argc, char *argv[])
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
@@ -783,7 +784,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("%2.2f frames per second\n",
|
||||
((double)frames * 1000) / (now - then));
|
||||
}
|
||||
#ifndef __ANDROID__
|
||||
#ifndef SDL_PLATFORM_ANDROID
|
||||
quit(0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SDL_TTF
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf"
|
||||
#elif defined(__WIN32__)
|
||||
#elif defined(SDL_PLATFORM_WIN32)
|
||||
/* Some japanese font present on at least Windows 8.1. */
|
||||
#define DEFAULT_FONT "C:\\Windows\\Fonts\\yugothic.ttf"
|
||||
#else
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
|
||||
/* Simple program: draw as many random objects on the screen as possible */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define SWAP(typ, a, b) \
|
||||
do { \
|
||||
@@ -273,7 +273,7 @@ static void loop(void *arg)
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (*done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -368,7 +368,7 @@ int main(int argc, char *argv[])
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop_arg(loop, &done, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> /* exit() */
|
||||
|
||||
#ifdef __IOS__
|
||||
#ifdef SDL_PLATFORM_IOS
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 480
|
||||
#else
|
||||
@@ -245,7 +245,7 @@ static void loop(void *arg)
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (loop_data->done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Main render loop */
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop_arg(loop, &loop_data, 0, 1);
|
||||
#else
|
||||
while (loop_data.done == SDL_FALSE) {
|
||||
|
||||
@@ -15,13 +15,11 @@
|
||||
|
||||
#include "testutils.h"
|
||||
|
||||
#include <stdio.h> /* for fflush() and stdout */
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "testutils.h"
|
||||
#include <stdio.h> /* for fflush() and stdout */
|
||||
|
||||
static SDL_AudioSpec spec;
|
||||
static Uint8 *sound = NULL; /* Pointer to wave data */
|
||||
@@ -31,7 +29,7 @@ static Uint32 soundlen = 0; /* Length of wave data */
|
||||
static SDL_AudioStream *stream = NULL;
|
||||
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
static void loop(void)
|
||||
{
|
||||
if (SDL_GetAudioStreamAvailable(stream) == 0) {
|
||||
@@ -51,7 +49,7 @@ test_multi_audio(SDL_AudioDeviceID *devices, int devcount)
|
||||
SDL_AudioStream **streams = NULL;
|
||||
int i;
|
||||
|
||||
#ifdef __ANDROID__ /* !!! FIXME: maybe always create a window, in the SDLTest layer, so these #ifdefs don't have to be here? */
|
||||
#ifdef SDL_PLATFORM_ANDROID /* !!! FIXME: maybe always create a window, in the SDLTest layer, so these #ifdefs don't have to be here? */
|
||||
SDL_Event event;
|
||||
|
||||
/* Create a Window to get fully initialized event processing for testing pause on Android. */
|
||||
@@ -69,11 +67,11 @@ test_multi_audio(SDL_AudioDeviceID *devices, int devcount)
|
||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||
SDL_PutAudioStreamData(stream, sound, soundlen);
|
||||
SDL_FlushAudioStream(stream);
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (SDL_GetAudioStreamAvailable(stream) > 0) {
|
||||
#ifdef __ANDROID__
|
||||
#ifdef SDL_PLATFORM_ANDROID
|
||||
/* Empty queue, some application events would prevent pause. */
|
||||
while (SDL_PollEvent(&event)) {
|
||||
}
|
||||
@@ -118,7 +116,7 @@ test_multi_audio(SDL_AudioDeviceID *devices, int devcount)
|
||||
keep_going = 1;
|
||||
}
|
||||
}
|
||||
#ifdef __ANDROID__
|
||||
#ifdef SDL_PLATFORM_ANDROID
|
||||
/* Empty queue, some application events would prevent pause. */
|
||||
while (SDL_PollEvent(&event)) {}
|
||||
#endif
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
|
||||
/* Simple program: picks the offscreen backend and renders each frame to a bmp */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include <SDL3/SDL_opengl.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static SDL_Renderer *renderer = NULL;
|
||||
static SDL_Window *window = NULL;
|
||||
static int done = SDL_FALSE;
|
||||
@@ -85,7 +85,7 @@ static void loop(void)
|
||||
draw();
|
||||
save_surface_to_bmp();
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -94,7 +94,7 @@ static void loop(void)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
||||
Uint64 then, now;
|
||||
Uint32 frames;
|
||||
#endif
|
||||
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
||||
/* Main render loop */
|
||||
frames = 0;
|
||||
then = SDL_GetTicks();
|
||||
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
SDL_Log("Rendering %u frames offscreen\n", max_frames);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done && frames < max_frames) {
|
||||
|
||||
@@ -16,17 +16,17 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MOOSEPIC_W 64
|
||||
#define MOOSEPIC_H 88
|
||||
|
||||
@@ -285,7 +285,7 @@ static void loop(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
||||
SDL_Delay(fpsdelay);
|
||||
#endif
|
||||
|
||||
@@ -295,7 +295,7 @@ static void loop(void)
|
||||
}
|
||||
MoveSprites(state->renderers[i]);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -529,7 +529,7 @@ int main(int argc, char **argv)
|
||||
done = 0;
|
||||
|
||||
/* Loop, waiting for QUIT or RESIZE */
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, nodelay ? 0 : fps, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -11,17 +11,17 @@ freely.
|
||||
*/
|
||||
/* Simple program: Move N sprites around on the screen as fast as possible */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_test_font.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define MENU_WIDTH 120
|
||||
#define MENU_HEIGHT 300
|
||||
|
||||
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Main render loop */
|
||||
done = 0;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
|
||||
/* Simple program: Test relative mouse motion */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static int i, done;
|
||||
static float mouseX, mouseY;
|
||||
@@ -77,7 +77,7 @@ static void loop(void)
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
|
||||
rect.h = 10;
|
||||
/* Main render loop */
|
||||
done = 0;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
*/
|
||||
/* Simple program: Move N sprites around on the screen as fast as possible */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
|
||||
typedef struct
|
||||
@@ -105,7 +105,7 @@ static void loop(void)
|
||||
}
|
||||
Draw(&drawstates[i]);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -155,7 +155,7 @@ int main(int argc, char *argv[])
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
*/
|
||||
/* Simple program: Move N sprites around on the screen as fast as possible */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
|
||||
typedef struct
|
||||
@@ -199,7 +199,7 @@ static void loop(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
*/
|
||||
/* Simple program: Move N sprites around on the screen as fast as possible */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
|
||||
typedef struct
|
||||
@@ -92,7 +92,7 @@ static void loop(void)
|
||||
}
|
||||
Draw(&drawstates[i]);
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
*/
|
||||
/* Simple program: Move N sprites around on the screen as fast as possible */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "icon.h"
|
||||
|
||||
@@ -100,7 +100,7 @@ static void loop(void)
|
||||
}
|
||||
}
|
||||
MoveSprites();
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
|
||||
/* Main render loop */
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MOOSEPIC_W 64
|
||||
#define MOOSEPIC_H 88
|
||||
|
||||
@@ -124,7 +124,7 @@ static void loop(void)
|
||||
SDL_RenderTexture(renderer, MooseTexture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ int main(int argc, char **argv)
|
||||
/* Loop, waiting for QUIT or the escape key */
|
||||
frame = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
#include "SDL3/SDL.h"
|
||||
#include "SDL3/SDL_test.h"
|
||||
#include "SDL3/SDL_video_capture.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static const char *usage = "\
|
||||
\n\
|
||||
=========================================================================\n\
|
||||
@@ -62,7 +63,7 @@ update_fps(measure_fps_t *m)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__linux__) && !defined(__ANDROID__)
|
||||
#if defined(SDL_PLATFORM_LINUX) && !defined(SDL_PLATFORM_ANDROID)
|
||||
static void load_average(float *val)
|
||||
{
|
||||
FILE *fp = 0;
|
||||
@@ -663,7 +664,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* display status and FPS */
|
||||
if (!device) {
|
||||
#ifdef __IOS__
|
||||
#ifdef SDL_PLATFORM_IOS
|
||||
const float x_offset = 500;
|
||||
#else
|
||||
const float x_offset = 0;
|
||||
@@ -672,7 +673,7 @@ int main(int argc, char **argv)
|
||||
SDL_snprintf(buf, 256, "Device %d (%s) is not opened", current_dev, SDL_GetVideoCaptureDeviceName(get_instance_id(current_dev)));
|
||||
SDLTest_DrawString(renderer, x_offset + 10, 10, buf);
|
||||
} else {
|
||||
#ifdef __IOS__
|
||||
#ifdef SDL_PLATFORM_IOS
|
||||
const float x_offset = 500;
|
||||
#else
|
||||
const float x_offset = 0;
|
||||
@@ -714,7 +715,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* display load average */
|
||||
#if defined(__linux__) && !defined(__ANDROID__)
|
||||
#if defined(SDL_PLATFORM_LINUX) && !defined(SDL_PLATFORM_ANDROID)
|
||||
{
|
||||
float val = 0.0f;
|
||||
char buf[128];
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
#include "SDL3/SDL.h"
|
||||
#include "SDL3/SDL_test.h"
|
||||
#include "SDL3/SDL_video_capture.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
SDL_Window *window = NULL;
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
*/
|
||||
/* Simple program: Check viewports */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
|
||||
static SDL_Rect viewport;
|
||||
static int done, j;
|
||||
static SDL_bool use_target = SDL_FALSE;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
static Uint32 wait_start;
|
||||
#endif
|
||||
static SDL_Texture *sprite;
|
||||
@@ -109,7 +109,7 @@ static void loop(void)
|
||||
{
|
||||
SDL_Event event;
|
||||
int i;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
/* Avoid using delays */
|
||||
if (SDL_GetTicks() - wait_start < 1000) {
|
||||
return;
|
||||
@@ -148,7 +148,7 @@ static void loop(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -217,7 +217,7 @@ int main(int argc, char *argv[])
|
||||
done = 0;
|
||||
j = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
wait_start = SDL_GetTicks();
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
|
||||
#if defined(SDL_PLATFORM_ANDROID) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
freely.
|
||||
*/
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
#include <SDL3/SDL_test_font.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static int done;
|
||||
|
||||
@@ -248,7 +248,7 @@ static void loop(void)
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Main render loop */
|
||||
done = 0;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
|
||||
Reference in New Issue
Block a user