I can't get my window to center using dbSetWindowPosition(), it always offsets the window from the center of the screen. I'm using a simple code as such:
const int screen_width = dbScreenWidth();
const int screen_height = dbScreenHeight();
int window_width = 800;
int window_height = 600;
dbSetWindowSize(window_width, window_height);
//assuming the window x and y coordinates are at the top-left of the window
dbSetWindowPosition((screen_width / 2) - (window_width / 2), (screen_height / 2) - (window_height / 2));
I can find the exact values to use for centering, but I want options in my game to adjust screen size and resolution, and I don't want to store the exact values for each resolution, plus the user's screen size might be different - causing more problems.
So, why won't the window center perfectly? Is there something I'm not doing correctly? Also, where is the window registation point (for positioning)? Is it the top-left corner? Center of the window?
Thanks for any help on the subject,
-Mike
Wait... What were we talking about?