void UpdateSliderValue(SliderGroup slider, float value, string titleText)
 {
     slider.SetValue(value);
     slider.SetTitle(titleText + value);
 }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            blockTex = Content.Load<Texture2D>("block");
            input = new InputHelper();

            sliders = new SliderGroup(blockTex, new Vector2(20,20));
            initscaleslider = new SliderGroup.DoubleSlider(0.004, 0.004, 1.6, 0.004, SliderChanged);
            sliders.RegisterValue(initscaleslider);
            magicslider = new SliderGroup.DoubleSlider(0.1, -1.0, 1.0, 0.8, SliderChanged);
            sliders.RegisterValue(magicslider);
            scalemodslider = new SliderGroup.DoubleSlider(0.1, 0.1, 1.9, 1.0, SliderChanged);
            sliders.RegisterValue(scalemodslider);
            scalemodmodslider = new SliderGroup.DoubleSlider(0.1, 0.1, 1.9, 0.3, SliderChanged);
            sliders.RegisterValue(scalemodmodslider);

            sliders.SelectSlider(0);

            try
            {
                pad = input.AcquireNewPad();
                cam = new CamManual(pad);
            }
            catch(Exception e)
            {
                cam = new CamKeyboard(input);
            }

            //cam = new CamManual(pad);
            //cam = new CamKeyboard(input);
            cam.Viewport = new Vector2(1280, 720);
            cam.Position = new Vector2(0, 0);//-360 + GroundOffset);
            int width = LevelWidth * BaseUnitSize;
            int height = LevelHeight * BaseUnitSize;
            cam.Bounds = new Rectangle(-width / 2, -height, width, height + GroundOffset);
            wrapUV = new SamplerState();
            wrapUV.AddressU = TextureAddressMode.Wrap;
            wrapUV.AddressV = TextureAddressMode.Wrap;
            wrapUV.Filter = TextureFilter.Point;

            base.Initialize();
        }