コード例 #1
0
ファイル: TitleScreen.cs プロジェクト: HavenDV/AsteroidsWasm
        /// <summary>
        /// Draws the next screen frame.
        /// </summary>
        public void DrawScreen()
        {
            //Draw instructions
            _textManager.DrawText(
                Instructions
                , TextManager.Justify.Center
                , InstructionOffset
                , InstructionSize, InstructionSize
                );

            // Flip back and forth between "Game Over" and "Asteroids"
            if ((_letterSize > 1000) || (_letterSize < 40))
            {
                _increment = -_increment;
                if (_letterSize < 40)
                {
                    _title = _title == "GAME OVER"
                        ? "ASTEROIDS"
                        : "GAME OVER";
                }
            }
            _letterSize += _increment;
            _textManager.DrawText(
                _title
                , TextManager.Justify.Center
                , ScreenCanvas.CanvasHeight / 2 - _letterSize
                , _letterSize
                , _letterSize * 2
                );

            // Draw copyright notice
            _textManager.DrawText(
                Copyright1
                , TextManager.Justify.Center
                , TitleOffset1
                , TitleSize
                , TitleSize
                );

            _textManager.DrawText(
                Copyright2
                , TextManager.Justify.Center
                , TitleOffset2
                , TitleSize
                , TitleSize
                );

            // Draw the asteroid belt
            _cache.Repopulate();

            foreach (var asteroid in _cache.Asteroids)
            {
                asteroid.ScreenObject.Move();
                _canvas.LoadPolygon(asteroid.PolygonPoints, DrawColor.White);
            }
        }
コード例 #2
0
        /// <summary>
        /// Draws the next screen frame.
        /// </summary>
        public void DrawScreen()
        {
            //Draw Play instructions
            _textManager.DrawText(
                instructions
                , TextManager.Justify.CENTER
                , instructionOffset
                , instructionSize, instructionSize
                );

            //Draw Options instructions
            _textManager.DrawText(
                instructions2
                , TextManager.Justify.CENTER
                , instructionOffset2
                , instructionSize2, instructionSize2
                );

            // Flip back and forth between "Game Over" and "Asteroids"
            if ((_letterSize > 1000) || (_letterSize < 40))
            {
                _increment = -_increment;
                if (_letterSize < 40)
                {
                    if (_title == "GAME OVER")
                    {
                        _title = "ASTEROIDS";
                    }
                    else
                    {
                        _title = "GAME OVER";
                    }
                }
            }
            _letterSize += _increment;
            _textManager.DrawText(_title, TextManager.Justify.CENTER,
                                  ScreenCanvas.CANVAS_HEIGHT / 2 - _letterSize, _letterSize, _letterSize * 2);

            // Draw copyright notice
            _textManager.DrawText(copyright1, TextManager.Justify.CENTER,
                                  titleOffset1, titleSize, titleSize);

            _textManager.DrawText(copyright2, TextManager.Justify.CENTER,
                                  titleOffset2, titleSize, titleSize);

            // Draw the asteroid belt
            _cache.Repopulate();

            foreach (var asteroid in _cache.Asteroids)
            {
                asteroid.ScreenObject.Move();
                _canvas.LoadPolygon(asteroid.PolygonPoints, ColorHexStrings.DarkOrangeHex);
            }
        }
コード例 #3
0
ファイル: Options.cs プロジェクト: SondreKNW/AsteroidsWasm
        public void DrawScreen()
        {
            // Draw Options Title
            _textManager.DrawText(
                Title
                , TextManager.Justify.CENTER
                , 1000
                , titleSize, titleSize
                );

            // Draw Color option instructions
            _textManager.DrawText(
                Color
                , TextManager.Justify.CENTER
                , 2500
                , colorSize, colorSize
                );

            // Draw Background option instructions
            _textManager.DrawText(
                Background
                , TextManager.Justify.CENTER
                , 3500
                , backgroundSize, backgroundSize
                );

            // Draw Escape instructions
            _textManager.DrawText(
                Escape
                , TextManager.Justify.CENTER
                , 6500
                , escapeSize, escapeSize
                );

            // Draw Astroid belt
            _cache.Repopulate();
            foreach (var asteroid in _cache.Asteroids)
            {
                asteroid.ScreenObject.Move();
                _canvas.LoadPolygon(asteroid.PolygonPoints, ColorHexStrings.DarkOrangeHex);
            }
        }