Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Aku_Aku, ozgur), 1,095 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
the widescreen trick (aspect) #208893
05/30/08 13:29
05/30/08 13:29

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



User of widescreen monitors see a distorted game if the programmer did not offers a necessary resolution.

If you want to offer at least the right aspects for all types of monitors you can use the following code to set the right camera aspect.

Code:
var gv_scr_width;
var gv_scr_height;

//...

// before resolution change
gv_scr_width=sys_metrics(0);
gv_scr_height=sys_metrics(1);	

// set the resolution here
// ...
	
// set aspect
camera.aspect=(screen_size.y/screen_size.x)/(gv_scr_height/gv_scr_width);


Re: the widescreen trick (aspect) [Re: ] #209200
06/01/08 20:40
06/01/08 20:40
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Looks like a nice snippet, but it is only possible with light-c, I guess, isn't it?

Re: the widescreen trick (aspect) [Re: Pappenheimer] #209236
06/02/08 04:10
06/02/08 04:10

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



Hi Pappenheimer!

What part you think wont work with c-script and why? wink

Re: the widescreen trick (aspect) [Re: ] #209263
06/02/08 08:32
06/02/08 08:32
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Sorry, found it in the manual of A7. I'm currently still working with A6 - that's why I didn't find sys_metrics in the manual!

Re: the widescreen trick (aspect) [Re: Pappenheimer] #217076
07/21/08 08:08
07/21/08 08:08
Joined: Jun 2008
Posts: 91
C
Coisox Offline
Junior Member
Coisox  Offline
Junior Member
C

Joined: Jun 2008
Posts: 91
I cant get it right. All my panels are displayed at the correct ratio but not the 3D objects.

Here's my code:

desktopWidth = sys_metrics(0);
desktopHeight = sys_metrics(1);
video_set(desktopWidth,desktopHeight,0,1);
camera.aspect=(screen_size.y/screen_size.x)/(desktopHeight/desktopWidth);

BTW, doesn't it same between screen_size.y vs desktopHeight?

Re: the widescreen trick (aspect) [Re: Coisox] #217079
07/21/08 08:31
07/21/08 08:31

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



sys_metrics(0) and sys_metrics(1) represents the current monitor resolution (before the Engine starts).

video_set sets the engine window size.

You make the engine window the same size like the monitor size (ignoring the aspects) because you set the size BEFORE getting the aspect ratio.
Afterwards screen_size.y of cause is equal desktopHeight.

Re: the widescreen trick (aspect) [Re: Coisox] #217080
07/21/08 09:19
07/21/08 09:19
Joined: Jun 2008
Posts: 91
C
Coisox Offline
Junior Member
Coisox  Offline
Junior Member
C

Joined: Jun 2008
Posts: 91
Yeah!! I found my solution and lets share smile
Note: I put this at the first line of main( ) function.

What this code do? Change the resolution to the user native resolution IF, the screen wide up to 1680. If the user use bigger screen, change the resolution into their respective category. If the user use "strange" resolution, just make it window mode to be on the safe side.

The reason I limit the resolution for super big monitor is because they'll have huge advantage. Imagine you make a side scrolling game, of course wider screen will see the enemy sooner and have "more time" to avoid enemy attack.
Code:
desktopWidth = sys_metrics(0);
desktopHeight = sys_metrics(1);

if (desktopWidth<1681) video_set(desktopWidth,desktopHeight,0,1);
else
{
	if 	(desktopWidth/4  == desktopHeight/3)	//Classic
	{
		video_set(1024,768,0,1);
		desktopWidth = 1024;
		desktopHeight = 768;
	}
	else if (desktopWidth/15 == desktopHeight/9)	//BrightView
	{
		video_set(1280,768,0,1);
		desktopWidth = 1280;
		desktopHeight = 768;
	}
	else if (desktopWidth/5  == desktopHeight/4)	//SXGA
	{
		video_set(1280,1024,0,1);
		desktopWidth = 1280;
		desktopHeight = 1024;
	}
	else if (desktopWidth/16 == desktopHeight/10)	//WSXGA+
	{
		video_set(1680,1050,0,1);
		desktopWidth = 1680;
		desktopHeight = 1050;	
	}
	else						//Window Mode
	{
		video_mode = 8;
		video_window(nullvector,nullvector,1,NULL);
		wait(1);	// must put this. not sure the reason
		desktopWidth = screen_size.x;
		desktopHeight = screen_size.y;
	}
}

float fAspect = desktopWidth/desktopHeight;
camera.aspect = fAspect / 1.333333; // Not sure why have to hard code


Re: the widescreen trick (aspect) [Re: ] #217081
07/21/08 09:24
07/21/08 09:24
Joined: Jun 2008
Posts: 91
C
Coisox Offline
Junior Member
Coisox  Offline
Junior Member
C

Joined: Jun 2008
Posts: 91
Originally Posted By: mercuryus

You make the engine window the same size like the monitor size (ignoring the aspects) because you set the size BEFORE getting the aspect ratio.
Afterwards screen_size.y of cause is equal desktopHeight.


Oh I see... so your solution is like this?

var gv_scr_width;
var gv_scr_height;

// before resolution change
gv_scr_width=sys_metrics(0);
gv_scr_height=sys_metrics(1);

// set aspect
camera.aspect=(screen_size.y/screen_size.x)/(gv_scr_height/gv_scr_width);

// change the resolution here

Re: the widescreen trick (aspect) [Re: Coisox] #217082
07/21/08 09:32
07/21/08 09:32

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



I meant to use the default GS-resoltions (4:3) from video_mode in my initial coding.


Last edited by mercuryus; 07/21/08 09:40.

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