Page 1 of 1

Screen transition and loading new layout

PostPosted: Mon 8 Oct 2018, 14:02
by Pidipajt
I had an idea of adding a screen transition zelda1-style to my project (using GD 4 native, by the way).

I would like to have areas in the game in different external layouts because this make it easy to manage if I want to change things around.

So area 1-layout would be loaded into the main scene.
1: When leaving (to enter area 2) my idea was to capture a screenshot of the screen showing area 1.
2: Delete all objects from area 1-layout.
3: Load area 2-layout.
4: Move the camera so that area 2-layout is just off-screen in the direction the player is going.
5: Load the captured screenshot centered over the camera's position.
6: Make a camera-movement until area 2 is centered.

Now, this worked perfectly when playing in windows-mode. My game is running in 960x540 but my screen resolution is 1920x1080. When playing in fullscreen-mode the screen capture is capturing a 1920x1080-snapshot and this size is also used when putting the picture on-screen (number 5 above). Problem is that the rest of the game still works at 960x540 so the snapshot-size is wrong.

So, on to the question.

How do I manage the same result in another way?

One way would be to let area 1-layout still exist and load the area 2-layout right next to it. Then delete things from area1 when the camera is moved over. Problem is that you need to plan exactly on what pixel-coordinates the area 2-layout is supposed to exist. And you can't move layout around that easily as a result. Also when deleting stuff you will need to be specific exact instanse of objects to delete (say that the same enemy exists in both areas)

Or, can you make/resize the screenshot to match the size of the game-window before drawing to fullscreen?

Also, I actually planning to make the game in 426x240 (or what's the 16/9 equivalent of the 4/3's 320x240).
Is this resolution a bad choise because of how the fullscreen function works (how does it even work?!)?

Re: Screen transition and loading new layout

PostPosted: Mon 8 Oct 2018, 20:54
by Pidipajt
I realized there is a solution. And really easy.

When in fullscreen mode, scale the loaded screenshot after you load it.

I stored the info of the screen resolution in two variables (screenres_X and screenres_Y).
Then the scale factor is: "my game x resolution" / "screenres_X".
And then same for Y.

I was stuck thinking I needed to change the size before I fetched the image from the image-file..