Exemplo n.º 1
0
        /// <summary>
        /// The render loop
        /// </summary>
        public override void OnRender()
        {
            try
            {
                // in directx we redraw everything every frame
                if (graphics.GType == IGraphics.Type.DirectX)
                {
                    stateMachine.ActiveState.InvalidateAll();
                    guiManager.InvalidateAll();
                }


                // draw the state
                stateMachine.Draw(graphics);

                /////////////////////////////////////////  un-Comment out for testing
                //                lblFps.Visible = false;
                //                lblFps.Text = "FPS " + timer.FramesPerSeconds.ToString();

                guiManager.Draw(graphics);
            }
            catch (Exception e)
            {
                MessageBox.Show("Unknown Render Error" + e.ToString());
                logError("\n***** Render Error *****\n" + e.ToString());
            }
        }
Exemplo n.º 2
0
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, e, cam.Transformation);

            ScreenManager.SpriteBatch.Draw(sampleBackground, new Rectangle(0, 0, 2048, 1344), Color.Gray);

            part.Draw(gameTime, ScreenManager);

            ScreenManager.SpriteBatch.End();


            ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null);

            gui.Draw(gameTime, ScreenManager);

            ScreenManager.SpriteBatch.End();


            vb.SetData <VertexPositionColor>(verts);
            ScreenManager.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
            ScreenManager.GraphicsDevice.SetVertexBuffer(vb);

            be.World = Matrix.Invert(cam.Transformation);

            foreach (var pass in be.CurrentTechnique.Passes)
            {
                pass.Apply();
                //ScreenManager.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, verts.Length / 3);
            }

            base.Draw(gameTime);
        }
Exemplo n.º 3
0
        protected override void Draw(GameTime gameTime)
        {
            switch (_gameState)
            {
            case GameStateEnum.Game:
                if (Session != null)
                {
                    Session.Draw(spriteBatch);
                }
                else
                {
                    GraphicsDevice.Clear(Color.Black);
                }

                Hud.Draw(spriteBatch);
                GuiManager.Draw(spriteBatch);
                break;

            case GameStateEnum.Menu:
                MenuState.Draw(spriteBatch);
                break;

            case GameStateEnum.Intro:
                Intro.Draw(spriteBatch);
                break;
            }

            if (Console.Enabled)
            {
                Console.Draw(spriteBatch);
            }
        }
Exemplo n.º 4
0
        protected override void Draw(GameTime time)
        {
            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Viewport = Viewport;
            //GraphicsDevice.Clear(new Color(30, 30, 30));
            GraphicsDevice.Clear(new Color(5, 5, 5));

            Screen.Update();
            Time.UpdateDraw(time);

            if (CurrentScene != null)
            {
                //MDraw.Begin();
                //CurrentScene.Draw();
                //MDraw.End();
            }

            //Physics.Draw();

            GuiManager.Draw();

            DebugGUI_Inputs.Draw();

            quickTest.Draw();

            //DrawWindowDebugPoints();
            //DrawFPS();

            base.Draw(time);
            lastTimeOfDraw = Time.ExactTimeSinceStartup;
        }
Exemplo n.º 5
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Begin();
     guiManager.Draw(spriteBatch);
     spriteBatch.End();
     base.Draw(spriteBatch);
 }
Exemplo n.º 6
0
 public void Draw(GameTime gameTime)
 {
     if (State == GameCore.GameState.Title)
     {
         gui.Draw(gameTime);
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            _levelManager.Draw(gameTime);

            // Vic am guessing this should be draw?
            _guiManager.Update(gameTime);


            _spriteBatch.Begin();
            if (imageTimer > 24)
            {
                _spriteBatch.Draw(textureAkkoDark, new Vector2(0, 0), Color.White);
            }
            else
            {
                _spriteBatch.Draw(textureAkkoLight, new Vector2(0, 0), Color.White);
            }
            _spriteBatch.End();

            _guiManager.Draw(gameTime, _spriteBatch);

            base.Draw(gameTime);
        }
Exemplo n.º 8
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Begin();
     spriteBatch.GraphicsDevice.Clear(Color.Black);
     gui.Draw(spriteBatch);
     spriteBatch.End();
 }
Exemplo n.º 9
0
        protected override void Draw(GameTime gameTime)
        {
            FpsMonitor.Update();
            GraphicsDevice.RasterizerState = RasterizerState.CullClockwise;

            GameStateManager.Draw(gameTime);
            GuiManager.Draw(gameTime);
        }
Exemplo n.º 10
0
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
            Gui.Draw(gameTime, ScreenManager);
            ScreenManager.SpriteBatch.End();

            base.Draw(gameTime);
        }
Exemplo n.º 11
0
 // draw
 public override void Draw(GameTime gametime)
 {
     _spriteBatch.Begin();
     foreach (var component in (from IDrawable c in Components orderby c.DrawOrder select c).ToArray())
     {
         component.Draw(gametime);
     }
     _spriteBatch.End();
     Gui.Draw(gametime);
 }
Exemplo n.º 12
0
        protected override void Draw(GameTime gameTime)
        {
            //GraphicsDevice.Present();
            FpsMonitor.Update();
            GraphicsDevice.RasterizerState = RasterizerState.CullClockwise;

            GameStateManager.Draw(gameTime);
            GuiManager.Draw(gameTime);

            this.Metrics = GraphicsDevice.Metrics;
        }
Exemplo n.º 13
0
        public void Draw(IGsGraphics graphics)
        {
            DrawParams dparams = new DrawParams(MiddleOffset + Position, FillMode, graphics);

            DrawGrid(dparams);
            DrawPieces(dparams);
            DrawInvaders(dparams);
            DrawProjectiles(dparams);
            DrawPieceRadius(dparams);

            mGui.Draw(graphics);
        }
Exemplo n.º 14
0
 public override void Draw(GameTime gameTime)
 {
     Background.Draw(gameTime);
     LevelManager.Draw(gameTime);
     TowerManager.Draw(gameTime);
     foreach (Creep creep in CreepList)
     {
         creep.Draw(gameTime);
     }
     GuiManager.Draw(gameTime);
     base.Draw(gameTime);
 }
Exemplo n.º 15
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            var titleString = "MonoRoids";
            var titleX      = (GameCore.WINDOW_WIDTH / 2) - (titleFont.MeasureString(titleString).X / 2);
            var titleY      = 100;

            //Draw world if ingame
            if (GameState == GameCore.STATE_GAME)
            {
                World.Draw(spriteBatch, gameTime);
            }

            //Draw title screen if state title
            else if (GameState == GameCore.STATE_TITLE)
            {
                spriteBatch.Begin();
                spriteBatch.Draw(titleTexture, Vector2.Zero, Color.White);
                spriteBatch.DrawString(titleFont, titleString, new Vector2(titleX, titleY), Color.White);
                spriteBatch.End();
                titleGui.Draw(gameTime);
            }
            //Draw score screen if state scores
            else if (GameState == GameCore.STATE_SCORES)
            {
                spriteBatch.Begin();
                spriteBatch.Draw(titleTexture, Vector2.Zero, Color.White);
                int counter = 1;
                int divider = 50;
                int nameX   = 200;
                int y       = 0;
                int scoreX  = 500;

                foreach (HighScore hs in HighScoreData)
                {
                    spriteBatch.DrawString(defaultFont, hs.Name, new Vector2(nameX, y + (counter * divider)), Color.White);
                    spriteBatch.DrawString(defaultFont, hs.Score.ToString(), new Vector2(scoreX, y + (counter * divider)), Color.White);
                    counter++;
                }
                spriteBatch.End();
                highScoresGui.Draw(gameTime);
            }
            //Draw high score input
            else if (GameState == GameCore.STATE_INPUTSCORE)
            {
                spriteBatch.Begin();
                spriteBatch.Draw(titleTexture, Vector2.Zero, Color.White);
                spriteBatch.End();
                inputHighScoreGui.Draw(gameTime);
            }
            base.Draw(gameTime);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            // This game has a blue background. Why? Because!
            ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
                                               Color.CornflowerBlue, 0, 0);

            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate,
                              SaveStateMode.None, camera.TransformMatrix);

            level.Draw(spriteBatch);

            DrawCursor();

            waveManager.Draw(spriteBatch);
            towerManager.Draw(spriteBatch);

            int round = waveManager.Round;

            guiManager.Draw(spriteBatch, round, money, lives);

            if (towerSelected)
            {
                Rectangle rect = Engine.CreateRectForCell(new Point((int)((selectedTowerPos.X + 16) / Engine.TileWidth),
                                                                    (int)(selectedTowerPos.Y + 16) / Engine.TileHeight));

                Vector2 center = new Vector2(rect.X + rect.Width / 2,
                                             rect.Y + rect.Height / 2);

                if (selectedType == 1)
                {
                    spriteBatch.Draw(arrowRange, Vector2.Subtract(center, new Vector2(arrowRange.Width / 2)),
                                     new Color(new Vector4(0, 0, 0, 0.5f)));
                }
                else if (selectedType == 2)
                {
                    spriteBatch.Draw(spikeRange, Vector2.Subtract(center, new Vector2(spikeRange.Width / 2)),
                                     new Color(new Vector4(0, 0, 0, 0.5f)));
                }
            }

            if (tower != null)
            {
                towerPreview.Draw(spriteBatch, cellX, cellY);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(_backgroundColor);

            _spriteBatch.Begin(blendState: BlendState.AlphaBlend, transformMatrix: _camera.GetViewMatrix());

            _spriteBatch.Draw(_sprite);
            _spriteBatch.End();

            // Draw GUI on top of everything
            _gui.Draw(gameTime);

            base.Draw(gameTime);
        }
Exemplo n.º 18
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            var transformMatrix = Camera.GetViewMatrix();

            spriteBatch.Begin(samplerState: SamplerState.PointClamp, transformMatrix: transformMatrix,
                              sortMode: SpriteSortMode.BackToFront, depthStencilState: DepthStencilState.Default);
            spriteBatch.Draw(_backgroundTexture, _destinationRectangle, Color.White);
            foreach (var entity in EntityList)
            {
                entity.Draw(spriteBatch);
            }
            spriteBatch.End();
            GuiManager.Draw(spriteBatch);
        }
Exemplo n.º 19
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            _spriteBatch.Begin();
            _spriteBatch.Draw(SharedArt.Null, new Rectangle(300, 450, 200, 5), new Color(255, 0, 0, 0.5f));
            _spriteBatch.Draw(SharedArt.Null, new Rectangle(0, 0, 200, 450), new Color(0, 0, 0, 0.5f));
            _spriteBatch.Draw(SharedArt.Null, new Rectangle(590, 0, 300, 600), new Color(0, 0, 0, 0.5f));
            _spriteBatch.Draw(SharedArt.Null, new Rectangle(200, 0, 150, 50), new Color(0, 0, 0, 0.5f));
            _spriteBatch.End();

            _guiManager.Draw(_spriteBatch);
            _boardManager.Draw(_spriteBatch);
            _mouseDrawer.Draw(_spriteBatch);

            base.Draw(gameTime);
        }
Exemplo n.º 20
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            var transformMatrix = CameraTracker.TransformationMatrix;

            spriteBatch.Begin(samplerState: SamplerState.PointClamp, transformMatrix: transformMatrix,
                              sortMode: SpriteSortMode.BackToFront, depthStencilState: DepthStencilState.Default);
            _mapRenderer.Draw(transformMatrix);
            foreach (var toRender in RenderList)
            {
                if (CameraTracker.Contains(toRender.Area))
                {
                    toRender.Draw(spriteBatch);
                }
            }
            PathRenderer.Draw(spriteBatch);
            spriteBatch.End();
            GuiManager.Draw(spriteBatch);
        }
Exemplo n.º 21
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            m_graphics.GraphicsDevice.Clear(m_deviceClearColor);

            if (m_noDraw)
            {
                return;
            }

            //m_graphics.GraphicsProfile = GraphicsProfile.Reach;

            m_guiManager.Draw(gameTime);

            //m_graphics.GraphicsProfile = GraphicsProfile.HiDef;
            // draw effects like bloom

            base.Draw(gameTime);
        }
Exemplo n.º 22
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null, null, Camera.Transform);

            spriteBatch.Draw(_defaultTex, _roomManager.CurrentRoom.GrassRec, Room.Grass);

            if (_roomManager.CurrentRoom.IsWater)
            {
                spriteBatch.Draw(_defaultTex, _roomManager.CurrentRoom.GrassRec2, Room.Grass);
            }

            //Shows Hurtboxes. Only for testing
            if (_showHurtboxes)
            {
                foreach (var sprite1 in _onScreenSprites.Where(c => c is IDamageable))
                {
                    var sprite = (IDamageable)sprite1;
                    spriteBatch.Draw(_defaultTex, ((Sprite)sprite).Hurtbox, Color.Blue);
                }
            }

            else
            {
                foreach (var sprite in _onScreenSprites)
                {
                    sprite.Draw(gameTime, spriteBatch);

                    // Shows the Y position of LayerOrigin. Only for testing
                    //spriteBatch.Draw(_defaultTex, sprite.LayerOriginTestRectangle, Color.Black);
                }
            }

            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, null);

            _guiManager.Draw(gameTime, spriteBatch, _players[0].Health);

            spriteBatch.DrawString(_font, "Score: " + Score.ToString(), new Vector2(20, 100), Color.White);

            spriteBatch.End();
        }
Exemplo n.º 23
0
        /// <summary>
        /// Renders the active scene.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            Matrix matrix = TransformationMatrix;

            if (ResolutionIndependent)
            {
                matrix *= SpriteScale;
            }

            GraphicsDevice.Clear(Color.Black);

            SpriteBatch.Begin(spriteSortMode, blendState, samplerState, depthStencilState, rasterizerState, null, matrix);
            GameStateManager.Draw(gameTime);
            EntityWorld.SystemManager.UpdateSynchronous(SystemExecutionType.Draw);
            SpriteBatch.End();

            GuiManager.Draw(gameTime);

            base.Draw(gameTime);
        }
Exemplo n.º 24
0
 public void Draw(GameTime gameTime)
 {
     _gui.Draw(gameTime);
 }
Exemplo n.º 25
0
 public override void Draw(GameTime gameTime)
 {
     _activeScreen.Draw(gameTime);
     _gui.Draw(gameTime);
 }
Exemplo n.º 26
0
        public void Draw(GameWindow gw, FrameEventArgs e)
        {
            //----------------------------setting up shaders-------------
            #region ShaderUniforms
            defaultShader.Bind();
            //defaultShader.SetUniform("bloom", false);
            defaultShader.SetUniform("proj", cam.Projection);
            defaultShader.SetUniform("view", cam.Transfrom);
            defaultShader.SetUniform("lightPos", cam.LightPos);

            earthShader.Bind();
            earthShader.SetUniform("view", cam.Transfrom);
            earthShader.SetUniform("proj", cam.Projection);
            earthShader.SetUniform("eyePos", cam.Position);
            earthShader.SetUniform("lightPos", cam.LightPos);

            sunShader.Bind();
            sunShader.SetUniform("view", cam.Transfrom);
            sunShader.SetUniform("proj", cam.Projection);

            lineShader.Bind();
            lineShader.SetUniform("view", cam.Transfrom);
            lineShader.SetUniform("proj", cam.Projection);
            #endregion

            //textured items
            buffer.Bind();
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            skybox.draw(cam);

            foreach (Planet p in planets)
            {
                p.Draw(cam, defaultShader, lineShader);
            }

            sun.Draw(cam, sunShader);
            earth.Draw(cam, earthShader, lineShader);

            //transparent items
            //foreach (PlanetRing r in rings)
            //    r.draw(cam.Transfrom, defaultShader);

            int blurrPasses    = bloom ? 5 : 0;
            var blurredTexture = blur.Blur(buffer.Textures[1], blurrPasses);

            GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
            GL.Viewport(0, 0, gw.Width, gw.Height);

            //frame.Draw(Area.TopLeft, buffer.Textures[0]);
            //frame.Draw(Area.TopRight, buffer.Textures[1]);

            if (showBloomBuffer)
            {
                frame.Draw(Area.BottomRight, blurredTexture);
            }

            finalShader.Bind();
            finalShader.SetUniform("useBloom", bloom);
            frame.Draw(Area.Full, buffer.Textures[0], blurredTexture, finalShader);

            guiManager.Draw(gw);
        }
Exemplo n.º 27
0
 public override void Draw(GameTime gameTime)
 {
     guiManager.Draw(gameTime, renderer.SpriteBatch);
     base.Draw(gameTime);
 }