I have been working on a game and have noticed a small problem. The game works perfectly so far, I was working on my options menu where I can switch from WINDOWED to a FULLSCREEN_WINDOW and FULLSCREEN. The game resolution is 800x600 and I use a transform and clipping to fit it to FULLSCREEN (Matthew's function):

Now my problem is in my game, when you press ESC a small menu pops up. In my game I copy the background game screen so when you move between menu items, the background is redrawn, then the menu. This works fine in WINDOWED and in FULLSCREEN_WINDOWED, but it FULLSCREEN the background ignores the clipping that was set in the above function and the background is drawn way off. So on a 1920x1080 screen, the upper left 800x600 is copied rather than the game screen.

Well, I think you'll need to keep track of the clipping coordinates if you want to do it like that.

However, I'd reccomend a different approach. I wouln't store the game screen in a buffer. Rather I'd redraw the game screen as usual and use a game state machine to see whether or not the menu is active or not. If the menu is active the game logic is paused, the menu is drawn and keystrokes are rerouted to interaction with the menu. If the menu is not active the menu is not drawn and the input is sent to the game input handler.

Like that, you don't need any extra bitmap buffers, and any menu you draw will scale in the same way as the game screen.

Okay, I managed to fix it. The solution was very simple. The scaling function which Matthew came up with has some variables that are set automatically originally for use with mouse movement which I can use to copy the game screen for use with this menu.

The variables offset_x, offset_y, scale_x, and scale_y all give the information needed to copy the screen properly in fullscreen mode.