The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: shaz on June 10, 2009, 10:23:20 PM

Title: [RESOLVED] Resolution on wide screen monitors
Post by: shaz on June 10, 2009, 10:23:20 PM
Does anyone know if it's possible, via script, to check the resolution of a monitor and change the game resolution accordingly?

If the game runs in a window, it's fine.  If it runs in widescreen on a monitor with an aspect ratio of 4:3, it's fine.  But on a widescreen monitor in full screen, the game is stretched and the characters look squashed and flat.

Is it possible to detect this, and if the aspect ratio is not 4:3, add black bars at the side so the image isn't stretched?
Title: Re: Resolution on wide screen monitors
Post by: Crab Buster on June 11, 2009, 05:51:40 AM
I've been making a game using a widescreen monitor for a while now and have a script that automatically runs the game on full screen when you playtest it. I took some screenshots the other day to post on a website and saw my game in the normal resolution and now everything looks squashed the other way. I had got so used to the widescreen monitor that my game doesn't look right in the correct resolution. Some rooms and the text are too thin, etc.
Saying that, I too, would be interested to know if this is possible.
Title: Re: Resolution on wide screen monitors
Post by: Zeriab on June 13, 2009, 02:05:04 AM
You can use GetSystemMetrics in user32 for that.
Ref: http://msdn.microsoft.com/en-us/library/ms724385(VS.85).aspx

Illustrary code:
SM_CXSCREEN = 0
SM_CYSCREEN = 1

user32 = Win32API.new('user32', 'GetSystemMetrics', ['I'], 'I')

w = user32.call(SM_CXSCREEN)
h = user32.call(SM_CYSCREEN)

p w,h


I hope you can figure out the rest ^_^

*hugs*
Title: Re: Resolution on wide screen monitors
Post by: shaz on June 13, 2009, 02:08:29 AM
ah, you're so helpful but so mean :D

ok - I know what you're getting by doing that, but what do you do with it?  Is it another call to the API to resize the "window" or do I have to do something to the viewport or something?
Title: Re: Resolution on wide screen monitors
Post by: Zeriab on June 13, 2009, 11:26:21 AM
You know I cannot simple give you the full answer.
There are resolution scripts out there. I suggest you take a look them.
You can calculate the size of the black borders from the information of the resolution.

Good luck.

*hugs*
Title: Re: Resolution on wide screen monitors
Post by: shaz on June 13, 2009, 11:28:30 PM
Well, you COULD simply give me the answer, but you're right - I should know you better than that :D

Thanks Zeriab.

I'm going to mark this one as resolved, even though I don't have the full solution yet.
Title: Re: [RESOLVED] Resolution on wide screen monitors
Post by: Grafikal on June 14, 2009, 01:12:42 AM
You should keep it open and let us know when ya do find your solution then you can post it here so that if other members have the same question they can refer to this topic. :)
Title: Re: [RESOLVED] Resolution on wide screen monitors
Post by: shaz on June 14, 2009, 01:15:13 AM
lol - I thought about that, but figured if Zeriab's making me work for it, other people can too :D

In truth, what I've found so far on the subject of changing resolution is script-invasive enough that I am unlikely to attempt to add it to the game at this stage.  I will put it on hold for another month or more.