Allegro 5.1.9 (GIT) -- al_set_new_window_position
Stagera

Hi,
I'm trying to create a 100*100 window in the middle of the screen. My resolution is 1920x1080.
I've set the upper-left corner at 960,540 but the windows is drawn further (Screenshot attached).

Maybe someone can help me out

#SelectExpand
1#include <stdio.h> 2#include <allegro5/allegro.h> 3 4int main(int argc, char **argv) 5{ 6 ALLEGRO_DISPLAY *display = NULL; 7 8 al_init(); 9 ALLEGRO_MONITOR_INFO info; 10 al_get_monitor_info(0, &info); 11 12 fprintf(stderr, "info.x1: %d -- info.x2: %d\n", info.x1,info.x2); 13 fprintf(stderr, "info.y1: %d -- info.y2: %d\n\n", info.y1,info.y2); 14 15 al_set_new_window_position(info.x2 / 2, info.y2 / 2); 16 fprintf(stderr, "set new window position: %d %d\n\n", info.x2 / 2, info.y2 / 2); 17 al_set_new_display_flags (ALLEGRO_FRAMELESS); 18 display = al_create_display(100, 100); 19 al_clear_to_color(al_map_rgb(0,0,0)); 20 al_flip_display(); 21 22 int x,y; 23 al_get_window_position(display, &x, &y); 24 fprintf(stderr, "get window position: %d %d\n\n", x, y); 25 26 al_rest(10.0); 27 28 al_destroy_display(display); 29 return 0; 30}

pkrcel

I can't really evaluate the apparent discrepancy from the screenshot

the top lef corner seems indeed a bit off....try drawing the window WITH the frame and check wehre that ends up drwan.

Stagera

Hi pkrcel,
the gap is always present, also when I draw the frame.

The screenshot refer to my last test. I did several.
With a bigger window it's more noticeable

Update
On Windows Seven/XP the window is correctly created in the middle of the screen
Displacement happens only on Windows 8 (8.1)

SiegeLord
Stagera said:

Displacement happens only on Windows 8 (8.1)

Damn, I was going to try to fix this, but I only have Windows 7 :-/.

Stagera

Also the window size is messed up on my Windows 8.1
The real size of a 100*100 window (no frame) is 125*125 pixel

Thread #613900. Printed from Allegro.cc