Beispiel #1
0
        public ResetTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/014_prince.png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/015_prince.png")));
            editor.editorGui.addToolButton(toolButton, false);
        }
        /**
         * Constructor. Constructs all engine components.
         */
        public MirrorEngine(string gameTitle = "Mirror Engine")
        {
            resourceComponent = new ResourceComponent(this);
            inputComponent    = new InputComponent(this);
            physicsComponent  = new PhysicsComponent(this);
            graphicsComponent = new GraphicsComponent(this);
            audioComponent    = new AudioComponent(this);
            editorComponent   = new EditorComponent(this);

            this.gameTitle = gameTitle;
        }
Beispiel #3
0
        public NewMapTool(EditorComponent editor) : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/033_newMap.png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/034_newMap.png")));
            editor.editorGui.addToolButton(toolButton, false);

            createDialog();
            cancelButton.mouseClickEvent  += cancelAction;
            confirmButton.mouseClickEvent += confirmAction;
        }
        /**
         * desc here
         *
         * @param paramsdeschere
         *
         * @return returndeschere
         */
        public Tool(EditorComponent editor)
        {
            this.editor = editor;

            InputComponent input = this.editor.engine.inputComponent;

            toolAction = new Stack <ToolAction>();
            undos      = new Stack <ToolAction>();

            toolButton = new GUIButton(editor.editorGui, null, null);
            toolButton.mouseClickEvent += (pos, button) => { editor.selectTool(this); };
            toolButton.mouseUpEvent    += (pos, button) => { toolButton.texture = this.active ? toolButton.pressedImg : toolButton.unpressedImg; };
        }
Beispiel #5
0
        /**
         * desc here
         *
         * @param paramsdeschere
         *
         * @return returndeschere
         */
        public FillTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/005_fill.png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/006_fill_inv.png")));
            editor.editorGui.addToolButton(toolButton, true);

            createDialog();

            isDragging = false;
            fillCriteria.setToIgnore();
            fillCriteria.texture = "";

            textureCritBox.toggleEvent += (isDown) =>
            {
                if (isDown)
                {
                    fillCriteria.texture = "";
                }
                else
                {
                    fillCriteria.texture = Mapfile.TileData.IGNORESTRING;
                }
            };

            solidityCritBox.toggleEvent += (isDown) =>
            {
                if (isDown)
                {
                    fillCriteria.solidity = 0;
                }
                else
                {
                    fillCriteria.solidity = Mapfile.TileData.IGNOREBYTE;
                }
            };

            opacityCritBox.toggleEvent += (isDown) =>
            {
                if (isDown)
                {
                    fillCriteria.opacityFlip = 0;
                }
                else
                {
                    fillCriteria.opacityFlip = Mapfile.TileData.IGNOREBYTE;
                }
            };
        }
        public SaveMapTool(EditorComponent editor) : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/016_save (1).png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/017_save (2).png")));
            editor.editorGui.addToolButton(toolButton, false);

            saveDlg = new SaveFileDialog();
            saveDlg.InitialDirectory = Path.GetFullPath(Path.Combine(ResourceComponent.DEVELOPROOTPREFIX + ResourceComponent.DEFAULTROOTDIRECTORY, "Maps"));
            saveDlg.Filter           = "Map files (*.map)|*.map";

            saveFile = "";
        }
        public EditorGUI(GraphicsComponent graphics)
            : base(graphics)
        {
            editor         = graphics.engine.editorComponent;
            topPosition    = 0;
            bottomPosition = graphics.windowHeight - BUTTONHEIGHT;

            toolButtonsDialog = new GUIControl(editor.editorGui);

            font     = editor.engine.resourceComponent.get(defaultFontPath);
            grid     = editor.engine.resourceComponent.get(Path.GetFullPath(Path.Combine(rootDirectory, "GUI\\000_EngineGUI\\013_grid.png")));
            solid    = editor.engine.resourceComponent.get(Path.GetFullPath(Path.Combine(rootDirectory, "GUI\\000_EngineGUI\\000_solid.png")));
            opaque   = editor.engine.resourceComponent.get(Path.GetFullPath(Path.Combine(rootDirectory, "GUI\\000_EngineGUI\\037_opaque.png")));
            solidX   = editor.engine.resourceComponent.get(Path.GetFullPath(Path.Combine(this.rootDirectory, "GUI/000_EngineGUI/solidX.png")));
            opacityX = editor.engine.resourceComponent.get(Path.GetFullPath(Path.Combine(this.rootDirectory, "GUI/000_EngineGUI/opacityX.png")));
        }
Beispiel #8
0
        /**
         * desc here
         *
         * @param paramsdeschere
         *
         * @return returndeschere
         */
        public ActorTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/001_actor.png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/002_actor.png")));
            editor.editorGui.addToolButton(toolButton, true);

            createDialog();
            discoverThumbnails();

            isDragging = false;

            floatingPic         = new GUILabel(editor.editorGui);
            floatingPic.tintTex = new Color(1f, 1f, 1f, .5f);
        }
        /**
         * desc here
         *
         * @param paramsdeschere
         *
         * @return returndeschere
         */
        public SelectionTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/selection.png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/selectioninv.png")));
            editor.editorGui.addToolButton(toolButton, true);

            createDialog();

            copyButton.mouseClickEvent  += copyAction;
            pasteButton.mouseClickEvent += pasteAction;
            clearButton.mouseClickEvent += clearAction;

            selection = new RectangleF(-1, -1, 0, 0);
        }
        public WorldSettingsTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/021_cogs (2).png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/020_cogs (1).png")));
            editor.editorGui.addToolButton(toolButton, true);

            createDialog();

            closeButton.mouseClickEvent          += closeAction;
            selectBehaviorButton.mouseClickEvent += selectBehaviorAction;
            removeBehaviorButton.mouseClickEvent += removeBehaviorAction;
            resizeButton.mouseClickEvent         += (pos, button) => { resize(); };

            openDlg = new OpenFileDialog();
            openDlg.InitialDirectory = Path.GetFullPath(Path.Combine(ResourceComponent.DEVELOPROOTPREFIX + ResourceComponent.DEFAULTROOTDIRECTORY, "Scripts"));
            openDlg.Filter           = "Script (*.py)|*.py";
        }
        /**
         * EraserTool constructor. Sets the images for the buttons, registers events, and initializes data
         *
         * @param editor The current EditorComponent
         */
        public EraserTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/009_eraser.png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/010_eraser_inv.png")));
            editor.editorGui.addToolButton(toolButton, true);

            createDialog();
            plus.mouseClickEvent  += increaseSizeAction;
            minus.mouseClickEvent += decreaseSizeAction;

            isDragging = false;

            floatingPic         = new GUILabel(editor.editorGui, rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/026_eraserCircle.png"))));
            floatingPic.tintTex = new Color(1f, 1f, 1f, .5f);
            floatingPic.size    = new Vector2(32, 32);
            minSize             = new Vector2(16, 16);
            maxSize             = new Vector2(32 * 32, 32 * 32);
        }
Beispiel #12
0
        public EditorSettingsTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/021_cogs (2).png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/020_cogs (1).png")));
            editor.editorGui.addToolButton(toolButton, false);

            createDialog();

            closeButton.mouseClickEvent += closeAction;

            pauseCheckBox.toggleEvent    += pauseToggle;
            gridCheckBox.toggleEvent     += gridToggle;
            ambienceCheckBox.toggleEvent += ambienceToggle;
            overlayCheckBox.toggleEvent  += overlayToggle;

            centerButton.mouseClickEvent  += (pos, button) => { editor.center(); };
            defaultButton.mouseClickEvent += (pos, button) => { editor.zoomMouse = EditorComponent.ZOOMDEFAULT; };
            minusButton.mouseClickEvent   += (pos, button) => { editor.zoomCenter--; };
            plusButton.mouseClickEvent    += (pos, button) => { editor.zoomCenter++; };
        }
        /**
         * desc here
         *
         * @param paramsdeschere
         *
         * @return returndeschere
         */
        public PencilTool(EditorComponent editor)
            : base(editor)
        {
            ResourceComponent rc = editor.engine.resourceComponent;

            toolButton.unpressedImg = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/003_pencil.png")));
            toolButton.pressedImg   = rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/004_pencil_inv.png")));
            editor.editorGui.addToolButton(toolButton, true);

            openDlg = new OpenFileDialog();
            openDlg.InitialDirectory = Path.GetFullPath(Path.Combine(ResourceComponent.DEVELOPROOTPREFIX + ResourceComponent.DEFAULTROOTDIRECTORY, "Scripts"));
            openDlg.Filter           = "Script (*.py)|*.py";

            createDialog();
            discoverThumbnails();

            textureOverwriteBox.toggleEvent += (isDown) =>
            {
                if (isDown)
                {
                    editor.currentTile.texture = editor.currentValues.texture;
                }
                else
                {
                    editor.currentTile.texture = Mapfile.TileData.IGNORESTRING;
                }
            };

            solidityOverwriteBox.toggleEvent += (isDown) =>
            {
                if (isDown)
                {
                    editor.currentTile.solidity = editor.currentValues.solidity;
                }
                else
                {
                    editor.currentTile.solidity = Mapfile.TileData.IGNOREBYTE;
                }
            };

            solidityCheckBox.toggleEvent += (isDown) =>
            {
                editor.currentValues.solidity = (byte)(isDown ? 1 : 0);
                if (!solidityOverwriteBox.isDown)
                {
                    solidityOverwriteBox.toggle();
                }
                editor.currentTile.solidity = editor.currentValues.solidity;
            };

            opacityOverwriteBox.toggleEvent += (isDown) =>
            {
                if (isDown)
                {
                    editor.currentTile.opacityFlip = editor.currentValues.opacityFlip;
                }
                else
                {
                    editor.currentTile.opacityFlip = Mapfile.TileData.IGNOREBYTE;
                }
            };

            opacityFlipCheckBox.toggleEvent += (isDown) =>
            {
                editor.currentValues.opacityFlip = (byte)(isDown ? 1 : 0);
                if (!opacityOverwriteBox.isDown)
                {
                    opacityOverwriteBox.toggle();
                }
                editor.currentTile.opacityFlip = editor.currentValues.opacityFlip;
            };

            behaviorOverwriteBox.toggleEvent += (isDown) =>
            {
                if (isDown)
                {
                    editor.currentTile.behavior = editor.currentValues.behavior;
                }
                else
                {
                    editor.currentTile.behavior = Mapfile.TileData.IGNORESTRING;
                }
            };

            behaviorSetButton.mouseClickEvent    += (pos, button) => { setTileBehavior(); };
            behaviorRemoveButton.mouseClickEvent += (pos, button) =>
            {
                editor.currentValues.behavior = "";
                if (editor.currentTile.behavior != Mapfile.TileData.IGNORESTRING)
                {
                    editor.currentTile.behavior = "";
                }
            };

            addButton.mouseClickEvent += (pos, button) => { this.addNewTile(); };
        }