コード例 #1
0
ファイル: World.cs プロジェクト: LukaHorvat/Electric
        public World()
        {
            gameLayer = new Layer();
            uiLayer = new Layer();
            consoleLayer = new Layer();
            AddChild(gameLayer);
            AddChild(uiLayer);
            AddChild(consoleLayer);

            SetupUI();
            AddChildren();

            currentTool = new RelayPlacer();

            ExposeObjectsToConsole();
        }
コード例 #2
0
ファイル: Grid.cs プロジェクト: LukaHorvat/Electric
        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;
        }
コード例 #3
0
ファイル: TextField.cs プロジェクト: LukaHorvat/Electric
        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');
        }