summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-3.2.20/test/testbounds.c
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-08-30 16:53:58 -0700
committer3gg <3gg@shellblade.net>2025-08-30 16:53:58 -0700
commit6aaedb813fa11ba0679c3051bc2eb28646b9506c (patch)
tree34acbfc9840e02cb4753e6306ea7ce978bf8b58e /src/contrib/SDL-3.2.20/test/testbounds.c
parent8f228ade99dd3d4c8da9b78ade1815c9adf85c8f (diff)
Update to SDL3
Diffstat (limited to 'src/contrib/SDL-3.2.20/test/testbounds.c')
-rw-r--r--src/contrib/SDL-3.2.20/test/testbounds.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/test/testbounds.c b/src/contrib/SDL-3.2.20/test/testbounds.c
new file mode 100644
index 0000000..083772a
--- /dev/null
+++ b/src/contrib/SDL-3.2.20/test/testbounds.c
@@ -0,0 +1,56 @@
1/*
2 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely.
11*/
12
13#include <SDL3/SDL.h>
14#include <SDL3/SDL_main.h>
15#include <SDL3/SDL_test.h>
16
17int main(int argc, char **argv)
18{
19 SDL_DisplayID *displays;
20 int i;
21 SDLTest_CommonState *state;
22
23 /* Initialize test framework */
24 state = SDLTest_CommonCreateState(argv, 0);
25 if (!state) {
26 return 1;
27 }
28
29 /* Parse commandline */
30 if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
31 return 1;
32 }
33
34 if (!SDL_Init(SDL_INIT_VIDEO)) {
35 SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError());
36 return 1;
37 }
38
39 displays = SDL_GetDisplays(NULL);
40 if (displays) {
41 for (i = 0; displays[i]; i++) {
42 SDL_Rect bounds = { -1, -1, -1, -1 }, usable = { -1, -1, -1, -1 };
43 SDL_GetDisplayBounds(displays[i], &bounds);
44 SDL_GetDisplayUsableBounds(displays[i], &usable);
45 SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}",
46 i, SDL_GetDisplayName(displays[i]),
47 bounds.x, bounds.y, bounds.w, bounds.h,
48 usable.x, usable.y, usable.w, usable.h);
49 }
50 SDL_free(displays);
51 }
52
53 SDL_Quit();
54 SDLTest_CommonDestroyState(state);
55 return 0;
56}