예제 #1
0
        //private gfx.Texture labelTexture;
        //private gfx.Texture boxTexture;

        public ToggleBox(gfx.Graphics graphics, string bind, string value,
                         Color checkBoxColor, Color borderColor,
                         prim.Size borderSize, string text, int fontSize, string fontType, Color fontColor,
                         prim.Point point, prim.Size size)
            : base(graphics, "label", text, point, size)
        {
            this.bind  = bind;
            this.value = value;

            isChecked = this.value == "true" ? true : false;
            label     = new Label(graphics, text, fontSize, fontType, fontColor, point, new prim.Size(size.w, size.h));

            size.h = label.size.h;
            size.w = graphics.getWSquareSize(label.size.h);

            pane = new Pane(graphics, checkBoxColor, borderColor, borderSize, new prim.Point(point.x, point.y), new prim.Size(size.w, size.h));

            prim.Size  sPaneSize = pane.size.Scale(0.8f);
            prim.Point sPanePnt  = pane.point.GetTransPnt(sPaneSize.w * 0.1f, sPaneSize.h * 0.1f);
            selectedPane = new Pane(graphics, borderColor, borderColor, borderSize, sPanePnt, sPaneSize);

            label.point.x += pane.size.w;
            this.Update();
            //pane = new Pane(graphics, checkBoxColor, borderColor, borderSize, new prim.Point(point.x, point.y), new prim.Size(size.w, size.h));
        }
예제 #2
0
        public ValueBox(gfx.Graphics graphics, string bind, string value,
                        Color borderColor, prim.Size borderSize,
                        int fontSize, string fontType, Color fontColor, prim.Point point,
                        prim.Size size)
            : base(graphics, "select", "", point, size)
        {
            this.bind = bind;

            this.value = value;

            LAmouseOverState = new prim.MouseOverStateMachine();
            RAmouseOverState = new prim.MouseOverStateMachine();

            boxes = new List <Pane>();

            float triH = size.h;
            float triW = graphics.getWSquareSize(triH);

            float[] lVertices =
            {
                point.x + triW, point.y + triH,          0.0f, 1.0f, 1.0f,
                point.x + triW, point.y,                 0.0f, 1.0f, 0.0f,
                point.x,        point.y + (triH / 2.0f), 0.0f, 0.0f, 0.5f
            };
            //Remember to add size.x to point.x
            float[] rVertices =
            {
                point.x + size.w,        point.y,                 0.0f, 1.0f, 1.0f,
                point.x + size.w,        point.y + triH,          0.0f, 1.0f, 0.0f,
                point.x + triW + size.w, point.y + (triH / 2.0f), 0.0f, 0.0f, 0.5f
            };

            uint[] indices =
            {
                0, 1, 2
            };

            //leftArrow = new gfx.ColorTexture(graphics, borderColor, lVertices, indices);
            //rightArrow = new gfx.ColorTexture(graphics, borderColor, rVertices, indices);
            leftArrow  = new ArrowButton(graphics, "left", fontColor, new prim.Point(point), new prim.Size(triW, triH));
            rightArrow = new ArrowButton(graphics, "right", fontColor, new prim.Point(point.x + size.w, point.y), new prim.Size(triW, triH));

            selectPane = new Pane(graphics, Color.FromArgb(0, 0, 0, 0), borderColor, borderSize, new prim.Point(point.x + triW, point.y), new prim.Size(size.w - triW, size.h));

            for (int i = 0; i < 10; i++)
            {
                prim.Size  paneSize  = new prim.Size((this.size.w + this.leftArrow.size.w) * 0.1f, this.size.h);
                prim.Point panePoint = new prim.Point(leftArrow.size.w + point.x + paneSize.w * i, point.y);
                Pane       curPane   = new Pane(graphics, borderColor, borderColor, borderSize, panePoint, paneSize);
                boxes.Add(curPane);
            }
        }
예제 #3
0
        public StarField(gfx.Graphics graphics)
            : base(graphics, "starfield", new float[] { }, new uint[] { })
        {
            vertexState    = new prim.VertexStateMachine();
            this.counter   = 0;
            this.texHandle = GL.GenTexture();
            prim.Size  size = new prim.Size(graphics.getWSquareSize(0.05f), 0.05f);
            prim.Point pnt  = new prim.Point(0.0f, 0.0f - size.h);

            LoadStarfield();

            ToVAO();
        }
예제 #4
0
 public TextField(gfx.Graphics graphics, string text,
                  int fontSize, string fontType, Color fontColor, prim.Point point)
     : base(graphics, "text field", "", point, new prim.Size())
 {
     this.text      = text;
     this.fontColor = fontColor;
     this.fontSize  = fontSize;
     this.fontType  = fontType;
     UpdateText();
     prim.Size cSize = new prim.Size(textLines[0].size);
     cSize.w = graphics.getWSquareSize(cSize.h) / 8;
     prim.Point cPoint = new prim.Point(point.x + textLines[0].size.w, textLines[0].point.y);
     this.cursorPane = new Pane(graphics, fontColor, Color.Transparent,
                                new prim.Size(), cPoint, cSize);
 }
예제 #5
0
        public Select(gfx.Graphics graphics, string bind, string value,
                      Color borderColor, prim.Size borderSize,
                      int fontSize, string fontType, Color fontColor, prim.Point point,
                      prim.Size size, XmlNodeList choiceNodes)
            : base(graphics, "select", "", point, size)
        {
            this.bind = bind;

            choices      = new List <Choice>();
            choiceLabels = new List <Label>();

            selectIndex = 0;

            LAmouseOverState = new prim.MouseOverStateMachine();
            RAmouseOverState = new prim.MouseOverStateMachine();


            float triH = size.h;
            float triW = graphics.getWSquareSize(triH);

            float[] lVertices =
            {
                point.x + triW, point.y + triH,          0.0f, 1.0f, 1.0f,
                point.x + triW, point.y,                 0.0f, 1.0f, 0.0f,
                point.x,        point.y + (triH / 2.0f), 0.0f, 0.0f, 0.5f
            };
            //Remember to add size.x to point.x
            float[] rVertices =
            {
                point.x + size.w,        point.y,                 0.0f, 1.0f, 1.0f,
                point.x + size.w,        point.y + triH,          0.0f, 1.0f, 0.0f,
                point.x + triW + size.w, point.y + (triH / 2.0f), 0.0f, 0.0f, 0.5f
            };

            uint[] indices =
            {
                0, 1, 2
            };

            //leftArrow = new gfx.ColorTexture(graphics, borderColor, lVertices, indices);
            //rightArrow = new gfx.ColorTexture(graphics, borderColor, rVertices, indices);
            leftArrow  = new ArrowButton(graphics, "left", fontColor, new prim.Point(point), new prim.Size(triW, triH));
            rightArrow = new ArrowButton(graphics, "right", fontColor, new prim.Point(point.x + size.w, point.y), new prim.Size(triW, triH));



            foreach (XmlNode choiceNode in choiceNodes)
            {
                Choice choice = new Choice(choiceNode.Attributes["text"].Value,
                                           choiceNode.Attributes["value"].Value);
                choices.Add(choice);
                Label choiceLabel = new Label(graphics, choice.name, fontSize, fontType, fontColor, new prim.Point(point), new prim.Size(0, 0));
                choiceLabel.point.x = triW + (point.x + ((size.w - triW) / 2)) - (choiceLabel.size.w / 2);
                choiceLabel.point.y = (point.y + (size.h / 2)) - (choiceLabel.size.h / 2);
                choiceLabel.Update();
                choiceLabels.Add(choiceLabel);
            }

            SetValue(value);

            selectPane = new Pane(graphics, Color.FromArgb(0, 0, 0, 0), borderColor, borderSize, new prim.Point(point.x + triW, point.y), new prim.Size(size.w - triW, size.h));
        }