A7.70 - how to use video_aspect in C-Script?

Posted By: SchokoKeks

A7.70 - how to use video_aspect in C-Script? - 02/12/09 12:29

I thought that C-Script was still fully supported..

From version A7.66, there is this new feature:

Quote:

- View.aspect is now relative to the primary monitor format, instead of a theoretical 4:3 monitor. If this is undesired, set the compatibility variable to 7 or below.

- Wide screen video formats are now automatically selected when the primary monitor has a wide screen. If this is undesired, set video_aspect to 4/3 before the first frame.

http://manual.conitec.net/newfeatures70.htm

The problem is:
In C-Script, you can not execute code before the first frame. Setting video_aspect on the beginning of the main function leads so "video_aspect is read only" error. Giving it a value through redefining it (var video_aspect = 1.333;) doesn't have any effect. Setting compability to 7 doesn't to anything, neither.

So how can you have the engine start with non-widescreen resolutions on a system with a widescreen display, apart from calling video_set? For 2D Games, this behaviour is undesired.

Thanks,
SchokoKeks
Posted By: Ichiro

Re: A7.70 - how to use video_aspect in C-Script? - 02/17/09 02:18

I noticed you'd linked from the other thread (http://www.coniserver.net/ubb7/ubbthreads.php?ubb=showflat&Number=251892) -- did you find a workaround? This is causing us problems too.
Posted By: SchokoKeks

Re: A7.70 - how to use video_aspect in C-Script? - 02/17/09 11:46

no, the only workaround i can think of is starting the engine in a very small window (400 x 300 or something) and then call video_set to get it to the right resolution in fullscreen. an then set video.aspect to the right FOV. I don't know of the workaround with compatibility = 7 really works..

jcl is hopefully working on a solution, as he stated in the other thread.
Posted By: Ichiro

Re: A7.70 - how to use video_aspect in C-Script? - 02/17/09 17:24

Gotcha, thanks.
Posted By: SchokoKeks

Re: A7.70 - how to use video_aspect in C-Script? - 02/17/09 17:28

Just found this under beta-features:

Code:
V7.71b beta - in development 

video_aspect can now be re-defined for starting with the selected screen aspect under C-Script.

Posted By: JazzDude

Re: A7.70 - how to use video_aspect in C-Script? - 02/19/09 14:59

According to one of my beta testers this code from the forum works, but I don't have a wide-screen monitor so I haven't tested it personally.

Put it in the main function.

Code:
video_set(1024,768,24,1);
	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;
		}
		 if (desktopWidth/15 == desktopHeight/9)	//BrightView
		{
			video_set(1280,768,0,1);
			desktopWidth = 1280;
			desktopHeight = 768;
		}
		 if (desktopWidth/5  == desktopHeight/4)	//SXGA
		{
			video_set(1280,1024,0,1);
			desktopWidth = 1280;
			desktopHeight = 1024;
		}
		 if (desktopWidth/16 == desktopHeight/10)	//WSXGA+
		{
			video_set(1680,1050,0,1);
			desktopWidth = 1680;
			desktopHeight = 1050;	
		}
		else   //Window Mode
		{
			video_set(1024,768,32,2); 
			video_window(nullvector,nullvector,1,NULL);
			wait(1);	// must put this. not sure the reason
			desktopWidth = screen_size.x;
			desktopHeight = screen_size.y;
		}
	}

© 2024 lite-C Forums