Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/26/24 12:45
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (henrybane, 1 invisible), 775 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Show minutes and seconds [Re: WretchedSid] #351010
12/20/10 23:44
12/20/10 23:44
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
I'd just use a timer function for a timer...
Code:
#include <acknex.h>
#include <default.c>

long lng_total;
var var_secs;
var var_mins;
var var_hours;

FONT* fnt_timer = "arial#24";

PANEL* pnl_timer = {
	
	digits( 60, 60, "%02.0f", fnt_timer, 1, var_mins);
	digits(100, 60, "%02.0f", fnt_timer, 1, var_secs);
	flags = SHOW;
}

void restart_timer(){
	
	proc_mode = PROC_LATE;
	lng_total = 0; //nanoseconds set to something to speed up time (55000 55seconds)
	timer();
}

void main(){
	
	timer();
	on_mouse_left = restart_timer;
	while(1){
		
		lng_total += timer() / 1000;
		
		var_secs = integer((lng_total / 1000) % 60);
		var_mins = integer((lng_total / 1000) / 60);
		
		wait(1);
	}
}



Re: Show minutes and seconds [Re: MrGuest] #351033
12/21/10 07:02
12/21/10 07:02
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Too bad that timer doesn't work between two frames, right?
I srsly don't know why you all think you'd need to put out a minigun to destroy everything helpful on you way.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Show minutes and seconds [Re: WretchedSid] #351047
12/21/10 11:50
12/21/10 11:50
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Originally Posted By: JustSid
Too bad that timer doesn't work between two frames, right?
I srsly don't know why you all think you'd need to put out a minigun to destroy everything helpful on you way.
lol, not really a minigun but just a way to offer a precision timer... your way only offers precision to a 16th of a second.

Also you'll need to convert seconds and minutes to an integer otherwise they'll be added when they're 0.5 or over

What do you mean that timer doesn't work between two frames?

Re: Show minutes and seconds [Re: WretchedSid] #351090
12/21/10 19:32
12/21/10 19:32
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Originally Posted By: JustSid
Rojart, thats evil because you assume that the user always has 60 frames per seconds.

JustSid, I see no problem to change the fps like this:

Code:
#include <default.c>
#define PRAGMA_PATH "%EXE_DIR%\samples"
#define FPS 68 // Frames per seconds can be changed individually
var seconds, minutes = -1;

FONT* A20b = "Arial#20b";
PANEL* pInfo;

function main()
{
	fps_max = FPS;
	level_load ("small.hmp");
	vec_set(camera.x, vector(0,0,150));
	
	pInfo = pan_create(NULL,0);
	pan_setdigits(pInfo,0,10,10,"SECONDS = %.0f", A20b, 1, seconds);
	pan_setdigits(pInfo,0,10,30,"MINUTES = %.0f", A20b, 1, minutes);
	set(pInfo, OUTLINE|SHOW);
	
	while(level_ent)
	{
		if ((total_frames %  FPS) == 1) seconds++;
		if ((total_frames % (FPS*60)) == 1) minutes++;
		wait(1);
	}
}




Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: Show minutes and seconds [Re: rojart] #351167
12/22/10 14:02
12/22/10 14:02
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Code:
#define FPS 68 // Frames per seconds can be changed individually


I really hope that you just tried to be funny.


Quote:

What do you mean that timer doesn't work between two frames?

Look into the manual into the timer function.
Oh and my approach is 100% precise as long as time_frame is precise (which it really should be), it multiplied by 16 to get the seconds with miliseconds needed for the drawing.

And another thing: Casting into an integer (not via the integer() function but with a plain (int)) is much faster than an expensive multiplication that needs at least four processor cycles to finish.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Show minutes and seconds [Re: WretchedSid] #351351
12/23/10 21:15
12/23/10 21:15
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Minamato Offline OP
Junior Member
Minamato  Offline OP
Junior Member

Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Now I've got another question. How can I do it the other way? I mean counting from 5 minutes to 0?

Re: Show minutes and seconds [Re: Minamato] #351368
12/23/10 22:26
12/23/10 22:26
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Instead of adding the delta time, subtract it from a variable with a value of 300 (5 * 60 seconds). When the variable is <= 0.0f, the five minutes passed.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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