Locating Window on screen
AceBlkwell

All,

My program uses a smaller display than the machine's screen size. By placing a marker on the computer screen it appears the program starts at the same screen upper LH coordinates regardless of what size display the program is using. The problem is if the program alters the display to a larger size display, say 1600x900, a portion of the program is off computer screen.

I write to the buffer then use

al_draw_scaled_bitmap(buffer, 0, 0, nBufferWD, nBufferHT, 0, 0, nDispWD, nDispHT, 0);

After this I flip the display.

I guess essentially I'm asking is there a way of having the program window start in a given location on the screen.

Thanks.

DanielH

It's usually centered. There is no Allegro4 way to do that. You would have to use platform specific functions.

Are you using 4 or 5? You could set resize limits with 5.

LennyLen
DanielH said:

Are you using 4 or 5?

A5 going by the function used.

AceBlkwell

Allegro 5

You know, I'm running the program from a compiler. I wonder if that it contributing. In any case, I'm including a couple pictures that might help define the problem.

Nevermind, it doesn't look like the site is gong to let me upload pictures.

DanielH

You can upload pics. However, weird. you must upload pics. save post to establish correct links. Then re-edit pics to get correct urls.
Edit: maybe not. Doesn't seem to work.

void al_set_window_position(ALLEGRO_DISPLAY *display, int x, int y);
bool al_set_window_constraints(ALLEGRO_DISPLAY *display, int min_w, int min_h, int max_w, int max_h);
void al_apply_window_constraints(ALLEGRO_DISPLAY *display, bool onoff);

These are not guaranteed, but will attempt

AceBlkwell

I'll give it a shot. Today I ran the program without the compiler. The window upper LH corner is in the same place with the same results. So, not a compiler thing. Thanks for the info.

DanielH

Compiler shouldn't matter. Default is center of screen when starting app.

Edgar Reynaldo
AceBlkwell

Thanks guys. I had luck with the

al_set_window_position(ALLEGRO_DISPLAY *display, int x, int y);

command. I appreciate the help.

Thread #618917. Printed from Allegro.cc