Пример #1
0
 public GUI(GraphicsComponent graphics)
 {
     this.rootDirectory = ResourceComponent.DEFAULTROOTDIRECTORY;
     this.graphics      = graphics;
     this.items         = new List <GUIItem>();
     currentDialog      = null;
 }
Пример #2
0
        public GUIComponent(GraphicsComponent theGraphics) : base(theGraphics.tileEngine)
        {
            this.graphics  = theGraphics;
            this.resources = tileEngine.resourceComponent;

            staticBindings = new InputBinding[Enum.GetValues(typeof(StaticBindings)).Length];
        }
 public Camera(GraphicsComponent graphics, Vector2 position, int width, int height, int destHeight)
 {
     this.graphics     = graphics;
     this.position     = position;
     this.screenWidth  = width;
     this.screenHeight = height;
     this.scale        = height / destHeight;
     this.destHeight   = destHeight;
 }
        /**
         * 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;
        }
        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")));
        }
Пример #6
0
 public EditorGUI(GraphicsComponent theGraphics)
     : base(theGraphics)
 {
     egl = new EditorGUILayout(this);
 }
        public void drawTiles()
        {
            if (mode != Mode.paste)
            {
                return;
            }

            GraphicsComponent gc       = editor.engine.graphicsComponent;
            RectangleF        viewRect = gc.camera.viewRect;

            Mapfile.TileData ignoreTile = new Mapfile.TileData("");
            ignoreTile.setToIgnore();

            for (int x = 0; x <= (int)selection.width; x++)
            {
                for (int y = 0; y <= (int)selection.height; y++)
                {
                    if (ignoreTile.Equals(copiedTileData[x, y]))
                    {
                        continue;                                         //Not commutative
                    }
                    Tile t = new Tile(editor.engine.world, (int)selection.left + x, (int)selection.top + y, copiedTiles[x, y].tileData);

                    Vector2 pos      = gc.camera.world2Screen(new Vector2(t.x, t.y));
                    Vector2 specPos  = gc.camera.world2Screen(new Vector2(t.x + Tile.size / 2, t.y + Tile.size / 2));
                    int     flagSize = (int)(editor.editorGui.solid.getResource <Texture2D>().width *gc.camera.scale);

                    //texture
                    if (t.texture.key == "")
                    {
                        gc.drawText("nul", (int)pos.x, (int)pos.y, editor.editorGui.font, Color.WHITE, (int)(12 * gc.camera.scale));
                    }
                    else
                    {
                        gc.drawTex(editor.engine.resourceComponent.get(copiedTileData[x, y].texture), (int)pos.x, (int)pos.y, (int)(t.imageWidth * gc.camera.scale), (int)(t.imageHeight * gc.camera.scale), new Color(1, 1, 1, .4f));
                    }

                    //Nonstandard overlay
                    if (t.tileData.isNonstandard())
                    {
                        editor.editorGui.graphics.drawRect((int)(pos.x + (2 * gc.camera.scale)), (int)(pos.y + (2 * gc.camera.scale)), (int)((Tile.size - 4) * gc.camera.scale), (int)((Tile.size - 4) * gc.camera.scale), new Color(1, 0, 1, .3f));
                    }

                    //solidity
                    if (t.solidity)
                    {
                        gc.drawTex(editor.editorGui.solid, (int)pos.x, (int)pos.y, flagSize, flagSize, new Color(1, 1, 1, .8f));
                    }
                    else
                    {
                        gc.drawTex(editor.editorGui.solidX, (int)pos.x, (int)pos.y, flagSize, flagSize, new Color(1, 1, 1, .8f));
                    }

                    //opacity
                    if (t.opacityFlip)
                    {
                        gc.drawTex(editor.editorGui.opaque, (int)(specPos.x), (int)(specPos.y), flagSize, flagSize, new Color(1, 1, 1, .8f));
                    }
                    else
                    {
                        gc.drawTex(editor.editorGui.opacityX, (int)(specPos.x), (int)(specPos.y), flagSize, flagSize, new Color(1, 1, 1, .8f));
                    }
                }
            }
        }
Пример #8
0
 public GameGUIComponent(GraphicsComponent theGraphics)
     : base(theGraphics)
 {
 }
Пример #9
0
 /**
  * desc here
  *
  * @param paramsdeschere
  *
  * @return returndeschere
  */
 public Camera(GraphicsComponent graphics, Vector2 position, int destHeight)
 {
     this.graphics   = graphics;
     this.position   = position;
     this.destHeight = destHeight;
 }