Search in sources :

Example 1 with Scene

use of net.catacombsnatch.game.scene.Scene in project Catacomb-Snatch by Catacomb-Snatch.

the class InputManager method keyUp.

@Override
public boolean keyUp(int keycode) {
    Scene scene = SceneManager.getCurrent();
    if (scene != null)
        scene.keyUp(keycode);
    InputSource source = InputSource.KEYBOARD;
    Key key = getKeyForSource(source, keycode, null);
    pressed.put(key, false);
    KeyReleaseEvent event = new KeyReleaseEvent(source, key, null);
    EventManager.callEvent(event);
    return true;
}
Also used : Scene(net.catacombsnatch.game.scene.Scene) KeyReleaseEvent(net.catacombsnatch.game.event.input.events.KeyReleaseEvent)

Example 2 with Scene

use of net.catacombsnatch.game.scene.Scene in project Catacomb-Snatch by Catacomb-Snatch.

the class InputManager method keyTyped.

@Override
public boolean keyTyped(char character) {
    Scene scene = SceneManager.getCurrent();
    if (scene != null)
        scene.keyTyped(character);
    KeyTypeEvent event = new KeyTypeEvent(InputSource.KEYBOARD, character);
    EventManager.callEvent(event);
    return true;
}
Also used : KeyTypeEvent(net.catacombsnatch.game.event.input.events.KeyTypeEvent) Scene(net.catacombsnatch.game.scene.Scene)

Example 3 with Scene

use of net.catacombsnatch.game.scene.Scene in project Catacomb-Snatch by Catacomb-Snatch.

the class InputManager method keyDown.

/* -------- Keyboard and Mouse input events -------- */
@Override
public boolean keyDown(int keycode) {
    Scene scene = SceneManager.getCurrent();
    if (scene != null)
        scene.keyDown(keycode);
    InputSource source = InputSource.KEYBOARD;
    Key key = getKeyForSource(source, keycode, null);
    pressed.put(key, true);
    KeyPressedEvent event = new KeyPressedEvent(source, key, null);
    EventManager.callEvent(event);
    return true;
}
Also used : KeyPressedEvent(net.catacombsnatch.game.event.input.events.KeyPressedEvent) Scene(net.catacombsnatch.game.scene.Scene)

Example 4 with Scene

use of net.catacombsnatch.game.scene.Scene in project Catacomb-Snatch by Catacomb-Snatch.

the class CatacombSnatch method render.

@Override
public void render() {
    Screen.clear();
    Scene last = null;
    if (SceneManager.isDrawAllEnabled()) {
        for (Scene scene : sceneManager.getScenes()) {
            if (scene.hasBeenClosed())
                continue;
            scene.tick(Gdx.graphics.getDeltaTime());
            scene.getBatch().end();
            last = scene;
        }
    } else {
        last = SceneManager.getCurrent();
        if (last != null) {
            last.tick(Gdx.graphics.getDeltaTime());
            last.getBatch().end();
        }
    }
    if (last != null && (Boolean) DefaultOptions.DEBUG.get()) {
        Monitoring.update("fps", Gdx.graphics.getFramesPerSecond());
        Monitoring.render(last.getBatch());
    }
}
Also used : Scene(net.catacombsnatch.game.scene.Scene)

Aggregations

Scene (net.catacombsnatch.game.scene.Scene)4 KeyPressedEvent (net.catacombsnatch.game.event.input.events.KeyPressedEvent)1 KeyReleaseEvent (net.catacombsnatch.game.event.input.events.KeyReleaseEvent)1 KeyTypeEvent (net.catacombsnatch.game.event.input.events.KeyTypeEvent)1