Debian Codegraph @

test/testbounds.c

raw
1 /*
2 Copyright (C) 1997-2026 Sam Lantinga <[email protected]>
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 "SDL.h"
14 #include "SDL_test.h"
15
16 int main(int argc, char **argv)
17 {
18 int total, i;
19 SDLTest_CommonState *state;
20
21 state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
22 if (!state) {
23 SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDLTest_CommonCreateState failed: %s\n", SDL_GetError());
24 return 1;
25 }
26
27 /* Enable standard application logging */
28 SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
29
30 if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
31 return 1;
32 }
33
34 if (!SDLTest_CommonInit(state)) {
35 SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError());
36 return 1;
37 }
38
39 total = SDL_GetNumVideoDisplays();
40 for (i = 0; i < total; i++) {
41 SDL_Rect bounds = { -1, -1, -1, -1 }, usable = { -1, -1, -1, -1 };
42 SDL_GetDisplayBounds(i, &bounds);
43 SDL_GetDisplayUsableBounds(i, &usable);
44 SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}",
45 i, SDL_GetDisplayName(i),
46 bounds.x, bounds.y, bounds.w, bounds.h,
47 usable.x, usable.y, usable.w, usable.h);
48 }
49
50 SDLTest_CommonQuit(state);
51 return 0;
52 }
53
54 /* vi: set ts=4 sw=4 expandtab: */
55