Exemplo n.º 1
0
        /// <summary>
        /// Draw the dead zone sample.
        /// This will draw a circle for the thumbstick, the current thumbstick location as a white circle, the deadzone
        /// The type of dead zone scrubbing will be written above the diagram
        /// </summary>
        /// <param name="text">Text.</param>
        /// <param name="mySpriteBatch">My sprite batch.</param>
        public void Draw(FontBuddy text, SpriteBatch mySpriteBatch, GraphicsDevice graphics)
        {
            //draw the outline of the thumbstick
            var thumbstick = new XNABasicPrimitive(graphics, mySpriteBatch);

            thumbstick.Circle(Position, 100, Color.White);

            //draw the thumbstick
            Vector2 thumbstickPos = Controller.Thumbsticks.LeftThumbstick.Direction * 100.0f;

            thumbstick.Circle(Position + thumbstickPos, 10, Color.Blue);

            //write the deadzone type above the thumbstick
            Vector2 textPos = new Vector2(Position.X, Position.Y - 150.0f);

            text.Write(Controller.Thumbsticks.LeftThumbstick.ThumbstickScrubbing.ToString(),
                       textPos, Justify.Center, 1.0f, Color.White, mySpriteBatch, 0.0f);

            //write the raw output below the thing
            textPos = new Vector2(Position.X, Position.Y + 100.0f);
            text.Write("X: " + Controller.Thumbsticks.LeftThumbstick.Direction.X.ToString(),
                       textPos, Justify.Center, 1.0f, Color.White, mySpriteBatch, 0.0f);

            textPos.Y += text.Font.MeasureString("X").Y;

            text.Write("Y: " + Controller.Thumbsticks.LeftThumbstick.Direction.Y.ToString(),
                       textPos, Justify.Center, 1.0f, Color.White, mySpriteBatch, 0.0f);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public BackgroundScreen()
        {
            Transition.OnTime  = 0.5f;
            Transition.OffTime = 0.5f;

            _titleText    = new RainbowTextBuddy();
            _dannobotText = new FontBuddy();
        }
Exemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            InstructionFont      = new FontBuddy();
            InstructionFont.Font = Content.Load <SpriteFont>("ArialBlack24");
        }
Exemplo n.º 4
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory    = "Content";
            graphics.IsFullScreen    = false;
            graphics.GraphicsProfile = GraphicsProfile.HiDef;
            graphics.ApplyChanges();

            _clock        = new GameClock();
            _inputState   = new InputState();
            _inputWrapper = new InputWrapper(new ControllerWrapper(PlayerIndex.One, true), _clock.GetCurrentTime);
            _inputWrapper.Controller.UseKeyboard = true;
            _font = new FontBuddy();

            //setup the renderer
            _Renderer = new Renderer(this, Content);
            _DrawList = new DrawList();
            _Grid     = new Grid();
        }
Exemplo n.º 5
0
        protected void InitializeFonts(ContentManager content)
        {
            switch (FontSize)
            {
            case FontSize.Large:
            {
                Font = new FontBuddy()
                {
                    Font = content.Load <SpriteFont>(StyleSheet.LargeFontResource)
                };
                HighlightedFont = new PulsateBuddy()
                {
                    Font = content.Load <SpriteFont>(StyleSheet.LargeFontResource)
                };
            }
            break;

            case FontSize.Medium:
            {
                Font = new ShadowTextBuddy()
                {
                    ShadowSize   = 1.0f,
                    ShadowOffset = new Vector2(7.0f, 7.0f),
                    Font         = content.Load <SpriteFont>(StyleSheet.MediumFontResource)
                };
                HighlightedFont = new PulsateBuddy()
                {
                    ShadowSize   = 1.0f,
                    ShadowOffset = new Vector2(7.0f, 7.0f),
                    Font         = content.Load <SpriteFont>(StyleSheet.MediumFontResource)
                };
            }
            break;

            default:
            {
                if (StyleSheet.SmallFontHasShadow)
                {
                    Font = new ShadowTextBuddy()
                    {
                        ShadowSize   = 1.0f,
                        ShadowOffset = new Vector2(3.0f, 4.0f),
                        Font         = content.Load <SpriteFont>(StyleSheet.SmallFontResource),
                    };
                }
                else
                {
                    Font = new FontBuddy()
                    {
                        Font = content.Load <SpriteFont>(StyleSheet.SmallFontResource),
                    };
                }

                HighlightedFont = new PulsateBuddy()
                {
                    ShadowSize   = 1.0f,
                    ShadowOffset = new Vector2(3.0f, 4.0f),
                    Font         = content.Load <SpriteFont>(StyleSheet.SmallFontResource),
                };
            }
            break;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor fills in the menu contents.
 /// </summary>
 public TopScreen()
     : base("top")
 {
     _textDirection = new Vector2(TextVelocity, TextVelocity);
     _text          = new FontBuddy();
 }
Exemplo n.º 7
0
        /// <summary>
        /// Loads graphics content for this screen. This uses the shared ContentManager
        /// provided by the Game class, so the content will remain loaded forever.
        /// Whenever a subsequent MessageBoxScreen tries to load this same content,
        /// it will just get back another reference to the already loaded data.
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            //Create the stack for the label text
            var labelStack = new StackLayout()
            {
                Horizontal = HorizontalAlignment.Center,
                Vertical   = VerticalAlignment.Center,
                Alignment  = StackAlignment.Top,
            };

            ControlStack = new StackLayout()
            {
                Horizontal = HorizontalAlignment.Center,
                Vertical   = VerticalAlignment.Center,
                Alignment  = StackAlignment.Top,
            };

            //Split up the label text into lines
            var lines = Message.Split('\n').ToList();

            //Add all the label text to the stack
            foreach (var line in lines)
            {
                //split the line into lines that will actuall fit on the screen
                var tempFont = new FontBuddy();
                tempFont.LoadContent(Content, StyleSheet.SmallFontResource);
                var splitLines = tempFont.BreakTextIntoList(line, Resolution.TitleSafeArea.Width - 64);
                foreach (var splitLine in splitLines)
                {
                    //Set the label text
                    var label = new Label(splitLine, Content, FontSize.Small)
                    {
                        Highlightable = false,
                        TextColor     = StyleSheet.MessageBoxTextColor,
                    };
                    ControlStack.AddItem(label);
                }
            }

            AddAddtionalControls();

            //add a shim between the text and the buttons
            ControlStack.AddItem(new Shim()
            {
                Size = new Vector2(0, 32f)
            });

            labelStack.AddItem(ControlStack);

            //Add the buttons
            AddButtons(labelStack);

            //Set the position of the labelstack
            labelStack.Position = new Point(Resolution.TitleSafeArea.Center.X,
                                            Resolution.TitleSafeArea.Center.Y - (int)(labelStack.Rect.Height * .75f));

            AddItem(labelStack);

            AddBackgroundImage(labelStack);
        }