Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FixedTickProvider incomplete? #37

Open
jacobparis opened this issue Oct 7, 2017 · 0 comments
Open

FixedTickProvider incomplete? #37

jacobparis opened this issue Oct 7, 2017 · 0 comments

Comments

@jacobparis
Copy link

I was looking at the code for FixedTickProvider and it just outputs a signal every frame no matter what the time adjustment or frametimer says. I replaced the code from that file with the code from FrameTickProvider and changed the dispatch function to

private function dispatchTick(event:Event):Void
    {
        var temp:Float = previousTime;
        var frameTime:Float = ( Lib.getTimer() - temp ) / 1000;
        while (frameTime > maximumFrameTime) { 
            previousTime = Lib.getTimer();
            signal.dispatch(frameTime * timeAdjustment);
            frameTime -= maximumFrameTime;
        }
    }

Now the second argument to the constructor defines how many frame-independent-seconds will elapse between signals.

new FixedTickProvider(container, 0.5); will dispatch a signal twice per second
new FixedTickProvider(container, 5); will dispatch a signal once every five seconds

I'd be willing to make a pull request if this is the intended functionality of the class but I admit I don't know how

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant