Search in sources :

Example 1 with MAP_EDITOR_MOUSE_MODE

use of eidolons.libgdx.screens.map.editor.EditorControlPanel.MAP_EDITOR_MOUSE_MODE in project Eidolons by IDemiurge.

the class EditorManager method modify.

public static void modify(boolean addOrRemove, int screenX, int screenY) {
    MAP_EDITOR_MOUSE_MODE mode = EditorManager.getMode();
    /*
       add listener to each actor
        */
    Vector2 v = EditorMapView.getInstance().getMapStage().screenToStageCoordinates(new Vector2(screenX, screenY));
    int x = (int) v.x;
    int y = (int) v.y;
    if (mode == null)
        mode = MAP_EDITOR_MOUSE_MODE.ADD;
    switch(mode) {
        case ADD:
            if (!addOrRemove) {
                EditorMapView.getInstance().getObjectStage().removeClosest(x, y);
                return;
            }
            break;
        case POINT:
            MacroManager.getPointMaster().clicked(x, y);
            return;
        case EMITTER:
            if (addOrRemove) {
                EditorMapView.getInstance().getEditorParticles().clicked(x, y);
            } else {
                EditorMapView.getInstance().getEditorParticles().removeClosest(x, y);
            }
            return;
    }
    ObjType type = EditorMapView.getInstance().getGuiStage().getPalette().getSelectedType();
    if (type == null)
        return;
    MacroObj obj = create(type);
    added(obj, screenX, screenY);
}
Also used : MAP_EDITOR_MOUSE_MODE(eidolons.libgdx.screens.map.editor.EditorControlPanel.MAP_EDITOR_MOUSE_MODE) Vector2(com.badlogic.gdx.math.Vector2) ObjType(main.entity.type.ObjType) MacroObj(eidolons.game.module.adventure.entity.MacroObj)

Aggregations

Vector2 (com.badlogic.gdx.math.Vector2)1 MacroObj (eidolons.game.module.adventure.entity.MacroObj)1 MAP_EDITOR_MOUSE_MODE (eidolons.libgdx.screens.map.editor.EditorControlPanel.MAP_EDITOR_MOUSE_MODE)1 ObjType (main.entity.type.ObjType)1