/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { base.Initialize(); // TODO: Add your initialization code here batch = new PrimitiveBatch(GraphicsDevice); textBatch = new SpriteBatch(GraphicsDevice); font = Game.Content.Load <SpriteFont>("DebugFont"); }
protected override void LoadContent() { vertexBatch = new PrimitiveBatch(Game.GraphicsDevice); edgeBatch = new PrimitiveBatch(Game.GraphicsDevice); finishText = new SpriteBatch(Game.GraphicsDevice); finishFont = Game.Content.Load <SpriteFont>("DebugFont"); base.LoadContent(); }
public void Draw(PrimitiveBatch batch) { batch.Begin(PrimitiveType.LineList); for (int i = 0; i < transformedVertices.Length; i++) { batch.AddVertex(transformedVertices[i], ShapeColor); batch.AddVertex(transformedVertices[ (i + 1) % transformedVertices.Length], ShapeColor); } batch.End(); }
/// <summary> /// Inititalises the static body /// </summary> protected void Init() { effect = new BasicEffect(graphics, null); // projection uses CreateOrthographicOffCenter to create 2d projection // matrix with 0,0 in the upper left. effect.Projection = Matrix.CreateOrthographicOffCenter (0, graphics.Viewport.Width, graphics.Viewport.Height, 0, 0, 1); effect.VertexColorEnabled = true; batch = new PrimitiveBatch(graphics); }