is there a lite-c version for this windows_focus = 0?

Posted By: Darkyyes

is there a lite-c version for this windows_focus = 0? - 01/24/09 23:06

this is found on the wiki, i was wondering if anyone knows how to do this in lite-c?

Code:
cpu usage ~60%
var wndf=0;
starter pause_game_at_alt_tab()		//pause game on loose focus
{
	while (1)
	{
		if (window_focus == 0){
			if (!wndf){
				wndf=1;
//				camera.visible=off;
//				fps_max=4;
				freeze_mode = 1;
			}
		}else{
			if (wndf){
				freeze_mode = 0;
//				fps_max=40;
//				camera.visible=on;
				wndf=0;
			}
		}
		wait(1);
	}
}

restrict fps:
cpu usage ~7%
Code:

var wndf=0;
starter pause_game_at_alt_tab()		//pause game on loose focus
{
	while (1)
	{
		if (window_focus == 0){
			if (!wndf){
				wndf=1;
//				camera.visible=off;
				fps_max=4;
				freeze_mode = 1;
			}
		}else{
			if (wndf){
				freeze_mode = 0;
				fps_max=40;
//				camera.visible=on;
				wndf=0;
			}
		}
		wait(1);
	}
}

disable camera:
cpu usage ~0% !
Code:

var wndf=0;
starter pause_game_at_alt_tab()		//pause game on loose focus
{
	while (1)
	{
		if (window_focus == 0){
			if (!wndf){
				wndf=1;
				camera.visible=off;
				fps_max=4;
				freeze_mode = 1;
			}
		}else{
			if (wndf){
				freeze_mode = 0;
				fps_max=40;
				camera.visible=on;
				wndf=0;
			}
		}
		wait(1);
	}
}

Posted By: Ralph

Re: is there a lite-c version for this windows_focus = 0? - 01/24/09 23:34

Code:
var wndf=0;
function pause_game_at_alt_tab_startup()
{
	while (1)
	{
		if (window_focus == 0){
			if (!wndf){
				wndf=1;
				reset(camera,VISIBLE);
				fps_max=4;
				freeze_mode = 1;
			}
		}else{
			if (wndf){
				freeze_mode = 0;
				fps_max=40;
				set(camera,VISIBLE);
				wndf=0;
			}
		}
		wait(1);
	}
}

I tested it, it works!
Posted By: Darkyyes

Re: is there a lite-c version for this windows_focus = 0? - 01/25/09 00:02

where is it supposed to be in the scripts then? :S it sure aint working for me


EDIT: nevermind i got it to work
© 2023 lite-C Forums