How does AnalogListener get tpf?

Hello, I was curious. Here is a snippet of code:

private AnalogListener analogListener = new AnalogListener() {
public void onAnalog(String name, float value, float tpf) {

How does AnalogListener get tpf from the game loop? Thanks!

When confronted with questions like this, one should ask: “Who is calling the AnalogListener?”

That answer should be easy because you are registering the listener with the InputManager or it never gets called.

From there, it’s one click in the SDK to pull up the InputManager source code and see exactly where it gets its tpf… basically from the same update() call that every one else does.

Their is no such thing as tpf outside of the main application’s update() method… and everything cascades from that.

Thank you. I’ve tried looking at the source code for inputManager and I can’t find anything related to “tpf”.

Not sure how you looked… I just searched to the string tpf and it’s all over the place. At the very least you could have searched for AnalogListener and worked your way back.

Your deep interest in tpf is a bit concerning in general. There is no magic to this value. It is quite literally (current time - last time) / time units per second. In the current case, it’s based on nano time I think.