• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

GML Why does a copy of application_surface look scaled?

Paskaler

Member
So, I tried making a pause function within the game. All the objects get deactivated except the obj_pause itself and obj_environment which takes care of the background scrolling. Right before I deactivate everything I make a copy of application_surface using:
Code:
surface_copy(self.screen, 0, 0, application_surface)
Below are two images, taken at the same location:

Before pausing:
unpause.PNG

After pausing:
pause.PNG

Here's the entire code of the event where the surface is copied:

Code:
self.isPaused = !self.isPaused;

if (self.isPaused)
{
    if (!surface_exists(self.screen))
        self.screen = surface_create(surface_get_width(application_surface), surface_get_height(application_surface));

    surface_copy(self.screen, 0, 0, application_surface);
   
    instance_deactivate_all(true);
    instance_activate_object(obj_environment);
    instance_activate_object(obj_camera);
}
else
{
    instance_activate_all();

    self.manual = false;
   
    if (surface_exists(self.screen))
        surface_free(self.screen);
}
 
Chances are you've set up views in the room editor and changed the port size of your game to be different from your view.

When you do this, this changes the size of the application surface to be the size of your port, not the size of your view, so it will be much bigger. You can either resize your application surface at game start to be the same size as your view, or resize the window size with code rather than using the port settings. I have a comprehensive tutorial on all things view and scaling in GMS on my youtube channel (and posted under the tutorials section here on the GMC if you have further questions).
 

Paskaler

Member
Thank you for the lightning fast replies! I have the port scaled to be twice the size of the view. I'll try to fix it first thing in the morning and I'll be sure to check out the tutorials as well.
 
A

Ampersand

Guest
I found the default application_surface so picky about built in variables and constants that I found it easier to make my own graphics buffer and view system. ymmv.
 

RangerX

Member
Thank you for the lightning fast replies! I have the port scaled to be twice the size of the view. I'll try to fix it first thing in the morning and I'll be sure to check out the tutorials as well.
Scale your game by the application surface and not port on screen. This is an example of multiple problems you will spare yourself. ;)
 
Top