• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

screen resolution and window size

  • Thread starter gibberingmouther
  • Start date
G

gibberingmouther

Guest
i know i can use window_set_size(width, height) to set the size of the game window. then if i could depend on that always being the same, i could just use exact coordinates for drawing my GUIs. but what i have inferred from looking at other peoples' code is that you can't depend on a screen always being the same size, so you have to use window height and window width variables to set the window size.

do i understand this correctly or can i depend on the window being a specific size? is there some way in GML to change the screen resolution? or to just set it to maximum if you want to make the game make use of the maximum screen resolution, though in that case you again have to use variables which is annoying. what is the standard practice for games?
 
P

Pelican

Guest
I've seen in a number of games that they usually have a screen resolution option at the start, allowing you to choose from a number of options for your screen size (640x480, 800x600, 1366x768 etc.), which then changes the size of the window when the game plays. So having a set of options before the starting screen of your game may help people be able to get it to the size you want.

Otherwise if you want to calculate the width and height of the display automatically without the options, the functions display_get_width() and display_get_height() to calculate the size of the display, and display_get_dpi_x() and display_get_dpi_y() to get the resolution calculations for the screen. To get the same aspect ratio each time maybe you could calculate the width of the screen, and multiply it by the ratio you want to get the best height for that specific screen?

Here's all the functions if you need them: https://docs.yoyogames.com/source/dadiospice/002_reference/windows and views/index.html
 
Top