Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 635 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
is there a lite-c version for this windows_focus = 0? #248153
01/24/09 23:06
01/24/09 23:06
Joined: Jun 2007
Posts: 152
Norway
D
Darkyyes Offline OP
Member
Darkyyes  Offline OP
Member
D

Joined: Jun 2007
Posts: 152
Norway
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);
	}
}


Last edited by Darkyyes; 01/24/09 23:06.

New to lite-c and gamestudio in general, thank you for reading.
Com, A7 v7.7
Re: is there a lite-c version for this windows_focus = 0? [Re: Darkyyes] #248162
01/24/09 23:34
01/24/09 23:34
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Ralph Offline
Senior Member
Ralph  Offline
Senior Member

Joined: Feb 2006
Posts: 385
Oldenburg,Germany
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!

Re: is there a lite-c version for this windows_focus = 0? [Re: Ralph] #248165
01/25/09 00:02
01/25/09 00:02
Joined: Jun 2007
Posts: 152
Norway
D
Darkyyes Offline OP
Member
Darkyyes  Offline OP
Member
D

Joined: Jun 2007
Posts: 152
Norway
where is it supposed to be in the scripts then? :S it sure aint working for me


EDIT: nevermind i got it to work

Last edited by Darkyyes; 01/25/09 01:18. Reason: fixed

New to lite-c and gamestudio in general, thank you for reading.
Com, A7 v7.7

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