Exemplo n.º 1
0
        public override void Draw(SpriteBatchProxy spriteBatch)
        {
            // Draw the skybox
            _skybox.Draw(spriteBatch);

            ParticuleManager.Draw(true);

            spriteBatch.Begin(SceneCamera);

            _level.Draw(spriteBatch);

            if (Application.IsDebugMode)
            {
                // World base axis
                spriteBatch.DrawRectangle(new Rectangle(-1, -1, 2, _level.Dimensions.Height), Color.Red);
                spriteBatch.DrawRectangle(new Rectangle(-1, -1, _level.Dimensions.Width, 2), Color.Green);

                Application.PhysicsManager.Draw(spriteBatch);
            }

            spriteBatch.End();

            ParticuleManager.Draw(false);

            // Draw HUD and Compass out of the camera
            if (_isEnded == false)
            {
                _hud.Draw(spriteBatch);
                _compass.Draw(spriteBatch);
            }

            spriteBatch.BeginNoCamera();
            spriteBatch.DrawRectangle(new Rectangle(0, 0, Resolution.VirtualWidth, Resolution.VirtualHeight), Color.Black * _alphaPause);

            if (_isPaused)
            {
                // Draw "PAUSE"
                Vector2 _pauseLoc = new Vector2(Resolution.VirtualWidth / 2 - Application.MagicContentManager.Font.MeasureString("PAUSE").X / 2, 300);

                spriteBatch.DrawString(Application.MagicContentManager.Font, "PAUSE", _pauseLoc, Color.White * _alphaPause);

                // Draw controls
                var devices = Application.InputManager.GetLinkedDevices(LogicalPlayerIndex.One).FindAll(d => d.IsConnected);

                Vector2 buttonLoc = new Vector2((int)_pauseLoc.X - 150, _pauseLoc.Y + 60);

                for (int i = 0; i < devices.Count; i++)
                {
                    ButtonPrinter.Draw(spriteBatch, MappingButtons.Start, devices[i], buttonLoc, Color.White * _alphaPause);
                    buttonLoc.X += 50;
                }

                Vector2 textLoc = buttonLoc + new Vector2(100,0);
                spriteBatch.DrawString(Application.MagicContentManager.Font, LocalizedStrings.GetString("BackToGame"), textLoc, Color.White * _alphaPause);

                buttonLoc = new Vector2((int)_pauseLoc.X - 150, _pauseLoc.Y + 100);

                for (int i = 0; i < devices.Count; i++)
                {
                    ButtonPrinter.Draw(spriteBatch, MappingButtons.Back, devices[i], buttonLoc, Color.White * _alphaPause);
                    buttonLoc.X += 50;
                }
                textLoc = buttonLoc + new Vector2(100, 0);
                spriteBatch.DrawString(Application.MagicContentManager.Font, LocalizedStrings.GetString("BackToHome"), textLoc, Color.White * _alphaPause);
            }
            spriteBatch.End();
        }
Exemplo n.º 2
0
        public override void Draw(SpriteBatchProxy spriteBatch)
        {
            ParticuleManager.Draw(true);

            spriteBatch.BeginNoCamera();
            spriteBatch.Draw(Application.MagicContentManager.GetTexture("homebg"), _dstBg, _srcBg, _bgColor);
            spriteBatch.End();

            //-----------------------------------------------------------------------------------------------
            spriteBatch.Begin(SceneCamera);

            if (!_isInitialized)
            {
                spriteBatch.Draw(Application.MagicContentManager.GetTexture("star"), _dstStar, _srcStar, Color.White);
            }

            spriteBatch.Draw(Application.MagicContentManager.GetTexture("title"), _dstTitle, _srcTitle, Color.White, TitltForTitle, Vector2.Zero, SpriteEffects.None, 1);

            foreach (Entity e in _asteroidLayer.Entities)
            {
                e.Draw(spriteBatch);
            }

            spriteBatch.End();
            //-----------------------------------------------------------------------------------------------
            ParticuleManager.Draw(false);

            spriteBatch.Begin(SceneCamera);
            spriteBatch.Draw(Application.MagicContentManager.GetTexture("fore"), _dstFore, _srcFore, _generalColor);

            if (_textDisplayed && !_isInitialized)
            {
                spriteBatch.DrawString(Application.MagicContentManager.Font, _startStr, _startLoc, Color.White);
            }

            if (_isMenuDisplayed)
            {
                drawMenu(spriteBatch);
            }

            //-----------------------------------------------------------------------------------------------
            spriteBatch.End();
        }