/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (almaslvl@gmail.com).
 * See LICENSE for details.
 */

package com.almasb.fxgl.tools.editor;

import com.almasb.fxgl.app.GameApplication;
import com.almasb.fxgl.app.GameSettings;
import com.almasb.fxgl.dsl.components.ProjectileComponent;
import javafx.geometry.Point2D;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;

import static com.almasb.fxgl.dsl.FXGL.*;

/**
 * @author Almas Baimagambetov (almaslvl@gmail.com)
 */
public class EditorGameApplication extends GameApplication {

    private EditorMainUI ui;

    public EditorGameApplication(EditorMainUI ui) {
        this.ui = ui;
    }

    @Override
    protected void initSettings(GameSettings settings) {
    }

    @Override
    protected void initInput() {
//        getInput().addTriggerListener(new TriggerListener() {
//            @Override
//            protected void onActionBegin(Trigger trigger) {
//                System.out.println(trigger);
//            }
//        });
    }

    @Override
    protected void initGame() {
//        entityBuilder()
//                .view(new Rectangle(getAppWidth(), getAppHeight(), Color.DARKGRAY))
//                .buildAndAttach();

//        entityBuilder()
//                .view(new Rectangle(64, 64, Color.BLUE))
//                .buildAndAttach();
//
//        entityBuilder()
//                .at(getAppWidth() - 64, getAppHeight() - 64)
//                .view(new Rectangle(64, 64, Color.BLUE))
//                .buildAndAttach();
//
//        entityBuilder()
//                .at(0, getAppHeight() / 2 - 32)
//                .view(new Rectangle(64, 64, Color.BLUE))
//                .with(new ProjectileComponent(new Point2D(1, 0), 150))
//                .buildAndAttach();
    }

    private boolean isAdded = false;

    @Override
    protected void onUpdate(double tpf) {
        if (!isAdded) {
            ui.notifyDone();
            // TODO: use service?
            isAdded = true;
        }
    }
}

@@ -256,212 +256,8 @@
 ngs;
-%0Aimport com.almasb.fxgl.dsl.components.ProjectileComponent;%0Aimport javafx.geometry.Point2D;%0Aimport javafx.scene.paint.Color;%0Aimport javafx.scene.shape.Rectangle;%0A%0Aimport static com.almasb.fxgl.dsl.FXGL.*;
 %0A%0A/*

fix unused imports