Search in sources :

Example 1 with DebugProperties

use of org.terasology.logic.debug.DebugProperties in project Terasology by MovingBlocks.

the class DebugControlSystem method onKeyDown.

@ReceiveEvent(components = ClientComponent.class)
public void onKeyDown(KeyDownEvent event, EntityRef entity) {
    boolean debugEnabled = config.getSystem().isDebugEnabled();
    // Features for debug mode only
    if (debugEnabled) {
        switch(event.getKey().getId()) {
            case Keyboard.KeyId.F6:
                config.getRendering().getDebug().setEnabled(!config.getRendering().getDebug().isEnabled());
                event.consume();
                break;
            case Keyboard.KeyId.F8:
                config.getRendering().getDebug().setRenderChunkBoundingBoxes(!config.getRendering().getDebug().isRenderChunkBoundingBoxes());
                event.consume();
                break;
            case Keyboard.KeyId.F9:
                config.getRendering().getDebug().setWireframe(!config.getRendering().getDebug().isWireframe());
                event.consume();
                break;
            default:
                break;
        }
    }
    switch(event.getKey().getId()) {
        case Keyboard.KeyId.F2:
            mouseGrabbed = !mouseGrabbed;
            DebugProperties debugProperties = (DebugProperties) nuiManager.getHUD().getHUDElement("engine:DebugProperties");
            debugProperties.setVisible(!mouseGrabbed);
            Mouse.setGrabbed(mouseGrabbed);
            event.consume();
            break;
        case Keyboard.KeyId.F3:
            config.getSystem().setDebugEnabled(!config.getSystem().isDebugEnabled());
            event.consume();
            break;
        case Keyboard.KeyId.F4:
            overlay.toggleMetricsMode();
            event.consume();
            break;
        default:
            break;
    }
}
Also used : DebugProperties(org.terasology.logic.debug.DebugProperties) ReceiveEvent(org.terasology.entitySystem.event.ReceiveEvent)

Aggregations

ReceiveEvent (org.terasology.entitySystem.event.ReceiveEvent)1 DebugProperties (org.terasology.logic.debug.DebugProperties)1