Atlas - testbounds.c

Home / ext / SDL / test Lines: 1 | Size: 1639 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Copyright (C) 1997-2025 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 <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} 57
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.