The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_WINDOWPOS_CENTERED and SDL_WINDOWPOS_CENETERED_DISPLAY
trevor.shawn.williams


Joined: 07 Nov 2014
Posts: 6
I've noticed the value provided by the two macros named in the title are extremely large numbers seemingly well outside my display limits. For example: on my 1920x1080 display, SDL_WINDOWPOS_CENTERED may say the center of the screen is at something like 850903404879. There's no problem; the value works as desired. I'm just wondering where SDL gets them. I've tried converting the value to Hex, Octal, and a number of other formats already. No dice. What I haven't done is dive into the platform specific functions under SDL. Does anyone know what this is about and want to save me that trouble? I'm just curious.
SDL_WINDOWPOS_CENTERED and SDL_WINDOWPOS_CENETERED_DISPLAY
Jonas Kulla
Guest

The macros don't give you the actual coordinates for a centered window. Instead they resolve

to specific key values that SDL recognizes and acts upon. It's like passing -1 to a function

expecting a string length: you don't actually mean to say "this string is -1 characters long",

but instead the function understands that -1 means "the string is null terminated".


If you look into SDL_video.h, you'll see that all the macro does is OR the display index

with 0x2FFF0000.



2015-02-20 3:52 GMT+01:00 trevor.shawn.williams:
Quote:
I've noticed the value provided by the two macros named in the title are extremely large numbers seemingly well outside my display limits. For example: on my 1920x1080 display, SDL_WINDOWPOS_CENTERED may say the center of the screen is at something like 850903404879. There's no problem; the value works as desired. I'm just wondering where SDL gets them. I've tried converting the value to Hex, Octal, and a number of other formats already. No dice. What I haven't done is dive into the platform specific functions under SDL. Does anyone know what this is about and want to save me that trouble? I'm just curious.



"You all look like lions to me. Lets be rabbits again."


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org