Esempio n. 1
0
        public World()
        {
            gameLayer = new Layer();
            uiLayer = new Layer();
            consoleLayer = new Layer();
            AddChild(gameLayer);
            AddChild(uiLayer);
            AddChild(consoleLayer);

            SetupUI();
            AddChildren();

            currentTool = new RelayPlacer();

            ExposeObjectsToConsole();
        }
Esempio n. 2
0
        public Grid(int width, int height)
        {
            piecesLayer = new Layer();
            markerLayer = new Layer();
            effectsLayer = new Layer();

            MakeChargeMarker();

            chargeMarkers = new List<ColoredShape>();
            chargeLocations = new List<ChargeData>();
            gridPieces = new List<List<GridPiece>>(width);
            Utility.InitializeList<GridPiece>(gridPieces, width, height);

            MakeBackground();

            AddChild(background);
            AddChild(piecesLayer);
            AddChild(markerLayer);
            AddChild(effectsLayer);

            InteractsWithMouse = true;
        }
Esempio n. 3
0
        public TextField(Font font, Brush textColor, uint backgroundColor, float width, float height, Rectangle? wordWrap = null)
        {
            layer = new Layer();
            AddChild(layer);
            float a = (backgroundColor & 0xFF) / 255F;
            float b = ((backgroundColor >> 8) & 0xFF) / 255F;
            float g = ((backgroundColor >> 16) & 0xFF) / 255F;
            float r = ((backgroundColor >> 24) & 0xFF) / 255F;
            background = new ColoredRectangle(0, 0, width, height, r, g, b, a);
            layer.AddChild(background);
            layer.StencilMasks.AddLast(background);

            text = new Label("", font, textColor, wordWrap, LabelSizeMethod.SmallestPossible);
            layer.AddChild(text);

            InteractsWithMouse = true;

            arrow = new ColoredShape();
            arrow.FilledPolygons.AddLast(new Polygon(false,
                0, 5, 1, 1, 1, 1,
                5, 0, 1, 1, 1, 1,
                5, 10, 1, 1, 1, 1));
            arrow.FilledPolygons.AddLast(new Polygon(false,
                5, 3, 1, 1, 1, 1,
                5, 7, 1, 1, 1, 1,
                10, 7, 1, 1, 1, 1,
                10, 3, 1, 1, 1, 1));
            arrow.SetPolygons();
            arrow.Visible = false;
            AddChild(arrow);

            CursorPosition = 0;
            OnChange += OnChangeHandler;

            IllegalChars = new List<char>();
            IllegalChars.Add('\b');
        }