示例#1
0
        /// <summary>
        /// Zeichnen der Elemente
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="gameTime"></param>
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            switch (SceneMode)
            {
                case SceneMode.FirstStart:
                    text = "Bereit?";
                    gameScene.Draw(spriteBatch, gameTime);
                    break;

                case SceneMode.Paused:
                    text = "Pausiert";
                    break;

                case SceneMode.WonLost:
                    break;

                case SceneMode.Scored:
                    text = "Bereit?";
                    gameScene.Draw(spriteBatch, gameTime);
                    break;

                default:
                    break;
            }
            font = new Font("Arial", 50, TypefaceStyle.Bold);
            position = new Vector2()
            {
                X = (graphicsDevice.BackBuffer.Width - spriteBatch.MeasureString(text, font).X) / 2,
                Y = 100
            };
            color = Color.White;
            spriteBatch.DrawString(text, font, position, color);
        }
示例#2
0
 /// <summary>
 /// Loads the content.
 /// </summary>
 /// <param name="content">The ContentManager.</param>
 public override void LoadContent(ContentManager content)
 {
     _skyBox =
         new Skybox(new[]
         {
             content.Load<Texture2D>("mainbackground.png"), content.Load<Texture2D>("bgLayer1.png"),
             content.Load<Texture2D>("bgLayer2.png")
         });
     _header = new Font("Segoe UI", 25, TypefaceStyle.Bold);
     _subHeader = new Font("Segoe UI", 40, TypefaceStyle.Bold);
     _fadeableText1 = new FadeableText
     {
         Font = _header,
         Text = "ThuCommix presents",
         Position = new Vector2(270, 200),
         FadeInVelocity = 2,
         FadeOutVelocity = 3
     };
     _fadeableText2 = new FadeableText
     {
         Font = _header,
         Text = "a game powered by Sharpex2D",
         Position = new Vector2(220, 200),
         FadeInVelocity = 2,
         FadeOutVelocity = 3
     };
     _fadeableText3 = new FadeableText
     {
         Font = _subHeader,
         Text = "XPlane",
         Position = new Vector2(330, 200),
         FadeInVelocity = 2,
         FadeOutVelocity = 2
     };
 }
示例#3
0
 /// <summary>
 /// Initializes a new MenuButton class.
 /// </summary>
 /// <param name="assignedUIManager">The AssignedUIManager.</param>
 public MenuButton(UIManager assignedUIManager)
     : base(assignedUIManager)
 {
     Size = new UISize(300, 30);
     _font = new Font("Segoe UI", 16, TypefaceStyle.Bold);
     Text = "MenuButton1";
 }
示例#4
0
 /// <summary>
 /// Initializes a new Scoreboard class.
 /// </summary>
 public Scoreboard()
 {
     _scoreFont = new Font("Segoe UI", 30, TypefaceStyle.Bold);
     _healthFont = new Font("Segoe UI", 20, TypefaceStyle.Bold);
     _scorePosition = new Vector2(5, 0);
     _healthPosition = new Vector2(5, 40);
 }
示例#5
0
 /// <summary>
 /// Initializes a new ScoreIndicator class.
 /// </summary>
 public ScoreIndicator()
 {
     LifeTime = 750;
     Position = new Vector2(0);
     IsVisible = true;
     _font = new Font("Segoe UI", 18, TypefaceStyle.Bold);
 }
示例#6
0
 /// <summary>
 /// Initializes a new FadeableText.
 /// </summary>
 public FadeableText()
 {
     Text = "Fadeable Text1";
     Font = new Font("Segoe UI", 9, TypefaceStyle.Regular);
     Position = new Vector2(0, 0);
     FadeInVelocity = 1;
     FadeOutVelocity = 2;
 }
示例#7
0
 public FadableText()
 {
     Text = "Fadable Text 1";
     Font = new Font("Arial", 20f, TypefaceStyle.Regular);
     Position = new Vector2(0, 0);
     FadeInVelocity = 1;
     FadeOutVelocity = 2;
 }
示例#8
0
        /// <summary>
        /// Initializes a new DebugDisplay class.
        /// </summary>
        /// <param name="entityComposer">The EntityComposer.</param>
        public DebugDisplay(EntityComposer entityComposer)
        {
            _currentEntityComposer = entityComposer;
            _gameLoop = SGL.QueryComponents<GameLoop>();

            _font = new Font("Segoe UI", 12, TypefaceStyle.Regular);
            _cpuWatcher = new CpuWatcher();
            _memoryWatcher = new MemoryWatcher();
            _threadWatcher = new ThreadWatcher();
            _display = new Rectangle(0, 0, 800, 480);
            _debugMessage = "Query information ...";
            _pen = new Pen(Color.Green, 1);
            _pen2 = new Pen(Color.Red, 1);
            _pen3 = new Pen(Color.Blue, 1);

            _cpuWatcher.Start();
            _memoryWatcher.Start();
            _threadWatcher.Start();
        }
示例#9
0
 /// <summary>
 ///     Initializes a new Scoreboard class.
 /// </summary>
 public Scoreboard()
 {
     _font = new Font("Segoe UI", 45, TypefaceStyle.Bold);
 }
示例#10
0
 /// <summary>
 /// Measures the string.
 /// </summary>
 /// <param name="text">The String.</param>
 /// <param name="font">The Font.</param>
 /// <returns>Vector2.</returns>
 public Vector2 MeasureString(string text, Font font)
 {
     return Renderer.MeasureString(text, font.Instance);
 }
示例#11
0
 /// <summary>
 /// Draws a string.
 /// </summary>
 /// <param name="text">The Text.</param>
 /// <param name="font">The Font.</param>
 /// <param name="position">The Position.</param>
 /// <param name="color">The Color.</param>
 public void DrawString(string text, Font font, Vector2 position, Color color)
 {
     Renderer.DrawString(text, font.Instance, position, color);
 }
示例#12
0
 /// <summary>
 /// Draws a string.
 /// </summary>
 /// <param name="text">The Text.</param>
 /// <param name="font">The Font.</param>
 /// <param name="rectangle">The Rectangle.</param>
 /// <param name="color">The Color.</param>
 public void DrawString(string text, Font font, Rectangle rectangle, Color color)
 {
     Renderer.DrawString(text, font.Instance, rectangle, color);
 }
示例#13
0
        /// <summary>
        ///     Loads the content.
        /// </summary>
        public override void OnLoadContent()
        {
            _animatedBackground = new AnimatedBackground(Content.Load<Texture2D>("background.png"));
            _instructions = new Instructions(Content.Load<Texture2D>("instructions.png")) {Visible = true};
            _player = new Player(Content.Load<Texture2D>("bird_sprite.png"), Content.Load<Texture2D>("bird_erased.png"));
            _receivedCoin = new SoundEffect(Content.Load<Sound>("score.wav")) { Volume = 0.2f };
            _die = new SoundEffect(Content.Load<Sound>("dead.wav")) { Volume = 0.2f };
            _scoreboard = new Scoreboard();
            _pipeManager = new PipeManager(Content.Load<Texture2D>("pipe_body.png"),
                Content.Load<Texture2D>("pipe_bottom.png"), Content.Load<Texture2D>("pipe_top.png"));
            _swing = new SoundEffect(Content.Load<Sound>("swing.wav")){Volume = 0.2f};
            _pipeManager.ScoreChanged += _pipeManager_ScoreChanged;
            _font = new Font("Segoe UI", 9, TypefaceStyle.Regular);
            _deviceHintPosition = new Vector2(0, 0);

            int x = Convert.ToInt32(_resolution.Split('x')[0]);
            int y = Convert.ToInt32(_resolution.Split('x')[1]);

            SGL.Components.Get<RenderTarget>().Window.Size = new Vector2(x, y);
            SGL.Components.Get<GraphicsDevice>().BackBuffer.Scaling = true;
        }
示例#14
0
 /// <summary>
 /// Initializes the scene.
 /// </summary>
 public override void Initialize()
 {
     _backgroundPosition = new Vector2(0);
     _font = new Font("Segoe UI", 30, TypefaceStyle.Bold);
     _font2 = new Font("Segoe UI", 13, TypefaceStyle.Regular);
     _font3 = new Font("Segoe UI", 16, TypefaceStyle.Bold);
     Input = SGL.QueryComponents<InputManager>();
 }
示例#15
0
 /// <summary>
 ///     Initializes a new Instructions class.
 /// </summary>
 /// <param name="texture">The Texture.</param>
 public Instructions(Texture2D texture)
 {
     _texture = texture;
     _position = new Vector2(291, 215);
     _font = new Font("Segoe UI", 11, TypefaceStyle.Regular);
 }