• 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!

GameMaker [Solved] Need to find a way to get the real view width/height...

A

Ayziak

Guest
Hey all,
My game window is resizable, and set to keep its aspect ratio, so if I manually drag it to a certain size, it will have black bars on either side or the top and bottom.
I need a way to get the value of the height of the window, but excluding the black bars. Basically, is there any constant for the real height of the game?
(e.g. window_get_height() is the full height of the window with the bars.)

Thanks!
P.S. Would this work with fullscreen mode too?
 
Last edited by a moderator:
A

Ayziak

Guest
Nvm, I found a solution. to all others wondering (if any):
Code:
//Messy code, I know.
if window_get_height()/view_hport < window_get_width()/view_wport
{
BarsOn = "Side"
}
else if window_get_height()/view_hport > window_get_width()/view_wport
{
BarsOn = "Top"
}
else if window_get_height()/view_hport = window_get_width()/view_wport
{
BarsOn = "Null"
}

if BarsOn = "Side" {TrueGameWindowHeight = window_get_height()}
else if BarsOn = "Top" {TrueGameWindowHeight = (window_get_width()/view_wport)*view_hport}
 
Top