コード例 #1
0
ファイル: DialogBox.cs プロジェクト: AlanWills/WindowsGame
 public DialogBox(string text, Vector2 localPosition, string textureAsset = AssetManager.DefaultTextBoxTextureAsset, float lifeTime = float.MaxValue) :
     base(localPosition, textureAsset, lifeTime)
 {
     // Set the text to be in the centre of the text box
     Text = new Label(text, Vector2.Zero);
     Text.SetParent(this);
 }
コード例 #2
0
ファイル: Slider.cs プロジェクト: AlanWills/WindowsGame
        public Slider(
            float minValue,
            float maxValue,
            float currentValue,
            string infoText,
            Vector2 localPosition,
            string sliderHandleTextureAsset = AssetManager.DefaultSliderHandleTextureAsset,
            string sliderBarTextureAsset = AssetManager.DefaultSliderBarTextureAsset,
            float lifeTime = float.MaxValue) :
            base(localPosition, sliderBarTextureAsset, lifeTime)
        {
            // We do not want to use collisions ourself, but rather for our handle
            UsesCollider = false;

            // Our bar will not have any collision detection on it
            SliderHandle = new Image(Vector2.Zero, sliderHandleTextureAsset, lifeTime);
            SliderHandle.SetParent(this);

            // Fix up our label position after all the textures are initialised
            // Parent it to the bar
            InfoLabel = new Label(infoText, Vector2.Zero, AssetManager.DefaultSpriteFontAsset, lifeTime);
            InfoLabel.SetParent(this);

            // Fix up our label position after all the textures are initialised
            // Parent it to the bar
            ValueLabel = new Label(currentValue.ToString(), Vector2.Zero);
            ValueLabel.SetParent(this);

            MaxValue = maxValue;
            MinValue = minValue;
            CurrentValue = new Property<float>(currentValue);
        }
コード例 #3
0
ファイル: Button.cs プロジェクト: AlanWills/WindowsGame
        public Button(string buttonText, Vector2 size, Vector2 localPosition, string textureAsset = AssetManager.DefaultButtonTextureAsset, float lifeTime = float.MaxValue) :
            base(size, localPosition, textureAsset, lifeTime)
        {
            // Create the label in the centre of the button
            Label = new Label(buttonText, Vector2.Zero);
            Label.SetParent(this);

            DefaultColour = Color.Black;
            HighlightedColour = Color.DarkGray;
            Colour = DefaultColour;
        }
コード例 #4
0
ファイル: Bar.cs プロジェクト: AlanWills/WindowsGame
        public Bar(
            float minValue,
            float maxValue,
            float currentValue,
            string text,
            Vector2 size,
            Vector2 localPosition,
            string foregroundTextureAsset = AssetManager.DefaultBarForegroundTextureAsset,
            string backgroundTextureAsset = AssetManager.DefaultBarBackgroundTextureAsset,
            float lifeTime = float.MaxValue) :
            base(size, localPosition, backgroundTextureAsset, lifeTime)
        {
            FrontImage = new Image(Vector2.Zero, foregroundTextureAsset, lifeTime);
            FrontImage.Colour = Color.Blue;
            FrontImage.SetParent(this);

            // Fix up our label position after all the textures are initialised
            // Parent it to the bar
            InfoLabel = new Label(text, Vector2.Zero, AssetManager.DefaultSpriteFontAsset, lifeTime);
            InfoLabel.SetParent(this);

            // Fix up our label position after all the textures are initialised
            // Parent it to the bar
            ValueLabel = new Label(currentValue.ToString(), Vector2.Zero, AssetManager.DefaultSpriteFontAsset, lifeTime);
            ValueLabel.SetParent(this);

            MinValue = minValue;
            MaxValue = maxValue;
            CurrentValue = currentValue;
        }