예제 #1
0
        protected override SceneObject makeSceneObject()
        {
            var railWidth   = this.Position.Size.X - this.knobSize;
            var knobColor   = this.mReadOnly ? Color.White : Color.DarkGray;
            var panelSprite = new BackgroundTexture(GalaxyTextures.Get.PanelBackground, 2);

            //TODO(v0.8) maybe make readonly mode have no knob but a fill from 0 to value

            return(new SceneObjectBuilder().
                   Clip(this.Position.ClipArea).
                   StartSimpleSprite(this.Z0, GalaxyTextures.Get.PanelBackground, Color.White).
                   Translate(this.Position.Center).
                   AddVertices(SpriteHelpers.GuiBackground(panelSprite, railWidth, this.Position.Size.Y - 4)).

                   StartSprite(this.Z0 - this.ZRange / 2, GalaxyTextures.Get.PanelBackground.Id, knobColor).
                   Translate(this.Position.Center + new Vector2(railWidth * (this.mValue - 0.5f), 0)).
                   AddVertices(SpriteHelpers.GuiBackground(panelSprite, this.knobSize, this.knobSize)).
                   Build());
        }
예제 #2
0
        protected override SceneObject makeSceneObject()
        {
            var railX      = this.direction;
            var railY      = this.direction.PerpendicularLeft;
            var railLength = Math.Abs(Vector2.Dot(this.Position.Size, railX)) - this.knobSize;
            var railWidth  = Math.Abs(Vector2.Dot(this.Position.Size, railY)) - 4;
            var railSize   = railX * railLength + railY * railWidth;

            var knobColor   = this.mReadOnly ? Color.White : Color.DarkGray;
            var panelSprite = new BackgroundTexture(GalaxyTextures.Get.PanelBackground, 2);

            //TODO(v0.9) maybe make readonly mode have no knob but a fill from 0 to value

            return(new SceneObjectBuilder().
                   Clip(this.Position.ClipArea).
                   StartSprite(this.Z0, GalaxyTextures.Get.PanelBackground.Id, Color.White).
                   Translate(this.Position.Center).
                   AddVertices(SpriteHelpers.GuiBackground(panelSprite, railSize.X, railSize.Y)).

                   StartSprite(this.Z0 - this.ZRange / 2, GalaxyTextures.Get.PanelBackground.Id, knobColor).
                   Translate(this.Position.Center + railX * railLength * (this.mValue - 0.5f)).
                   AddVertices(SpriteHelpers.GuiBackground(panelSprite, this.knobSize, this.knobSize)).
                   Build());
        }