I noticed this issue when demoing a program I wrote on another person's machine. Took me a while to figure out why seemingly everything was wrong with the size of the window/coordinates etc.
So Windows appears to scale everything with this setting and it makes my program go offscreen etc was wondering what the usual counter to this is.
Although I don't have access to a development environment right now I pulled this code off an archive of my project:
Currently I allow non-square pixels by scaling width and height by independent integer amounts.
#define GAME_WIDTH 384 // undecided, 5x4 stretch ratio with rectangular pixels achieves 16:9 screen #define GAME_HEIGHT 270
So, what can I do about this?
Can you describe what went wrong? The expected behavior is for Allegro to create windows with the specified pixel sizes, which means that Allegro will essentially ignore that scaling setting. Are you observing something else?
Yes, I think Allegro basically thought the device size was that much larger so when I tried to center the window it was offscreen and also the maximum size was bigger than the actual available screen size.
I can't remember the syntax for highlighting a line in code on here.
Because my calculations are relative to monitor size maybe I need to do something different here?
/* Monitor info */ al_get_monitor_info(0, &info); DeviceWidth = info.x2 - info.x1; DeviceHeight = info.y2 - info.y1;
Do you have the source available to this game? I'm struggling to understand what you're trying to accomplish here. I checked, and al_get_monitor_info returns the correct values. I can believe al_set_window_position might be broken, I'll test that.
I authored it but been on hiatus since 2017. I have access to the code but no IDE at the moment
What I wanted (and had been working as expected until that Windows issue) was the ability to have automatic scaling options or manual scaling to change shape of pixels to preference (retro)
With automatic selected it detects the screen size and will make the game area as big as possible in integer scaled amounts without going offscreen. For 16:9 ratio this will not be square pixels so can manually adjust scale for square pixels, but less screen coverage.
When I resize a windowed screen I re-center it on the device
Admittedly I can't specifically remember if the game size itself was bigger due to the window scaling but I definitely know the centering was wrong (as though it thought the screen was bigger) but could've been due to an oversight in my code or something.