Edit: using Allegro 5.0.7. I would try a newer version but I would need a precompiled binary for MingW-TDM 4.6.1
I have been doing more work on my Deluxe Pacman 2 level editor and I decided to code it so it loads in the same config file the main game uses. This way you can edit your levels in fullscreen mode etc as you prefer.
Anyhow, I use ALLEGRO_FULLSCREEN_WINDOW and transforms/clipping to scale the screen size up with a black border.
I just realized today that when my editor uses the same function to scale the screen up, that although the drawing is clipped, the mouse isn't. This has led my mouse code to not work, I have to click off to the left of where the buttons really are on screen to get them to work.
I can add code to adjust the mouse position if full screen, but... you never know what the resolution is that the person will be using. I am wondering if you have considered adding in mouse clipping in the same way there is screen clipping? I can move the mouse pointer into the black areas which looks a bit odd when the images displayed are clipped. I'm not entirely certain how to safe go about programming the mouse code for my buttons. It currently checks the region the buttons were drawn in, but the mouse doesn't match the drawing co-ordinates and as I said, you never know what the resolution will be that the person will run this on.
Any ideas, suggestion are welcome, thanks.
This isn't too important, but just so you know, I use the following code to fit my screen to the fullscreen mode mentioned;
1// Scale Screen:
2// Sets up transforms in order to fit any resolution
3// onto an ALLEGRO_FULLSCREEN_WINDOW.
5// (Special thanks to Matthew Leverton for help with this!)
9// usage: a5_scale_screen(BUFFER_WIDTH, BUFFER_HEIGHT, display_width, display_height);
14 // Calculate the horizontal and vertial aspect ratios
15 const float
16 const float
18 // The aspect ratio, x-offset and y-offset (in pixels)
ar, ox, oy;
22 if (
24 // 1:1, just reset everything
, bw, bh);
31 // Choose the smaller aspect ratio
32 if (
34 // horizontal bars on the top and bottom
ox = 0;
oy = (
dh - (
bh)) / 2
41 // vertical bars on the left and right
ox = (
dw - (
bw)) / 2
oy = 0;
47 // set up the transformation to scale and translate
t, ox, oy, ar, ar, 0);
51 // make sure nothing is drawn into the black bars
ox, oy, ar *
bw, ar *