コード例 #1
0
ファイル: Slider.cs プロジェクト: Nova-Spel/Nova
        public void Init(ContentManager cm, float value, float minValue, float maxValue, string bgPath, string path, string t, Color bgColor, Color c, Vector2 targetPos, bool useOrigin, Vector2 hitboxOffset)
        {
            base.Init(cm, bgPath, path, t, bgColor, c, targetPos, useOrigin, hitboxOffset);

            sliderBackgroundTexture = new Sprite();
            sliderBlockTexture = new Sprite();
            valueText = new Text();
            backgroundTexture = new Sprite();
            sliderIcons = new Sprite();

            valueText.Init(cm, path, value.ToString(), Color.White, Vector2.Zero, true);
            backgroundTexture.Init(cm, bgPath, Vector2.Zero, Color.White, 1.0f, true);
            sliderIcons.Init(cm, "OptionsMenu\\sliderBarIcons", Vector2.Zero, Color.White, 1.0f, true);
            sliderBackgroundTexture.Init(cm, "OptionsMenu\\sliderBar", Vector2.Zero, Color.White, 1.0f, true);
            sliderBlockTexture.Init(cm, "OptionsMenu\\sliderBlock", Vector2.Zero, Color.White, 1.0f, true);

            this.value = value;
            this.minValue = minValue;
            this.maxValue = maxValue;

            sliderTargetPos = Vector2.Zero;

            holdTime = 0;
            incTick = 0;
            lastHeldKey = Keys.None;
            lastHeldButton = Buttons.B;

            fadeConstant = 0.1f;

            sliderHitbox = new Rectangle(0, 0, sliderBackgroundTexture.GetTexture.Width, sliderBackgroundTexture.GetTexture.Height);

            SetPos(startingPos);
            SetAlpha(0.0f);
        }
コード例 #2
0
ファイル: Button.cs プロジェクト: Nova-Spel/Nova
        public Button()
        {
            text = new Text();
            size = new Vector2(0);

            backgroundTexture = new Sprite();
            hitbox = Rectangle.Empty;

            selected = false;
        }