A
alex19735
Guest
Hi, I am writing to ask about something I've been battling for a while. I want my game to use the resolution of the player's screen, but also remain the same scale. I don't want the game to look more zoomed out on larger resolutions. I do this by setting the camera's view size to the base resolution of my game (1280 by 720). This works well, however when scaling to, say, 1920x1080, the pixels get distorted, because 1920x1080 divided by 1280x720 is 1.5. How can I scale the game view to match the device's resolution, without getting pixel distortion?
This is the game in windowed mode, where there is no scaling:
And here it is in fullscreen, scaled to 1920x1080:
I've noticed that the GUI Layer does not suffer from this problem, and it scales perfectly! So surely there must be a way to scale 1280x720 to 1920x1080 without any pixel distortion?
Thank you in advance, and sorry if I explained things badly, I don't really know how to word this any better.
Code:
view_wport[0] = displayWidth;
view_hport[0] = displayHeight;
if (view_get_wport(0) != displayWidth){
view_set_wport(0, baseWidth);
view_set_hport(0, baseHeight);
camera_set_view_size(view_camera[0], baseWidth, baseHeight);
}
if (surface_get_height(application_surface)!=displayHeight){
surface_resize(application_surface, displayWidth, displayHeight);
}
And here it is in fullscreen, scaled to 1920x1080:
I've noticed that the GUI Layer does not suffer from this problem, and it scales perfectly! So surely there must be a way to scale 1280x720 to 1920x1080 without any pixel distortion?
Thank you in advance, and sorry if I explained things badly, I don't really know how to word this any better.