예제 #1
0
        public void Render(IGameTime gameTime)
        {
            Graphics.Clear(',', _colorMap[',']);

            var framePosition = new Position
            {
                Row = (Graphics.Height - _currentTexture.Height) / 2,
                Col = (Graphics.Width - _currentTexture.Width) / 2,
            };

            if (framePosition.Col > 0)
            {
                var rainbowPosition = new Position
                {
                    Row = (Graphics.Height - 18) / 2,
                    Col = 0,
                };
                var rainbowTexture = new NyncatTailTexture(_frameId, framePosition.Col, _colorMap);

                Graphics.Draw(rainbowTexture, rainbowPosition);
            }

            Graphics.Draw(_currentTexture, framePosition);

            if (SceneOptions.ShowCounter)
            {
                var seconds  = ((int)counter.Elapsed.TotalSeconds).ToString();
                var message  = $"You have nyaned for {seconds} seconds!";
                var position = new Position
                {
                    Col = (Graphics.Width - message.Length) / 2,
                    Row = Graphics.Height - 1,
                };

                Graphics.Draw(message, position, Color.White, _colorMap[',']);
            }

            if (gameTime.ElapsedGameTime.Milliseconds < 100)
            {
                Thread.Sleep(100 - gameTime.ElapsedGameTime.Milliseconds);
            }

            Graphics.Render();
        }
예제 #2
0
        public void Render(IGameTime gameTime)
        {
            var moveOn = 5 - gameTime.TotalGameTime.Seconds;

            if (moveOn < 0)
            {
                SceneManager.GoTo <NyancatScene>();
                return;
            }

            Graphics.Clear(Color.Black);

            var row = 3;

            foreach (var line in _messages)
            {
                int col     = (Graphics.Width - line.Length) / 2;
                var postion = new Position
                {
                    Row = row,
                    Col = col
                };

                Graphics.Draw(line, postion, Color.White, Color.Black);
                row += 2;
            }

            Color test = Color.Empty;

            var starting = $"Starting in {(5 - gameTime.TotalGameTime.Seconds)}...";
            var position = new Position
            {
                Row = row,
                Col = (Graphics.Width - starting.Length) / 2,
            };

            Graphics.Draw(starting, position, Color.White, Color.Black);
            Graphics.Render();
        }