Legacy GM Pixel Perfect GUI?

A

AttaBoy

Guest
My game runs at a resolution of 384x216, but is obviously upscaled to higher resolutions. Fortunately, all the logic and normal drawing is pixel perfect, as I stretch the canvas in the post draw. I resize my GUI to be 384x216, and while that draws sprites properly, it allows for subpixel transformations. For example, it can draw text misaligned from the grid, or draw rectangles and shapes with subpixels despite the actual sprites drawn to the GUI looking fine (although drawing them with decimal values of image_xscale or image_yscale creates subpixels as well). Is there any way to draw to the GUI and guarantee that it will produce pixel perfect results?
 

RangerX

Member
Are you using the GUI layer?
If you want to be use to be at the same pixel depth/dpi/size/scale as the game itself, do not use it and draw it over everything but on the application surface.
This is an easy/nobrainer solution though. There might be a more elegant one.
 
M

Monsi

Guest
so long as you don't change display_set_gui_size, drawing to the GUI will always be pixel perfect if you draw at 1x scale and with values that aren't decimals.
 
A

AttaBoy

Guest
I unfortunately do sometimes use decimal values, so I might have to try the suggestion to find a way to draw above everything else. Shouldn't be too terrible I hope
 

RangerX

Member
Its a choice you have. Its not like there are other options. Its either you use integer values and you never have graphical issues or you use decimals and live with the consequences. There's no magic there.
I invite you to read my tutorial on scaling if you didn't already. I might, at least, help you understand the type of issues you're currently facing and help you solve the problem in a way that can fit your expectations.

https://forum.yoyogames.com/index.php?threads/how-to-properly-scale-your-game.995/
 

Yal

šŸ§ *penguin noises*
GMC Elder
One trick I'm using in my current project is having one version of each font per possible screen resolution upscale (1x, 2x and 3x) and resizing the GUI layer so that it's 1:1 to the view on screen, so when the window is 2x upscaled the GUI is twice as big as the game canvas. That lets me have really crisp fonts and such even when the canvas is resized 3x, it had really nasty artefacting (especially on fonts) before I figured out the system. (Obviously I draw sprites at 1x, 2x or 3x scale as well, and upscale GUI element coordinates to match)
 
Top