コード例 #1
0
ファイル: Button.cs プロジェクト: maesse/CubeHags
        public Button(string Text, Window window)
            : base(window)
        {
            Selected = new ButtonSelectedEvent(ButtonSelected);
            Margin = 4;
            FlowLayout layout = new FlowLayout(true);
            layout.centered = false;
            label = new Label(Text, window);
            label.Color = Color.LightGray;
            this.AddControl(label);
            this.Name = "Button";
            Color = System.Drawing.Color.White;

            atlas = new HagsAtlas("window-theme/button/button.png");
            atlas["topleft"] = new Rectangle(0, 0, 3, 3);
            atlas["left"] = new Rectangle(0, 3, 3, 15);
            atlas["bottomleft"] = new Rectangle(0, 18, 3, 3);
            atlas["top"] = new Rectangle(3, 0, 34, 3);
            atlas["middle"] = new Rectangle(3, 3, 34, 15);
            atlas["bottom"] = new Rectangle(3, 18, 34, 3);
            atlas["topright"] = new Rectangle(37,0,3,3);
            atlas["right"] = new Rectangle(37, 3, 3, 15);
            atlas["bottomright"] = new Rectangle(37, 18, 3, 3);
            stateOffets.Add(ButtonState.HOVER, new Point(0, 21));
            stateOffets.Add(ButtonState.DOWN, new Point(0, 43));
        }
コード例 #2
0
ファイル: TextBox.cs プロジェクト: maesse/CubeHags
        public TextBox(Window window)
            : base(window)
        {
            PreferredSize = new Size(240, 26);

            atlas = new HagsAtlas("window-theme/textframe.png");

            //HagsAtlas.SerializeToXML(atlas);
            atlas["topleft"] = new Rectangle(0, 0, 3, 3);
            atlas["top"] = new Rectangle(5, 0, 3, 3);
            atlas["topright"] = new Rectangle(28, 0, 3, 3);

            atlas["left"] = new Rectangle(0, 5, 3, 3);
            atlas["middle"] = new Rectangle(5, 5, 3, 3);
            atlas["right"] = new Rectangle(28, 5, 3, 3);

            atlas["bottomleft"] = new Rectangle(0, 28, 3, 3);
            atlas["bottom"] = new Rectangle(5, 28, 3, 3);
            atlas["bottomright"] = new Rectangle(28, 28, 3, 3);

            // Load theme
            WhiteTexture = TextureManager.CreateTexture(1, 1, Format.A8R8G8B8, new SlimDX.Color4(Color.White));
            //WhiteTexture = TextureManager.Instance.LoadTexture("window-theme/White.bmp");
            // Fixed sized font measurement
            ASize = new Rectangle();
            Renderer.Instance.Fonts["textbox"].MeasureString(Renderer.Instance.sprite, "A", DrawTextFormat.Left, ref ASize);

            // Little prefferedsize tweak
            int goodHeight = ASize.Height + atlas["top"].Height + atlas["bottom"].Height;
            if (goodHeight > PreferredSize.Height)
            {
                PreferredSize.Height = goodHeight;
            }
        }
コード例 #3
0
ファイル: Scrollbar.cs プロジェクト: maesse/CubeHags
        private Size ScrollbarSize = new Size(64, 64); // Minimum size for panel the contains the scrollbars

        #endregion Fields

        #region Constructors

        public Scrollbar(Container parent)
        {
            this.Parent = parent;

            // Load texture and atlas
            atlas = new HagsAtlas("window-theme/scrollbar.png");
            atlas["toparrow"] = new System.Drawing.Rectangle(10, 0, 16, 16);
            atlas["bottomarrow"] = new System.Drawing.Rectangle(26, 0, 16, 16);
            atlas["background"] = new System.Drawing.Rectangle(16, 32, 1, 1);
            atlas["vslidermarks"] = new System.Drawing.Rectangle(0, 0, 9, 9);
            atlas["vslidertl"] = new System.Drawing.Rectangle(0, 16, 2, 2);
            atlas["vslidert"] = new System.Drawing.Rectangle(2, 16, 12, 2);
            atlas["vslidertr"] = new System.Drawing.Rectangle(14, 16, 2, 2);
            atlas["vsliderml"] = new System.Drawing.Rectangle(0, 18, 2, 28);
            atlas["vsliderm"] = new System.Drawing.Rectangle(2, 18, 12, 28);
            atlas["vslidermr"] = new System.Drawing.Rectangle(14, 18, 2, 28);
            atlas["vsliderbl"] = new System.Drawing.Rectangle(0, 46, 2, 2);
            atlas["vsliderb"] = new System.Drawing.Rectangle(2, 46, 12, 2);
            atlas["vsliderbr"] = new System.Drawing.Rectangle(14, 46, 2, 2);
            atlas["hslidermarks"] = new System.Drawing.Rectangle(17, 32, 9, 9);
            atlas["hslidertl"] = new System.Drawing.Rectangle(16, 16, 2, 2);
            atlas["hsliderl"] = new System.Drawing.Rectangle(16, 18, 2, 12);
            atlas["hsliderbl"] = new System.Drawing.Rectangle(16, 30, 2, 2);
            atlas["hslidert"] = new System.Drawing.Rectangle(18, 16, 28, 2);
            atlas["hsliderm"] = new System.Drawing.Rectangle(18, 18, 28, 12);
            atlas["hsliderb"] = new System.Drawing.Rectangle(18, 30, 28, 2);
            atlas["hslidertr"] = new System.Drawing.Rectangle(46, 16, 2, 2);
            atlas["hsliderr"] = new System.Drawing.Rectangle(46, 18, 2, 12);
            atlas["hsliderbr"] = new System.Drawing.Rectangle(46, 30, 2, 2);
        }
コード例 #4
0
ファイル: Window.cs プロジェクト: maesse/CubeHags
        public Window()
            : base(null)
        {
            this.Window = this;
            panel = new Panel(this);

            // Load theme
            // "Untitled-1.png"
            atlas = new HagsAtlas("window-theme/window-borders.png");

            //HagsAtlas.SerializeToXML(atlas);
            atlas["topleft"] = new Rectangle(0, 0, 26, 26);
            atlas["top"] = new Rectangle(0, 81, 128, 26);
            atlas["topright"] = new Rectangle(27, 0, 27, 26);

            atlas["left"] = new Rectangle(0, 28, 25, 26);
            atlas["middle"] = new Rectangle(55, 28, 25, 25);
            atlas["right"] = new Rectangle(54, 1, 27, 26);

            atlas["bottomleft"] = new Rectangle(0, 54, 27, 27);
            atlas["bottom"] = new Rectangle(27, 55, 27, 26);
            atlas["bottomright"] = new Rectangle(54, 54, 27, 27);
            atlas["scale"] = new Rectangle(27, 27, 17, 17);

            LayoutUpdate(false);
        }
コード例 #5
0
ファイル: HagsAtlas.cs プロジェクト: maesse/CubeHags
 // Serialize
 public static void SerializeToXML(HagsAtlas atlas)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(HagsAtlas));
     TextWriter textWriter = new StreamWriter(@"client/data/gui/Atlas/" + atlas.Name + ".xml");
     serializer.Serialize(textWriter, atlas);
     textWriter.Close();
 }