testbounds.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
  3. This software is provided 'as-is', without any express or implied
  4. warranty. In no event will the authors be held liable for any damages
  5. arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it
  8. freely.
  9. */
  10. #include "SDL.h"
  11. int main(int argc, char **argv)
  12. {
  13. int total, i;
  14. if (SDL_Init(SDL_INIT_VIDEO) < 0) {
  15. SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError());
  16. return 1;
  17. }
  18. total = SDL_GetNumVideoDisplays();
  19. for (i = 0; i < total; i++) {
  20. SDL_Rect bounds = { -1,-1,-1,-1 }, usable = { -1,-1,-1,-1 };
  21. SDL_GetDisplayBounds(i, &bounds);
  22. SDL_GetDisplayUsableBounds(i, &usable);
  23. SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}",
  24. i, SDL_GetDisplayName(i),
  25. bounds.x, bounds.y, bounds.w, bounds.h,
  26. usable.x, usable.y, usable.w, usable.h);
  27. }
  28. SDL_Quit();
  29. return 0;
  30. }
  31. /* vi: set ts=4 sw=4 expandtab: */