예제 #1
0
        public WheelMenu( MenuScreen screen, Camera camera, float wheelScale, 
            float screenScale, float startX, float activeX, float finishX, float y)
            : base(screen, Vector2.Zero)
        {
            this.wheelScale = wheelScale;
              scaleMatrix = Matrix.CreateScale( wheelScale );
              this.camera = camera;
              angle = MathHelper.PiOver4;

              TransitionOnPosition = new Vector2( startX, y );
              Position = new Vector2( activeX, y );
              TransitionOffPosition = new Vector2( finishX, y );

              rotateSpring = new SpringInterpolater( 1, 50, SpringInterpolater.GetCriticalDamping( 50 ) );

              lastX = startX;

              ContentManager content = screen.ScreenManager.Game.Content;

              entryEffect = content.Load<Effect>( "Effects/basic" ).Clone( Screen.ScreenManager.GraphicsDevice );
              entryEffect.CurrentTechnique = entryEffect.Techniques["DiffuseColor"];
              entryEffect.Parameters["LightingEnabled"].SetValue( false );
              entryWorldEffectParameter = entryEffect.Parameters["World"];
              entryViewEffectParameter = entryEffect.Parameters["View"];
              entryProjectionEffectParameter = entryEffect.Parameters["Projection"];
              entryDiffuseEffectParameter = entryEffect.Parameters["DiffuseMap"];

              wheelModel = content.Load<CustomModel>( "Models/hamsterWheel" );
              foreach ( CustomModel.ModelPart part in wheelModel.ModelParts )
              {
            part.Effect.CurrentTechnique = part.Effect.Techniques["Color"];
            part.Effect.Parameters["Color"].SetValue( new Color( Color.LightGray, 0 ).ToVector4() );
              }
        }
예제 #2
0
        protected Vector2 curPos; // position that should be used

        #endregion Fields

        #region Constructors

        public MenuItem( MenuScreen screen, Vector2 position )
        {
            Screen = screen;
              Position = position;
              Z = 0f;
              Scale = 1f;
              Hidden = false;
              Focused = false;
        }
예제 #3
0
 public MenuStaticImage( MenuScreen screen, Vector2 position, Texture2D texture )
     : base(screen, position)
 {
     this.texture = texture;
       spriteBatch = Screen.ScreenManager.SpriteBatch;
       scale = 1;
       Dimensions = new Vector2( texture.Width, texture.Height );
       Tint = Color.White;
       Fade = true;
 }
예제 #4
0
        public TextMenuItem( MenuScreen screen, Vector2 position, string text, SpriteFont font )
            : base(screen, position)
        {
            this.font = font;
              this.text = text;

              Color = Color.LightGray;
              Fade = true;
              MaxWidth = float.MaxValue;
              DeathBegin = 0;
        }
예제 #5
0
        public MenuEntry( MenuScreen screen, Vector2 position, string text )
            : base(screen, position)
        {
            this.text = text;
              if ( text.Length == 0 )
            this.Dimensions = new Vector2( 0f, (float)Screen.ScreenManager.Font.LineSpacing );
              else
            this.Dimensions = Screen.ScreenManager.Font.MeasureString( text );

              scaleSpring = new SpringInterpolater( 1, 700, .4f * SpringInterpolater.GetCriticalDamping( 700 ) );
              scaleSpring.SetSource( 1 );
              scaleSpring.SetDest( 1 );
              scaleSpring.Active = true;
        }
예제 #6
0
        public BooleanMenuItem( MenuScreen screen, Vector2 position, bool value )
            : base(screen, position)
        {
            this.value = value;

              spriteBatch = screen.ScreenManager.SpriteBatch;
              font = Screen.ScreenManager.Font;
              Origin = new Vector2( 0, font.LineSpacing / 2 );
              scaleSpring = new SpringInterpolater( 1, 700, .4f * SpringInterpolater.GetCriticalDamping( 700 ) );
              scaleSpring.SetSource( 1 );
              scaleSpring.SetDest( 1 );
              scaleSpring.Active = true;
              Color = Color.White;
        }
 public StaticImageMenuItem( MenuScreen screen, Vector2 position, Texture2D texture )
     : base(screen, position)
 {
     this.texture = texture;
       TransitionOffPosition = position;
       TransitionOnPosition = position;
       spriteBatch = Screen.ScreenManager.SpriteBatch;
       Dimensions = new Vector2( texture.Width, texture.Height );
       Origin = Dimensions / 2;
       Tint = Color.White;
       Fade = true;
       scaleSpring = new SpringInterpolater( 1, 700, .35f * SpringInterpolater.GetCriticalDamping( 700 ) );
       scaleSpring.SetSource( 1 );
       scaleSpring.SetDest( 1 );
       scaleSpring.Active = true;
 }
예제 #8
0
        public SliderMenuItem( MenuScreen screen, Vector2 position, float value )
            : base(screen, position)
        {
            spriteBatch = screen.ScreenManager.SpriteBatch;

              ss = screen.ScreenManager.Game.GraphicsDevice.Viewport.Height / 1080f;

              ContentManager content = screen.ScreenManager.Game.Content;

              barTexture = content.Load<Texture2D>( "Textures/sliderBar" );
              sliderTexture = content.Load<Texture2D>( "Textures/sliderSlider" );

              Origin = new Vector2( 0, barTexture.Height / 2 );
              sliderOrigin = new Vector2( sliderTexture.Width, sliderTexture.Height ) / 2;

              Value = value;
        }
예제 #9
0
        public ImageMenuEntry( MenuScreen screen, Vector2 position, Texture2D texture, Vector2? dimensions )
            : base(screen, position)
        {
            this.texture = texture;

              if ( dimensions != null )
            Dimensions = (Vector2)dimensions;
              else
            Dimensions = new Vector2( texture.Width, texture.Height );

              scaleSpring = new SpringInterpolater( 1, 700f, .35f * SpringInterpolater.GetCriticalDamping( 700f ) );
              scaleSpring.SetSource( idleScale );
              scaleSpring.SetDest( idleScale );
              scaleSpring.Active = true;

              spriteBatch = Screen.ScreenManager.SpriteBatch;

              Tint = Color.White;

              Fade = true;
        }
예제 #10
0
 public void Goto(MenuScreen _screen)
 {
     MenuManager.Instance.LoadScreen(_screen);
 }
예제 #11
0
 public void LoadScreen(MenuScreen _screen)
 {
     previousScreens.Enqueue(currentScreen);
     SetCurrentScreen(_screen);
 }