Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  One qestion about lwjgl's getTime()  (Read 4079 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #30 - Posted 2012-08-07 10:17:25 »

I'm not sure if you're cut out for this game programming malarkey ...  Undecided

Cas Smiley

Offline wdl7770016

Senior Newbie





« Reply #31 - Posted 2012-08-07 10:29:21 »

hehe  sor 
I admit I'm so stupid..
but I want to learn  Smiley
Offline ra4king

JGO Kernel


Medals: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #32 - Posted 2012-08-07 21:31:36 »

Sor I mean that what is time in Ticks? What is Ticks?...

getTime() returns the time in ticks, which is a unit that doesn't exactly mean anything until you get a resolution

*sighs* I think princec is right, you can't even read Sad

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Roquen
« Reply #33 - Posted 2012-08-07 22:23:52 »

Real men write it out in binary.
Offline wdl7770016

Senior Newbie





« Reply #34 - Posted 2012-08-08 11:10:50 »

Sor I mean that what is time in Ticks? What is Ticks?...

getTime() returns the time in ticks, which is a unit that doesn't exactly mean anything until you get a resolution

*sighs* I think princec is right, you can't even read Sad

but what you get about “getTime() returns the time in ticks, which is a unit that doesn't exactly mean anything until you get a resolution”?
tell me getTime() return a long which that doesn't mean anything?
but I ask that “you say if getTime = 100 and getTimerResolution = 100 then 1 second pass why?”
100*100=1second? it's crazy!!!:o
Offline Danny02
« Reply #35 - Posted 2012-08-08 12:12:27 »

I have sworn to never post in this thread again but here I go ...

Look whenever you want to give some number a meaning you have to attach a unit to this number.
Like when I say my hard-drive has 64. You would probably ask 64 what? Then I could tell you 64 GigaByte(GB), so the unit is GB and only because of the unit this number(64) makes any sens for you.

Now back to our little time problem.
We have this function getTime which returns to us the actual time, but in a unit X we do not know(it is not specified and can as written above vary).
So the second function getTimerResolution gives us conversion number to convert a time in the unit X to the equal time amount in seconds.

This is the same principle like when you want to know how much Euro € your 100$ are worth. Somebody might tell you that 1$ == 0.8€ so you can just multiply your 100$ * 0.8(€/$) = 80€

In our problem getTimerResolution tells us how many of X is one second(X/s).
now we get for example after the call to getTime as a result: 10.000
and from getTimerResolution: 100

So we can just do this simple calculation: 
10.000X = r seconds * 100(X/s)  //r is the time in seconds we want to know
10.000X / 100(X/s) = r seconds
100 (X/X) s = r seconds
100s = r seconds
so the time is 100 seconds.

Now when we do not want the time in seconds but in milliseconds for example we can multiply the result with 1000(I will not explain this again look at my first!!!!! post).
The thing my one would like to multiply before the unit conversion is because we do integer math.

Online Roquen
« Reply #36 - Posted 2012-08-08 12:35:14 »

Measuring time in ticks is much more reasonable as that's what the actual clock will be returning.
Offline wdl7770016

Senior Newbie





« Reply #37 - Posted 2012-08-08 13:03:56 »

Sorry for my bad English to waste your free times Sad
and Thx for your enthusiastic to my stupid
Now I had really know it
good luck
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #38 - Posted 2012-08-08 13:57:45 »

I think you're the one who needs the luck here Smiley I can't imagine how you're going to cope with sprites, collision detection, game loops, user input, etc...

Cas Smiley

Online Roquen
« Reply #39 - Posted 2012-08-08 14:34:59 »

Is the role reversal week?  I thought I was suppose bad cop.
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (54 views)
2014-04-15 18:08:23

BurntPizza (52 views)
2014-04-15 03:46:01

UprightPath (66 views)
2014-04-14 17:39:50

UprightPath (49 views)
2014-04-14 17:35:47

Porlus (66 views)
2014-04-14 15:48:38

tom_mai78101 (90 views)
2014-04-10 04:04:31

BurntPizza (150 views)
2014-04-08 23:06:04

tom_mai78101 (246 views)
2014-04-05 13:34:39

trollwarrior1 (204 views)
2014-04-04 12:06:45

CJLetsGame (211 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!