Ejemplo n.º 1
0
        public override void Draw(GameTime gameTime)
        {
            BatchEffect.View       = Camera.View;
            BatchEffect.Projection = Camera.Projection;
            SpriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, BatchEffect);

            for (int i = 0; i < 5; ++i)
            {
                SpriteBatch.Draw(_rectangleSprite.Texture, _rectangle[i].Position, null,
                                 Color.White, _rectangle[i].Rotation, _rectangleSprite.Origin, new Vector2(1.5f, 1.5f) * _rectangleSprite.TexelSize, SpriteEffects.FlipVertically, 0f);
            }

            SpriteBatch.End();
            LineBatch.Begin(Camera.Projection, Camera.View);

            foreach (Fixture f in _ramps.FixtureList)
            {
                LineBatch.DrawLineShape(f.Shape, ContentWrapper.Teal);
            }

            LineBatch.End();

            _border.Draw(Camera.Projection, Camera.View);

            base.Draw(gameTime);
        }
Ejemplo n.º 2
0
        public void Draw(BasicEffect batchEffect, Camera2D camera)
        {
            batchEffect.View       = camera.View;
            batchEffect.Projection = camera.Projection;

            _spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, batchEffect);
            _spriteBatch.Draw(_body.Texture, _chassis.Position, null, Color.White, _chassis.Rotation, _body.Origin, new Vector2(5f, 2.0f) * _body.TexelSize, SpriteEffects.FlipVertically, 0f);
            _spriteBatch.End();

            for (int i = 0; i < 3; ++i)
            {
                _spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, batchEffect);
                _spriteBatch.Draw(_leftLeg.Texture, _leftLegs[i].Position, null, Color.White, _leftLegs[i].Rotation, _leftLeg.Origin, new Vector2(2.9583f, 4.9583f) * _leftLeg.TexelSize, SpriteEffects.FlipVertically, 0f);
                _spriteBatch.Draw(_leftShoulder.Texture, _leftShoulders[i].Position, null, Color.White, _leftShoulders[i].Rotation, _leftShoulder.Origin, new Vector2(3.5833f, 2.9583f) * _leftShoulder.TexelSize, SpriteEffects.FlipVertically, 0f);
                _spriteBatch.Draw(_rightLeg.Texture, _rightLegs[i].Position, null, Color.White, _rightLegs[i].Rotation, _rightLeg.Origin, new Vector2(2.9583f, 4.9583f) * _rightLeg.TexelSize, SpriteEffects.FlipVertically, 0f);
                _spriteBatch.Draw(_rightShoulder.Texture, _rightShoulders[i].Position, null, Color.White, _rightShoulders[i].Rotation, _rightShoulder.Origin, new Vector2(3.5833f, 2.9583f) * _rightShoulder.TexelSize, SpriteEffects.FlipVertically, 0f);
                _spriteBatch.End();

                _lineBatch.Begin(_camera.Projection, _camera.View);
                for (int j = 0; j < 8; j++)
                {
                    _lineBatch.DrawLine(_walkerJoints[8 * i + j].WorldAnchorA, _walkerJoints[8 * i + j].WorldAnchorB, Color.DarkRed);
                }
                _lineBatch.End();
            }

            _spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, batchEffect);
            _spriteBatch.Draw(_engine.Texture, _wheel.Position, null, Color.White * 0.7f, _wheel.Rotation, _engine.Origin, new Vector2(2f * 1.6f) * _engine.TexelSize, SpriteEffects.FlipVertically, 0f);
            _spriteBatch.End();
        }
Ejemplo n.º 3
0
        public void Draw(SpriteBatch batch, BasicEffect batchEffect, LineBatch lines, Camera2D camera)
        {
            batchEffect.View       = camera.View;
            batchEffect.Projection = camera.Projection;

            batch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, batchEffect);
            batch.Draw(_body.Texture, _chassis.Position, null, Color.White, _chassis.Rotation, _body.Origin, new Vector2(5f, 2.0f) * _body.TexelSize, SpriteEffects.FlipVertically, 0f);
            batch.End();

            for (int i = 0; i < 3; i++)
            {
                batch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, batchEffect);
                batch.Draw(_leftLeg.Texture, _leftLegs[i].Position, null, _walkerColors[i], _leftLegs[i].Rotation, _leftLeg.Origin, new Vector2(2.9583f, 4.9583f) * _leftLeg.TexelSize, SpriteEffects.FlipVertically, 0f);
                batch.Draw(_leftShoulder.Texture, _leftShoulders[i].Position, null, _walkerColors[i], _leftShoulders[i].Rotation, _leftShoulder.Origin, new Vector2(3.5833f, 2.9583f) * _leftShoulder.TexelSize, SpriteEffects.FlipVertically, 0f);
                batch.Draw(_rightLeg.Texture, _rightLegs[i].Position, null, _walkerColors[i], _rightLegs[i].Rotation, _rightLeg.Origin, new Vector2(2.9583f, 4.9583f) * _rightLeg.TexelSize, SpriteEffects.FlipVertically, 0f);
                batch.Draw(_rightShoulder.Texture, _rightShoulders[i].Position, null, _walkerColors[i], _rightShoulders[i].Rotation, _rightShoulder.Origin, new Vector2(3.5833f, 2.9583f) * _rightShoulder.TexelSize, SpriteEffects.FlipVertically, 0f);
                batch.End();

                lines.Begin(camera.Projection, camera.View);
                for (int j = 0; j < 8; j++) // 4 joints pro for schleife...
                {
                    lines.DrawLine(_walkerJoints[8 * i + j].WorldAnchorA, _walkerJoints[8 * i + j].WorldAnchorB, ContentWrapper.Grey);
                }
                lines.End();
            }

            batch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, batchEffect);
            batch.Draw(_engine.Texture, _wheel.Position, null, Color.White * 0.7f, _wheel.Rotation, _engine.Origin, new Vector2(2f * 1.6f) * _engine.TexelSize, SpriteEffects.FlipVertically, 0f);
            batch.End();
        }
Ejemplo n.º 4
0
        public override void Draw(GameTime gameTime)
        {
            LineBatch.Begin(Camera.Projection, Camera.View);
            foreach (Fixture f in _obstacles.FixtureList)
            {
                LineBatch.DrawLine(_distanceBody[0].Position, _distanceBody[1].Position, ContentWrapper.Black);
                LineBatch.DrawLine(_distanceBody[2].Position, _distanceBody[3].Position, ContentWrapper.Black);
            }
            LineBatch.End();

            BatchEffect.View       = Camera.View;
            BatchEffect.Projection = Camera.Projection;
            SpriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, BatchEffect);
            for (int i = 0; i < 3; i++)
            {
                SpriteBatch.Draw(_angleCube.Texture, _angleBody[i].Position, null, Color.White, _angleBody[i].Rotation, _angleCube.Origin, new Vector2(1.5f, 1.5f) * _angleCube.TexelSize, SpriteEffects.FlipVertically, 0f);
            }
            for (int i = 0; i < 4; i++)
            {
                SpriteBatch.Draw(_distanceCube.Texture, _distanceBody[i].Position, null, Color.White, _distanceBody[i].Rotation, _distanceCube.Origin, new Vector2(1.5f, 1.5f) * _distanceCube.TexelSize, SpriteEffects.FlipVertically, 0f);
            }
            SpriteBatch.End();

            LineBatch.Begin(Camera.Projection, Camera.View);
            foreach (Fixture f in _obstacles.FixtureList)
            {
                LineBatch.DrawLineShape(f.Shape, ContentWrapper.Black);
            }
            LineBatch.End();

            _border.Draw(Camera.Projection, Camera.View);

            base.Draw(gameTime);
        }
Ejemplo n.º 5
0
        public void Draw(SpriteBatch batch, LineBatch lines, Camera2D camera)
        {
            batch.Begin(0, null, null, null, null, null, camera.View);
            batch.Draw(_body.Image, ConvertUnits.ToDisplayUnits(_chassis.Position), null, Color.White, _chassis.Rotation, _body.Origin, 1f, SpriteEffects.None, 0f);
            batch.End();
            for (int i = 0; i < 3; i++)
            {
                batch.Begin(0, null, null, null, null, null, camera.View);
                batch.Draw(_leftLeg.Image, ConvertUnits.ToDisplayUnits(_leftLegs[i].Position), null, _walkerColors[i], _leftLegs[i].Rotation, _leftLeg.Origin, 1f, SpriteEffects.None, 0f);
                batch.Draw(_leftShoulder.Image, ConvertUnits.ToDisplayUnits(_leftShoulders[i].Position), null, _walkerColors[i], _leftShoulders[i].Rotation, _leftShoulder.Origin, 1f, SpriteEffects.None, 0f);
                batch.Draw(_rightLeg.Image, ConvertUnits.ToDisplayUnits(_rightLegs[i].Position), null, _walkerColors[i], _rightLegs[i].Rotation, _rightLeg.Origin, 1f, SpriteEffects.None, 0f);
                batch.Draw(_rightShoulder.Image, ConvertUnits.ToDisplayUnits(_rightShoulders[i].Position), null, _walkerColors[i], _rightShoulders[i].Rotation, _rightShoulder.Origin, 1f, SpriteEffects.None, 0f);
                batch.End();

                lines.Begin(ref camera.SimProjection, ref camera.SimView);

                for (int j = 0; j < 8; j++)
                {
                    lines.DrawLine(_walkerJoints[8 * i + j].WorldAnchorA, _walkerJoints[8 * i + j].WorldAnchorB, Colors.Grey);
                }

                lines.End();
            }

            batch.Begin(0, null, null, null, null, null, camera.View);
            batch.Draw(_engine.Image, ConvertUnits.ToDisplayUnits(_wheel.Position), null, Color.White, _wheel.Rotation, _engine.Origin, 1f, SpriteEffects.None, 0f);
            batch.End();
        }
Ejemplo n.º 6
0
        public void Draw()
        {
            LineBatch   _batch       = _screen.ScreenManager.LineBatch;
            SpriteBatch _spriteBatch = _screen.ScreenManager.SpriteBatch;

            _spriteBatch.Begin(0, null, null, null, null, null, _screen.Camera.View);
            _spriteBatch.Draw(_body.Texture, ConvertUnits.ToDisplayUnits(_chassis.Position), null,
                              Color.White, _chassis.Rotation, _body.Origin, 1f, SpriteEffects.None, 0f);
            _spriteBatch.End();

            _batch.Begin(_screen.Camera.SimProjection, _screen.Camera.SimView);
            for (int i = 0; i < _walkerJoints.Count; ++i)
            {
                _batch.DrawLine(_walkerJoints[i].WorldAnchorA, _walkerJoints[i].WorldAnchorB, Color.DarkRed);
            }
            _batch.End();

            _spriteBatch.Begin(0, null, null, null, null, null, _screen.Camera.View);
            for (int i = 0; i < 3; ++i)
            {
                _spriteBatch.Draw(_leftLeg.Texture, ConvertUnits.ToDisplayUnits(_leftLegs[i].Position), null,
                                  Color.White, _leftLegs[i].Rotation, _leftLeg.Origin, 1f, SpriteEffects.None, 0f);
                _spriteBatch.Draw(_leftShoulder.Texture, ConvertUnits.ToDisplayUnits(_leftShoulders[i].Position), null,
                                  Color.White, _leftShoulders[i].Rotation, _leftShoulder.Origin, 1f, SpriteEffects.None,
                                  0f);
                _spriteBatch.Draw(_rightLeg.Texture, ConvertUnits.ToDisplayUnits(_rightLegs[i].Position), null,
                                  Color.White, _rightLegs[i].Rotation, _rightLeg.Origin, 1f, SpriteEffects.None, 0f);
                _spriteBatch.Draw(_rightShoulder.Texture, ConvertUnits.ToDisplayUnits(_rightShoulders[i].Position), null,
                                  Color.White, _rightShoulders[i].Rotation, _rightShoulder.Origin, 1f,
                                  SpriteEffects.None, 0f);
            }
            _spriteBatch.Draw(_engine.Texture, ConvertUnits.ToDisplayUnits(_wheel.Position), null,
                              Color.White, _wheel.Rotation, _engine.Origin, 1f, SpriteEffects.None, 0f);
            _spriteBatch.End();
        }
Ejemplo n.º 7
0
        public override void Draw(Camera3D camera)
        {
            LineBatch.Begin(Matrix.Identity, camera);

            for (int i = 0; i < startPoints.Count; i++)
            {
                LineBatch.Draw(startPoints[i], endPoints[i], widths[i], new Color(gridBrightnesses[i], gridBrightnesses[i], gridBrightnesses[i], 1.0f));
            }

            LineBatch.Draw(new Vector3(bounds.Min.X, bounds.Min.Y, bounds.Min.Z), new Vector3(bounds.Max.X, bounds.Min.Y, bounds.Max.Z), 5.0f, Color.White);
            LineBatch.Draw(new Vector3(bounds.Min.X, bounds.Max.Y, bounds.Min.Z), new Vector3(bounds.Max.X, bounds.Max.Y, bounds.Max.Z), 5.0f, Color.White);
            LineBatch.Draw(new Vector3(bounds.Max.X, bounds.Min.Y, bounds.Min.Z), new Vector3(bounds.Max.X, bounds.Max.Y, bounds.Max.Z), 5.0f, Color.White);
            LineBatch.Draw(new Vector3(bounds.Min.X, bounds.Max.Y, bounds.Min.Z), new Vector3(bounds.Min.X, bounds.Min.Y, bounds.Max.Z), 5.0f, Color.White);

            LineBatch.End();
        }
Ejemplo n.º 8
0
        public void Draw()
        {
            GraphicsDevice device = _screenManager.GraphicsDevice;
            LineBatch      batch  = _screenManager.LineBatch;

            device.SamplerStates[0] = SamplerState.AnisotropicWrap;
            device.RasterizerState  = RasterizerState.CullNone;
            _basicEffect.Projection = _camera.Projection;
            _basicEffect.View       = _camera.View;
            _basicEffect.CurrentTechnique.Passes[0].Apply();

            device.DrawUserPrimitives(PrimitiveType.TriangleList, _borderVerts, 0, 8);

            batch.Begin(_camera.Projection, _camera.View);
            batch.DrawLineShape(_anchor.FixtureList[0].Shape);
            batch.End();
        }
Ejemplo n.º 9
0
        public override void Draw(Camera3D camera)
        {
            Matrix translation = Matrix.CreateTranslation(new Vector3(0.0f, 0.0f, -500.0f));

            LineBatch.Begin(translation, camera);
            PointBatch.Begin(translation, camera);

            foreach (Bullet b in Bullets)
            {
                b.Draw(LineBatch, PointBatch);
            }

            PointBatch.End();
            LineBatch.End();

            base.Draw(camera);
        }
Ejemplo n.º 10
0
        public override void Draw(GameTime gameTime)
        {
            LineBatch.Begin();
            //foreach (DebugGraph graph in graphs)
            for (int index = 0; index < graphs.Count; index++)
            {
                graphs[index].DrawLines(gameTime);
            }
            LineBatch.End();

            SpriteBatch.Begin();
            //foreach (DebugGraph graph in graphs)
            for (int index = 0; index < graphs.Count; index++)
            {
                graphs[index].DrawText(gameTime);
            }
            SpriteBatch.End();
        }
Ejemplo n.º 11
0
        public override void Draw(Camera3D camera)
        {
            if (Alive)
            {
                Matrix translationMatrix = Matrix.CreateTranslation(Position);

                LineBatch.Begin(translationMatrix, camera);

                for (int i = 0; i < vertices.Count; i++)
                {
                    LineBatch.Draw(vertices[i], vertices[(i + 1) % vertices.Count], 2.5f, lineColor);
                }

                LineBatch.End();

                PointBatch.Begin(translationMatrix, camera);
                PointBatch.Draw(lightPosition, 15.0f, lightColor);
                PointBatch.End();
            }
        }
Ejemplo n.º 12
0
        public void Draw(Matrix projection, Matrix view)
        {
            _graphics.SamplerStates[0] = SamplerState.AnisotropicWrap;
            _graphics.RasterizerState  = RasterizerState.CullNone;

            _basicEffect.Projection   = projection;
            _basicEffect.View         = view;
            _basicEffect.Texture      = ContentWrapper.GetTexture("Blank");
            _basicEffect.DiffuseColor = ContentWrapper.Black.ToVector3();
            _basicEffect.CurrentTechnique.Passes[0].Apply();
            _graphics.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, _borderVertices, 0, 8, _indexBuffer, 0, 8);

            _basicEffect.Texture      = ContentWrapper.GetTexture("Stripe");
            _basicEffect.DiffuseColor = ContentWrapper.Grey.ToVector3();
            _basicEffect.CurrentTechnique.Passes[0].Apply();
            _graphics.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, _borderVertices, 0, 8, _indexBuffer, 0, 8);

            _lines.Begin(projection, view);
            _lines.DrawLineShape(_anchor.FixtureList[0].Shape);
            _lines.End();
        }
Ejemplo n.º 13
0
        public override void Draw(Camera3D camera)
        {
            // draw ship
            if (Alive)
            {
                Matrix rotationMatrix    = Matrix.CreateRotationZ(Rotation);
                Matrix translationMatrix = Matrix.CreateTranslation(Position);

                LineBatch.Begin(rotationMatrix * translationMatrix, camera);

                for (int i = 0; i < vertices.Count; i++)
                {
                    LineBatch.Draw(vertices[i], vertices[(i + 1) % vertices.Count], lineWidth, lineColor);
                }

                LineBatch.End();

                PointBatch.Begin(translationMatrix, camera);
                PointBatch.Draw(lightPosition, lightRadius, lightColor);
                PointBatch.End();
            }
        }
Ejemplo n.º 14
0
        public override void Draw(GameTime gameTime)
        {
            BatchEffect.View       = Camera.View;
            BatchEffect.Projection = Camera.Projection;
            SpriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, BatchEffect);

            // draw car
            SpriteBatch.Draw(_wheel.Texture, _wheelBack.Position, null, Color.White, _wheelBack.Rotation, _wheel.Origin, new Vector2(0.5f) * _wheel.TexelSize, SpriteEffects.FlipVertically, 0f);
            SpriteBatch.Draw(_wheel.Texture, _wheelFront.Position, null, Color.White, _wheelFront.Rotation, _wheel.Origin, new Vector2(0.5f) * _wheel.TexelSize, SpriteEffects.FlipVertically, 0f);
            SpriteBatch.Draw(_carBody.Texture, _car.Position, null, Color.White, _car.Rotation, _carBody.Origin, new Vector2(5f, 1.27f) * _carBody.TexelSize, SpriteEffects.FlipVertically, 0f);

            // draw teeter
            SpriteBatch.Draw(_teeter.Texture, _board.Position, null, Color.White, _board.Rotation, _teeter.Origin, new Vector2(20f, 0.5f) * _teeter.TexelSize, SpriteEffects.FlipVertically, 0f);

            // draw bridge
            for (int i = 0; i < _bridgeSegments.Count; ++i)
            {
                SpriteBatch.Draw(_bridge.Texture, _bridgeSegments[i].Position, null, Color.White, _bridgeSegments[i].Rotation, _bridge.Origin, new Vector2(2.0f, 0.25f) * _bridge.TexelSize, SpriteEffects.FlipVertically, 0f);
            }

            // draw boxes
            for (int i = 0; i < _boxes.Count; ++i)
            {
                SpriteBatch.Draw(_box.Texture, _boxes[i].Position, null, Color.White, _boxes[i].Rotation, _box.Origin, new Vector2(1f, 1f) * _box.TexelSize, SpriteEffects.FlipVertically, 0f);
            }
            SpriteBatch.End();

            LineBatch.Begin(Camera.Projection, Camera.View);

            // draw ground
            for (int i = 0; i < _ground.FixtureList.Count; ++i)
            {
                LineBatch.DrawLineShape(_ground.FixtureList[i].Shape, Color.Black);
            }
            LineBatch.End();
            base.Draw(gameTime);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            lineBatch.Begin();

            // draw all actors
            foreach (Actor actor in world.Actors)
            {
                if (actor.Dead == false)
                {
                    actor.Draw(elapsedTime, lineBatch);
                }
            }

            // draw all particle systems
            foreach (ParticleSystem particleSystem in world.ParticleSystems)
            {
                if (particleSystem.IsActive)
                {
                    particleSystem.Draw(lineBatch);
                }
            }

            // draw the walls
            //world.DrawWalls(lineBatch);

            lineBatch.End();

            // draw the stars
            spriteBatch.Begin();
            if (Simulation.WorldRules.ScreenRes == ScreenRes.a1920x1200)
            {
                world.Atmosphere.Draw(spriteBatch, aatomTexture);
            }
            if (Simulation.WorldRules.ScreenRes == ScreenRes.b1680x1050)
            {
                world.Atmosphere.Draw(spriteBatch, batomTexture);
            }
            if (Simulation.WorldRules.ScreenRes == ScreenRes.c1440x900)
            {
                world.Atmosphere.Draw(spriteBatch, catomTexture);
            }
            if (Simulation.WorldRules.ScreenRes == ScreenRes.d1280x800)
            {
                world.Atmosphere.Draw(spriteBatch, datomTexture);
            }
            spriteBatch.End();

            if (WorldRules.NeonEffect)
            {
                bloomComponent.Draw(gameTime);
            }

            DrawHud(elapsedTime);
            DrawUVCLight(gameTime);

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0)
            {
                ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha);
            }
        }