[CLOSED] getTime/getDelta

Started by darkhog, May 09, 2012, 19:59:28

Previous topic - Next topic

CodeBunny

Quote from: Simon Felix on May 25, 2012, 11:37:44
No question that it could be used correctly. However, matheus23 already wrote code snippet which demonstrates how it might get mis-used:

All code can be used wrongly - what's important is how easily it can be used correctly.

You don't constrain an API on the sole reason people could attempt retarded things with it.

princec

The more API we add to LWJGL beyond that which is minimally necessary to achieve what it does, the more API nobody knows about, the more potential bugs and the more maintenance. This is why we have historically avoided adding cruft like this to the core classes and plonked them into the util jar.

Cas :)

matheus23

Quote from: CodeBunny on May 26, 2012, 04:00:44
Quote from: Simon Felix on May 25, 2012, 11:37:44
No question that it could be used correctly. However, matheus23 already wrote code snippet which demonstrates how it might get mis-used:

All code can be used wrongly - what's important is how easily it can be used correctly.

You don't constrain an API on the sole reason people could attempt retarded things with it.

You could add a static variable easily in some class like "DeltaUtil", and call
DeltaUtil.update()
every game-cycle, which is doing the exact same thing:
[variable-name] = getDeltaTimePrivate(); // Maybe another name
and let getDelta() do this:
public double getDelta() {
    return [variable-name];
}


That's it ;)
My github account and currently active project: https://github.com/matheus23/UniverseEngine

CodeBunny

Quote
The more API we add to LWJGL beyond that which is minimally necessary to achieve what it does, the more API nobody knows about, the more potential bugs and the more maintenance. This is why we have historically avoided adding cruft like this to the core classes and plonked them into the util jar.

Cas :)

Makes sense.

@Simon
That seems like a less intuitive API to me.