Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (TipmyPip, AndrewAMD, Quad, aliswee, degenerate_762), 970 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Add support for most standard and widescreen resolutions #213291
06/26/08 20:28
06/26/08 20:28
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
I've just finished a code that will allow you to change to widescreen (16:9 and 16:10) resolutions as well as most 4:3 Standard resolutions.

First off, add this somewhere near the beginning of your code:

Code:
////////wide should be set to:
////////0 - Standard
////////1 - 16:9 Widescreen
////////2 - 16:10 Widescreen
function set_resolution(res_,wide_,_depth,_window)
{
	var new_ratio;
	var x_;
	var y_;
	var view_aspect;
	if (res_ == 0) { video_set(0,0,_depth, _window); return; }
	if (wide_ == 0 || _window == 2)
	{
		if (res_ == 1)
		{
			x_ = 640;
			y_ = 480;
		}
		if (res_ == 2)
		{
			x_ = 800;
			y_ = 600;
		}
		if (res_ == 3)
		{
			x_ = 1024;
			y_ = 768;
		}
		if (res_ == 4)
		{
			x_ = 1280;
			y_ = 960;
		}
		if (res_ == 5)
		{
			x_ = 1280;
			y_ = 1024;
		}
		if (res_ == 6)
		{
			x_ = 1400;
			y_ = 1050;
		}
		if (res_ == 7)
		{
			x_ = 1600;
			y_ = 1200;
		}
	}
	else
	{
		if (wide_ == 1)
		{
			if (res_ == 1)
			{
				x_ = 848;
				y_ = 480;
			}
			if (res_ == 2)
			{
				x_ = 960;
				y_ = 600;
			}
			if (res_ == 3)
			{
				x_ = 1088;
				y_ = 612;
			}
			if (res_ == 4)
			{
				x_ = 1280;
				y_ = 720;
			}
			if (res_ == 5)
			{
				x_ = 1360;
				y_ = 768;
			}
			if (res_ == 6)
			{
				x_ = 1600;
				y_ = 900;
			}
			if (res_ == 7)
			{
				x_ = 1920;
				y_ = 1080;
			}
		}
		if (wide_ == 2)
		{
			if (res_ == 1)
			{
				x_ = 640;
				y_ = 400;
			}
			if (res_ == 2)
			{
				x_ = 960;
				y_ = 600;
			}
			if (res_ == 3)
			{
				x_ = 1280;
				y_ = 768;
			}
			if (res_ == 4)
			{
				x_ = 1280;
				y_ = 800;
			}
			if (res_ == 5)
			{
				x_ = 1600;
				y_ = 1024;
			}
			if (res_ == 6)
			{
				x_ = 1680;
				y_ = 1050;
			}
			if (res_ == 7)
			{
				x_ = 1920;
				y_ = 1200;
			}
		}
	}
	video_set(x_, y_, _depth, _window);
	wait(1);
	new_ratio = x_ / y_;
	view_aspect = new_ratio / (4/3);
	camera.aspect = view_aspect;
}


Explanation of use:

set_resolution (res_number, widescreen, video_depth, window);

Res_Number: This area sets the resolution, similar to video_switch, the resolutions are as follows:

0 - No change in resolution

If widescreen set to 0 (4:3 Standard):
1 - 640x480
2 - 800x600
3 - 1024x768
4 - 1280x960
5 - 1280x1024
6 - 1400x1050
7 - 1600x1200

If widescreen set to 1 (16:9 Widescreen):
1 - 848x480
2 - 960x600
3 - 1088x612
4 - 1280x720
5 - 1360x768
6 - 1600x900
7 - 1920x1080

If widescreen set to 2 (16:10 Widescreen):
1 - 640x400
2 - 960x600
3 - 1280x768
4 - 1280x800
5 - 1600x1024
6 - 1680x1050
7 - 1920x1200

Widescreen: When this is set it will allow you to change the res_number to use widescreen resolutions rather than 4:3.

Use:
0 - Use 4:3 Standard aspect ratio
1 - Use 16:9 Widescreen aspect ratio
2 - Use 16:10 Widescreen aspect ratio

Video_Depth : set the video depth:
0 - No change
16 - 16-bit mode
32 - 32-bit mode

Window:
0 - Don't change window mode
1 - Set to fullscreen mode
2 - Set to windowed mode

The code is intended to kind of "replace" the video_switch function and should be used in the same way. Hopefully this is a good enough explanation. If it's possible could this become a sticky? I think this would be really helpful.
Special thanks to Grafton, Inestical, and FlorianP for submitting resolutions.
This is based on Xarthor's aspect ratio fix, so thanks to him as well.


- aka Manslayer101
Re: Add support for most standard and widescreen resolutions [Re: mpdeveloper_B] #213295
06/26/08 20:48
06/26/08 20:48
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Thanks for this code contribution, but it lacks one important thing:
the view.aspect value remains unchanged, but it needs to be change to have a real widescreen resolution, otherwise its just "stretched" and doesn't look right.

Re: Add support for most standard and widescreen resolutions [Re: Xarthor] #213301
06/26/08 21:26
06/26/08 21:26
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
i'll be adding the aspect thing you contributed to jazzDude smile

also if anyone wants to convert it to lite-c as well it'd be helpful for any lite-c users

edit: aspect fix done

Last edited by mpdeveloper_B; 06/26/08 21:38.
Re: Add support for most standard and widescreen resolutions [Re: mpdeveloper_B] #213309
06/26/08 22:37
06/26/08 22:37
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
change function to this and it goes lite-c laugh

function set_resolution(int res_,int wide_,int _depth,int _window)


3333333333
Re: Add support for most standard and widescreen resolutions [Re: Quad] #213315
06/26/08 23:53
06/26/08 23:53
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
laugh i'll add that in the post, or you could post it in lite-c contributions laugh


- aka Manslayer101
Re: Add support for most standard and widescreen resolutions [Re: mpdeveloper_B] #216857
07/19/08 08:28
07/19/08 08:28
Joined: Aug 2005
Posts: 1,230
M
MichaelGale Offline
Serious User
MichaelGale  Offline
Serious User
M

Joined: Aug 2005
Posts: 1,230
Please don't use the "notify moderator" button if you wish to make a post sticky. If the moderator team or an administrator considers a post especially useful or important, we will make it sticky. This post, however, is useful, but not useful enough to become a sticky post. To be honest, I think this request was a bit ridiculous wink


Your friendly mod is at your service.
Re: Add support for most standard and widescreen resolutions [Re: MichaelGale] #216881
07/19/08 13:43
07/19/08 13:43
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
Just saw this, awesomeness!

Thanks for the contribution!


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1