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(); }
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); }
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(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); LineBatch.init(GraphicsDevice); levelManager = new RC_GameStateManager(); levelManager.AddLevel(0, new SplashScreen()); levelManager.getLevel(0).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(0).LoadContent(); levelManager.setLevel(0); levelManager.AddLevel(1, new GameLevel1()); levelManager.getLevel(1).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(1).LoadContent(); levelManager.AddLevel(2, new EndScreen()); levelManager.getLevel(2).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(2).LoadContent(); levelManager.AddLevel(3, new Pause()); levelManager.getLevel(3).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(3).LoadContent(); levelManager.AddLevel(4, new StartScreen()); levelManager.getLevel(4).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(4).LoadContent(); }
/// <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.DeepSkyBlue); // TODO: Add your drawing code here spriteBatch.Begin(); scrollBack.Draw(spriteBatch); scrollFore.Draw(spriteBatch); particleList.Draw(spriteBatch); spritePlayer.Draw(spriteBatch); enemyList.Draw(spriteBatch); playerBulletList.Draw(spriteBatch); textScore.Draw(spriteBatch); //enter to start text if (!startGame) { textStartGame.Draw(spriteBatch); } //display bounding boxes if (showbb) { spritePlayer.drawBB(spriteBatch, Color.Red); LineBatch.drawLineRectangle(spriteBatch, playArea, Color.Purple); enemyList.drawInfo(spriteBatch, Color.Red, Color.Blue); playerBulletList.drawInfo(spriteBatch, Color.Red, Color.Blue); } spriteBatch.End(); base.Draw(gameTime); }
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); }
public TheoJansenWalker(World world, ScreenManager screenManager, Camera2D camera, Vector2 position) { _position = position; _motorSpeed = 2.0f; _spriteBatch = screenManager.SpriteBatch; _lineBatch = screenManager.LineBatch; _camera = camera; _walkerJoints = new List <DistanceJoint>(); _leftShoulders = new Body[3]; _rightShoulders = new Body[3]; _leftLegs = new Body[3]; _rightLegs = new Body[3]; Vector2 pivot = new Vector2(0f, 0.8f); CreateChassis(world, pivot, screenManager.Assets); Vector2 wheelAnchor = pivot + new Vector2(0f, -0.8f); CreateLeg(world, -1f, wheelAnchor, out _leftShoulders[0], out _leftLegs[0]); CreateLeg(world, 1f, wheelAnchor, out _rightShoulders[0], out _rightLegs[0]); _wheel.SetTransform(_wheel.Position, 120f * MathHelper.Pi / 180f); CreateLeg(world, -1f, wheelAnchor, out _leftShoulders[1], out _leftLegs[1]); CreateLeg(world, 1f, wheelAnchor, out _rightShoulders[1], out _rightLegs[1]); _wheel.SetTransform(_wheel.Position, -120f * MathHelper.Pi / 180f); CreateLeg(world, -1f, wheelAnchor, out _leftShoulders[2], out _leftLegs[2]); CreateLeg(world, 1f, wheelAnchor, out _rightShoulders[2], out _rightLegs[2]); CreateLegTextures(screenManager.Assets); }
protected override void LoadContent() { base.LoadContent(); Managers.TextureManager = new TextureManager(Content, GraphicsDevice); Managers.FontManager = new FontManager(Content); Managers.SoundManager = new SoundManager(Content); _spriteBatch = new SpriteBatch(GraphicsDevice); _lineBatch = new LineBatch(GraphicsDevice); _quadRenderer = new QuadRenderer(GraphicsDevice); _input.LoadContent(GraphicsDevice.Viewport); _screenManager = new ScreenManager(this, _lineBatch, _quadRenderer, _spriteBatch, _input); #if WINDOWS _counter.LoadContent(); #endif _screenManager.LoadContent(); //TODO: Can't call this in MonoGame at the moment //ResetElapsedTime(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here LineBatch.Init(GraphicsDevice); base.Initialize(); }
/// <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); // TODO: Add your drawing code here spriteBatch.Begin(); back1.Draw(spriteBatch); //*** grass1.Draw(spriteBatch); paddle.Draw(spriteBatch); //*** enemyList.Draw(spriteBatch); ballList.Draw(spriteBatch); booms.Draw(spriteBatch); spriteBatch.DrawString(font, "Enemies Slain: " + score, new Vector2(rhs - 140, top + 10), Color.Black); if (showbb) { paddle.drawBB(spriteBatch, Color.Black); paddle.drawHS(spriteBatch, Color.Green); enemyList.drawInfo(spriteBatch, Color.Red, Color.Yellow); LineBatch.drawLineRectangle(spriteBatch, playArea, Color.Blue); ballList.drawInfo(spriteBatch, Color.Gray, Color.Green); } spriteBatch.End(); base.Draw(gameTime); }
public GameObject AddLineBatchToScene(LineBatch lines) { GameObject o = GameObjectFactory.CreateRenderableGameObjectFromShape(lines, lineEffect); SystemCore.GameObjectManager.AddAndInitialiseGameObject(o); return(o); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); LineBatch.init(GraphicsDevice); // TODO: use this.Content to load your game content here texBack = Util.texFromFile(GraphicsDevice, dir + "ricefield.png"); texpaddle = Util.texFromFile(GraphicsDevice, dir + "slime.png"); texBall = Util.texFromFile(GraphicsDevice, dir + "slime_slice.png"); //*** texEnemy = Util.texFromFile(GraphicsDevice, dir + "ghost.png"); texGrass1 = Util.texFromFile(GraphicsDevice, dir + "grass1.png"); texBoom = Util.texFromFile(GraphicsDevice, dir + "Boom3.png"); font = Content.Load <SpriteFont>("incoming"); paddle = new Sprite3(true, texpaddle, lhs, yy); paddle.setBBToTexture(); enemyList = new SpriteList(); ballList = new SpriteList(); booms = new SpriteList(); back1 = new ScrollBackGround(texBack, texBack.Bounds, new Rectangle(0, 0, rhs, 380), -1, 2); grass1 = new ScrollBackGround(texGrass1, texGrass1.Bounds, new Rectangle(0, bot - (texGrass1.Height + 30), rhs, bot / 2), -1, 2); playArea = new Rectangle(lhs, top, rhs, bot - 10); enemyYY = new Random(); enemySpeed = new Random(); }
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(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); LineBatch.init(GraphicsDevice); texBack = Util.texFromFile(GraphicsDevice, dir + "back3.png"); //*** texpaddle = Util.texFromFile(GraphicsDevice, dir + "red64x32.png"); //*** texBall = Util.texFromFile(GraphicsDevice, dir + "ball2.png"); //*** texBlock1 = Util.texFromFile(GraphicsDevice, dir + "white64x32.png"); paddle = new Sprite3(true, texpaddle, xx, yy); paddle.setBBToTexture(); ball = new Sprite3(true, texBall, xx, yy); ball.setBBandHSFractionOfTexCentered(0.7f); sl = new SpriteList(); back1 = new ImageBackground(texBack, Color.White, GraphicsDevice); playArea = new Rectangle(lhs, top, rhs - lhs, bot - top); // width and height for (int y = 0; y < 5; y++) { for (int x = 0; x < 4; x++) { Sprite3 s = new Sprite3(true, texBlock1, x * 68 + playArea.X + blocksOffsetX, y * 36 + playArea.Y + blocksOffsetY); s.hitPoints = 1; if (y == 0) { s.hitPoints = 2; s.setColor(Color.LightBlue); } sl.addSpriteReuse(s); } } // TODO: use this.Content to load your game content here }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here screenHeight = graphics.PreferredBackBufferHeight; screenWidth = graphics.PreferredBackBufferWidth; LineBatch.init(GraphicsDevice); base.Initialize(); }
public virtual void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(this.texture, this.pos, Color.White); if (Game1.debugMode) { LineBatch.drawBoundingBox(this.boundingBox, spriteBatch); } }
public ScreenManager(Game1 game, LineBatch lineBatch, QuadRenderer quadRenderer, SpriteBatch spriteBatch, InputHelper input) { _graphics = game.GraphicsDevice; _game = game; _lineBatch = lineBatch; _quadRenderer = quadRenderer; _spriteBatch = spriteBatch; _input = input; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); LineBatch.init(GraphicsDevice); UtilTexSI.initTextures(GraphicsDevice); UtilTexSI.init8Bit(GraphicsDevice); Texture2D texQ = UtilTexSI.eightBit32[2]; string[] str13 = { " 7 ", " 777 ", "77777777", "77777777" }; RC_Surface surBase = new RC_Surface(str13, UtilTexSI.Pallete11, UtilTexSI.Pal11); RC_Surface sur = new RC_Surface(surBase, 4, 4, 0, 0, Color.TransparentBlack, 0, 0); Texture2D shooterTexQ = sur.createTex(GraphicsDevice); fonty = Content.Load <SpriteFont>("Fonty"); micro0 = new MicroGame1(new Rectangle(100, 100, 300, 450), 30, Color.Green, fonty); micro0.setShooter(shooterTexQ, new Vector2(30, 15), 5); micro0.setTarget(texQ, new Vector2(20, 20), 20); micro0.setExplode(UtilTexSI.texRainbow, new Vector2(25, 25)); //micro0.setBackground(aa); micro0.playStyle = 1; micro0.mouseFocus = true; micro0.reset(); micro1 = new MicroGame1(new Rectangle(450, 110, 200, 400), 35, Color.Purple, fonty); micro1.setShooter(shooterTexQ, new Vector2(30, 15), 2); micro1.setTarget(texQ, new Vector2(40, 40), 20); micro1.setExplode(UtilTexSI.texRainbow, new Vector2(25, 25)); BlinkingBoxes aa = new BlinkingBoxes(new Rectangle(0, 0, 0, 0), new Vector2(38, 29), new Vector2(2, 5), 5, 9, 6, 101); micro1.setBackground(aa); micro1.playStyle = 1; micro1.mouseFocus = true; micro1.reset(); micro2 = new MicroGame1(new Rectangle(660, 100, 300, 200), 40, Color.DarkCyan, fonty); micro2.setShooter(shooterTexQ, new Vector2(30, 15), 5); micro2.setTarget(texQ, new Vector2(20, 20), 20); micro2.setExplode(UtilTexSI.texRainbow, new Vector2(25, 25)); //micro0.setBackground(aa); micro2.playStyle = 1; micro2.mouseFocus = true; micro2.reset(); }
public override void Draw(GameTime gameTime) { graphicsDevice.Clear(Color.DeepSkyBlue); // TODO: Add your drawing code here spriteBatch.Begin(); scrollBack.colour = Color.Aqua; scrollBack.Draw(spriteBatch); scrollFore.Draw(spriteBatch); particleList.Draw(spriteBatch); player.Draw(spriteBatch); enemyList.Draw(spriteBatch); playerBulletList.Draw(spriteBatch); textScore.Draw(spriteBatch); //display bounding boxes if (Game1.showbb) { player.drawBB(spriteBatch, Color.Red); LineBatch.drawLineRectangle(spriteBatch, player.playArea, Color.Purple); enemyList.drawInfo(spriteBatch, Color.Red, Color.Blue); playerBulletList.drawInfo(spriteBatch, Color.Red, Color.Blue); } switch (levelState) { case LEVELSTATE.LEVELSTART: textVarious = new TextRenderable("LEVEL: " + level.ToString(), new Vector2(Game1.SCREEN_WIDTH / 2, Game1.SCREEN_HEIGHT / 2), spriteFont, Color.Red); textVarious.Draw(spriteBatch); textVarious = new TextRenderable("Enemies: " + enemyToSpawn.ToString(), new Vector2(Game1.SCREEN_WIDTH / 2, Game1.SCREEN_HEIGHT / 2 + 30), spriteFont, Color.Red); textVarious.Draw(spriteBatch); break; case LEVELSTATE.LEVELGAMEOVER: textVarious = new TextRenderable("GAME OVER", new Vector2(Game1.SCREEN_WIDTH / 2, Game1.SCREEN_HEIGHT / 2), spriteFont, Color.Red); textVarious.Draw(spriteBatch); textVarious = new TextRenderable("Press Q to go to menu.", new Vector2(Game1.SCREEN_WIDTH / 2, (Game1.SCREEN_HEIGHT / 2) + 30), spriteFont, Color.Red); textVarious.Draw(spriteBatch); break; case LEVELSTATE.LEVELFINISH: textVarious = new TextRenderable("LEVEL FINISHED", new Vector2(Game1.SCREEN_WIDTH / 2, Game1.SCREEN_HEIGHT / 2), spriteFont, Color.Red); textVarious.Draw(spriteBatch); textVarious = new TextRenderable("Press Enter to go to Next Level.", new Vector2(Game1.SCREEN_WIDTH / 2, Game1.SCREEN_HEIGHT / 2 + 30), spriteFont, Color.Red); textVarious.Draw(spriteBatch); break; } textLevel.Draw(spriteBatch); spriteBatch.End(); }
/// <summary> /// Render the actor. /// </summary> /// <param name="elapsedTime">The amount of elapsed time, in seconds.</param> /// <param name="lineBatch">The LineBatch to render to.</param> public override void Draw(float elapsedTime, LineBatch lineBatch) { if (lineBatch == null) { throw new ArgumentNullException("lineBatch"); } // draw a simple line lineBatch.DrawLine(position, position - velocity * lineLengthVelocityPercent, Color.Yellow); }
public void LoadContent() { LineBatch = new LineBatch(graphicsDevice); PointBatch = new PointBatch(graphicsDevice); SpriteBatch = new SpriteBatch(graphicsDevice); bloom = new Bloom(graphicsDevice, SpriteBatch); foreach (GameObject gameObject in gameObjects) gameObject.LoadContent(); }
//Draws the pendulum bobs. public override void Draw(State state) { //Sets width and height to canvas height and width propeties depending on //if the canvas is initialised. var width = Canvas.ActualWidth > 0 ? Canvas.ActualWidth : Canvas.Width; var height = Canvas.ActualHeight > 0 ? Canvas.ActualHeight : Canvas.Height; //Calaculate bob position. BobPosition.X = Length * Math.Sin(state.Displacement); BobPosition.Y = Length * Math.Cos(state.Displacement); PivotPosition = new Vec2 { X = width / 2, Y = height / 2 }; Batches.Add(DrawingMethods.FilledCircle(PivotPosition, 4, Brushes.Black)); //Calculate bob position relative to the canvas coordinates. BobPosCanvas.X = PivotPosition.X + BobPosition.X * PixelsPerMeter; BobPosCanvas.Y = PivotPosition.Y + BobPosition.Y * PixelsPerMeter; //Create line objects for pendulum arm. var arm = new LightLine { X1 = PivotPosition.X, Y1 = PivotPosition.Y, X2 = BobPosCanvas.X - BobRadius * Math.Sin(state.Displacement), Y2 = BobPosCanvas.Y - BobRadius * Math.Cos(state.Displacement) }; var armLineBatch = new LineBatch { LineThickness = 2 }; armLineBatch.Add(arm); Batches.Add(armLineBatch); //Draw origin circles depending on whether interaction is taking place. Batches.Add(IsInteracting ? DrawingMethods.FilledCircle(BobPosCanvas, (int)BobRadius, Brushes.Red) : DrawingMethods.FilledCircle(BobPosCanvas, (int)BobRadius, Brushes.Blue)); //Render the batches. foreach (var batch in Batches) { batch.Render(Canvas); batch.Clear(); } Batches.Clear(); }
private static void AddLineBatch(ProceduralPlane proceduralPlane) { LineBatch l = new LineBatch(proceduralPlane.GetLineBatchVerts().ToArray()); for (int i = 0; i < l.Vertices.Count(); i++) { l.Vertices[i].Position = l.Vertices[i].Position.ReplaceYComponent(-1.9f); } GameObject lineObject = SystemCore.GameObjectManager.AddLineBatchToScene(l); }
public virtual void Draw(SpriteBatch spriteBatch) { if (visible) { spriteBatch.Draw(texture, position, sourceRectangle, Color.Multiply(color, alpha), _rotation, origin, _scale, effect, depth); if (showCollisionBounds) { CalcularRetangulo(); #region Draw Collision Lines //Linha cima LineBatch.DrawLine(spriteBatch, Color.Red, new Vector2(collisionBounds.X, collisionBounds.Y), new Vector2(collisionBounds.X + collisionBounds.Width, collisionBounds.Y)); //Linha Direita LineBatch.DrawLine(spriteBatch, Color.Red, new Vector2(collisionBounds.X + collisionBounds.Width, collisionBounds.Y), new Vector2(collisionBounds.X + collisionBounds.Width, collisionBounds.Y + collisionBounds.Height)); //Linha Baixo LineBatch.DrawLine(spriteBatch, Color.Red, new Vector2(collisionBounds.X + collisionBounds.Width, collisionBounds.Y + collisionBounds.Height), new Vector2(collisionBounds.X, collisionBounds.Y + collisionBounds.Height)); //Linha Esquerda LineBatch.DrawLine(spriteBatch, Color.Red, new Vector2(collisionBounds.X, collisionBounds.Y + collisionBounds.Height), new Vector2(collisionBounds.X, collisionBounds.Y)); #endregion #region Draw Pivot Piont LineBatch.DrawLine(spriteBatch, Color.Red, new Vector2(position.X - 1, position.Y - 1), new Vector2(position.X + 1, position.Y + 1)); LineBatch.DrawLine(spriteBatch, Color.Red, new Vector2(position.X + 1, position.Y - 1), new Vector2(position.X - 1, position.Y + 1)); #endregion } } }
public void Draw(LineBatch lineBatch) { //this is straigth from Farseer 3.3.1 game samples //just to indicate where the path lies, and actually it draws it too low //lineBatch.Begin(); //// draw ground //for (int i = 0; i < body.FixtureList.Count; ++i) //{ // lineBatch.DrawLineShape(body.FixtureList[i].Shape, Color.Black); //} //lineBatch.End(); }
/// <summary> /// Render the actor. /// </summary> /// <param name="elapsedTime">The amount of elapsed time, in seconds.</param> /// <param name="lineBatch">The LineBatch to render to.</param> public override void Draw(float elapsedTime, LineBatch lineBatch) { if (lineBatch == null) { throw new ArgumentNullException("lineBatch"); } //// Vector Polygon //VectorPolygon circle = VectorPolygon.CreateCircle(Vector2.Zero, 4f, 100); //lineBatch.DrawPolygon(circle, Color.Yellow); // draw a simple line lineBatch.DrawLine(position, position - velocity * lineLengthVelocityPercent, Color.Yellow); }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); _lineBatch = new LineBatch(GraphicsDevice); _assetCreator = new AssetCreator(GraphicsDevice); _assetCreator.LoadContent(_contentManager); _input.LoadContent(); // Tell each of the screens to load their content. foreach (GameScreen screen in _screens) { screen.LoadContent(); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); LineBatch.init(GraphicsDevice); // TODO: use this.Content to load your game content here levelManager = new RC_GameStateManager(); levelManager.AddLevel(0, new TutorialLevel()); levelManager.getLevel(0).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(0).LoadContent(); levelManager.AddLevel(1, new Level1()); levelManager.getLevel(1).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(1).LoadContent(); levelManager.AddLevel(2, new Level2()); levelManager.getLevel(2).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(2).LoadContent(); levelManager.AddLevel(3, new Level3()); levelManager.getLevel(3).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(3).LoadContent(); levelManager.AddLevel(4, new Level4()); levelManager.getLevel(4).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(4).LoadContent(); levelManager.AddLevel(5, new Level5()); levelManager.getLevel(5).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(5).LoadContent(); levelManager.AddLevel(6, new MenuScreen()); levelManager.getLevel(6).InitializeLevel(GraphicsDevice, spriteBatch, Content, levelManager); levelManager.getLevel(6).LoadContent(); levelManager.setLevel(6); Player.soundDash = Content.Load <SoundEffect>("sounds/Dash"); Player.soundJump = Content.Load <SoundEffect>("sounds/Jump"); Player.soundDoubleJump = Content.Load <SoundEffect>("sounds/DoubleJump"); BaseLevel.soundDeath = Content.Load <SoundEffect>("sounds/Death"); BaseLevel.soundSlice = Content.Load <SoundEffect>("sounds/Slice"); BaseLevel.soundRespawn = Content.Load <SoundEffect>("sounds/Respawn"); BaseLevel.soundSliceHit = Content.Load <SoundEffect>("sounds/SliceHit"); Player.soundGroundHit = Content.Load <SoundEffect>("sounds/GroundHit"); }
/// <summary> /// Unload graphics content used by the game. /// </summary> public override void UnloadContent() { if (spriteBatch != null) { spriteBatch.Dispose(); spriteBatch = null; } if (lineBatch != null) { lineBatch.Dispose(); lineBatch = null; } content.Unload(); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) { content = new ContentManager(ScreenManager.Game.Services, "Content"); } spriteBatch = new SpriteBatch(ScreenManager.GraphicsDevice); lineBatch = new LineBatch(ScreenManager.GraphicsDevice); spriteFont = content.Load <SpriteFont>("Fonts/Arial"); titleTexture = content.Load <Texture2D>("Textures/title"); refractionEffect = content.Load <Effect>("Effects/refraction"); waterfallTexture = content.Load <Texture2D>("Textures/waterfall"); // When Resolution is 1920 x 1200 aatomTexture = content.Load <Texture2D>("Textures/ablank"); auvc1LightTexture = content.Load <Texture2D>("Textures/aUVC1"); auvc2LightTexture = content.Load <Texture2D>("Textures/aUVC2"); auvc3LightTexture = content.Load <Texture2D>("Textures/aUVC3"); auvc4LightTexture = content.Load <Texture2D>("Textures/aUVC4"); auvc5LightTexture = content.Load <Texture2D>("Textures/aUVC5"); // When Resolution is 1680 x 1050 batomTexture = content.Load <Texture2D>("Textures/bblank"); buvc1LightTexture = content.Load <Texture2D>("Textures/bUVC1"); buvc2LightTexture = content.Load <Texture2D>("Textures/bUVC2"); buvc3LightTexture = content.Load <Texture2D>("Textures/bUVC3"); buvc4LightTexture = content.Load <Texture2D>("Textures/bUVC4"); buvc5LightTexture = content.Load <Texture2D>("Textures/bUVC5"); // When Resolution is 1440 x 900 catomTexture = content.Load <Texture2D>("Textures/cblank"); cuvc1LightTexture = content.Load <Texture2D>("Textures/cUVC1"); cuvc2LightTexture = content.Load <Texture2D>("Textures/cUVC2"); cuvc3LightTexture = content.Load <Texture2D>("Textures/cUVC3"); cuvc4LightTexture = content.Load <Texture2D>("Textures/cUVC4"); cuvc5LightTexture = content.Load <Texture2D>("Textures/cUVC5"); // When Resolution is 1280 x 800 datomTexture = content.Load <Texture2D>("Textures/dblank"); duvc1LightTexture = content.Load <Texture2D>("Textures/dUVC1"); duvc2LightTexture = content.Load <Texture2D>("Textures/dUVC2"); duvc3LightTexture = content.Load <Texture2D>("Textures/dUVC3"); duvc4LightTexture = content.Load <Texture2D>("Textures/dUVC4"); duvc5LightTexture = content.Load <Texture2D>("Textures/dUVC5"); // update the projection in the line-batch lineBatch.SetProjection(Matrix.CreateOrthographicOffCenter(0.0f, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height, 0.0f, 0.0f, 1.0f)); }
public override void Draw(SpriteBatch spriteBatch) { wings.ForEach(wing => wing.Draw(spriteBatch)); // Draw bounding boxes in debug mode if (Game1.debugMode) { this.boundingBoxes.ForEach(boundingBox => { LineBatch.drawBoundingBox(boundingBox, spriteBatch); }); } base.Draw(spriteBatch); }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { SpriteBatch = new SpriteBatch(GraphicsDevice); LineBatch = new LineBatch(GraphicsDevice); Assets = new AssetCreator(GraphicsDevice); Assets.LoadContent(Content); input.LoadContent(); // Tell each of the screens to load their content. foreach (GameScreen screen in screens) { screen.LoadContent(); } }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch, LineBatch lineBatch) { paralaxBG.Draw(spriteBatch); foreach (SpriteClasses.MovingSprite ms in cells) { ms.aniM.FramesPerSecond = 5; ms.DrawAnim(spriteBatch); } foreach (SpriteClasses.MovingSprite ms2 in cells2) { ms2.aniM.FramesPerSecond = 5; ms2.DrawAnim(spriteBatch); } foreach (Tile temp in tiles) { temp.Draw(spriteBatch, tex); } player.attackSprite.DrawAnim(spriteBatch); player.DrawAnim(spriteBatch); foreach (MyTexture t in textures) { t.Draw(spriteBatch); } blood.DrawAnim(spriteBatch); plasma.DrawAnim(spriteBatch); monozyt.DrawAnim(spriteBatch); helper.DrawAnim(spriteBatch); nerve1.DrawAnim(spriteBatch); nerve2.DrawAnim(spriteBatch); for (int i = 0; i < collectibles.Count; i++) if (!collectibles[i].isCollected) collectibles[i].DrawAnim(spriteBatch); }