Search in sources :

Example 1 with Tick

use of com.b3dgs.lionengine.Tick in project lionengine by b3dgs.

the class Sequence method start.

/*
     * Sequencable
     */
@Override
public void start(Screen screen) {
    Check.notNull(screen);
    this.screen = screen;
    screen.addListener(this);
    renderer.setScreen(screen);
    renderer.initResolution(resolution);
    currentFrameRate = config.getOutput().getRate();
    screen.requestFocus();
    if (!loaded) {
        load();
    }
    onLoaded(Constant.EXTRP, screen.getGraphic());
    // Main loop
    final Tick updateFps = new Tick();
    updateFps.start();
    loop.start(screen, new Frame() {

        @Override
        public void update(double extrp) {
            updateFps.update(extrp);
            Sequence.this.update(extrp);
        }

        @Override
        public void render() {
            renderer.render();
        }

        @Override
        public void computeFrameRate(long lastTime, long currentTime) {
            Sequence.this.computeFrameRate(updateFps, lastTime, currentTime);
        }
    });
    screen.removeListener(this);
}
Also used : Tick(com.b3dgs.lionengine.Tick)

Aggregations

Tick (com.b3dgs.lionengine.Tick)1