protected override void DrawFrame(GameTime gameTime, XnaRenderer renderer) { Vector2 mp = base.GetMousePosition(); mp = _camera.ViewToWorld(mp); renderer.BeginDraw(_camera); foreach (Polygon p in _polygons) { p.Draw(renderer); } renderer.DrawPoint(mp, _cursorSize, Color.Lerp(Color.Green, Color.Cyan, (_cursorSize - 2) / 2), 1f); if (_stage == 0) { renderer.DrawArrow(_forceStart, _forceEnd, 0.2f, Color.Green); } foreach (Arrow arrow in ArrowCollection.Arrows.Values) { renderer.DrawArrow(arrow.Start, arrow.End, 0.1f, arrow.Color); } renderer.DrawPoint(Vector2.Zero, 0.2f, Color.Red, 0.5f); renderer.EndDraw(); }
internal void Draw(XnaRenderer renderer) { renderer.DrawPoint(_position, 10f, _color * 0.1f, 0f); renderer.DrawPoint(_position, 4f, _color * 0.2f, 0f); renderer.DrawPoint(_position, 2f, _color * 0.5f, 0f); renderer.DrawPoint(_position, 1f, Color.White, 1); }
protected override void DrawFrame(GameTime gameTime, XnaRenderer renderer) { renderer.Clear(Color.White); Vector2 start = new Vector2(0, 0); Vector2 end = start + Util.AngleToVector(_angle) * _lineLength; renderer.BeginDraw(_camera); renderer.DrawPoint(start, 3f, Color.Green, 1f); renderer.DrawPoint(end, 3f, Color.Red, 1f); renderer.DrawArrow(start, end, 0.5f, Color.Black, 1f); renderer.EndDraw(); }
public void Draw(XnaRenderer renderer) { renderer.DrawDepth = 1f; Color tileColor = Color.White; if (IsWall) { tileColor = Color.SlateGray; if (_strength == 1) { tileColor = Color.LightBlue; } if (_strength == 2) { tileColor = Color.DarkBlue; } } renderer.DrawFilledRectangle(new RectangleF(-0.45f, -0.45f, 0.9f, 0.9f), tileColor); renderer.DrawDepth = 0.8f; if (ContainsFood) { renderer.DrawPoint(new Vector2(0, 0), 1f, Color.Green, 1f); } if (IsEmpty && Anim > 0) { float width = (float)Anim / 50 * 0.45f; renderer.DrawFilledRectangle(new RectangleF(-width, -width, width * 2, width * 2), Color.Gray); Anim--; } }
protected override void DrawFrame(GameTime gameTime, XnaRenderer renderer) { renderer.BeginDraw(_camera); renderer.DrawPoint(new Vector2(100, 100) + Util.AngleToVector(_angle) * 20f, 5f, Color.Green, 1f); //_camera.Zoom = 0.5f; //renderer.DrawString("This is some text", new Vector2(0, 0), Color.Red); renderer.EndDraw(); }
public void Draw(XnaRenderer renderer) { //renderer.DrawPoint(ToWorld(_centerOfMass), 1f, Color.Red, 1f); renderer.Transformation = Matrix.CreateTranslation(-_centerOfMass.X, -_centerOfMass.Y, 0) * Matrix.CreateRotationZ(Angle) * Matrix.CreateTranslation(_centerOfMass.X, _centerOfMass.Y, 0) * Matrix.CreateTranslation(Position.X, Position.Y, 0); renderer.DrawPoint(_centerOfMass, 1f, Color.Red, 1f); for (int i = 0; i < _points.Length; i++) { renderer.DrawPoint(_points[i], 1f, Color.White, 1f); //draw edge Vector2 start = _points[i]; Vector2 end = _points[(i + 1) % _points.Length]; renderer.DrawLine(start, end, 0.1f, Color.White, 1f); //renderer.DrawArrow((start + end) * 0.5f, (start + end) * 0.5f + _normals[i] * 1f, 0.1f, Color.DarkGray, 0.6f); } renderer.Transformation = Matrix.Identity; renderer.DrawArrow(CenterOfMass, CenterOfMass + Velocity * 50f, 0.2f, Color.Blue); }
protected override void DrawFrame(GameTime gameTime, XnaRenderer renderer) { //Texture2D texture = renderer.ContentManager.Load<Texture2D>("solid"); //Effect effect = renderer.ContentManager.Load<Effect>("basicshader.mgfxo"); //effect.Parameters["xWorld"].SetValue(_camera.World); //effect.Parameters["xProjection"].SetValue(_camera.Projection); //effect.Parameters["xView"].SetValue(_camera.View); //effect.Parameters["TextureSampler"].SetValue(texture); //effect.Techniques["Basic"].Passes[0].Apply(); //renderer.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, _vertexData, 0, 4, _indexData, 0, 2, VertexPositionColorTexture.VertexDeclaration); renderer.BeginDraw(_camera); LiteEngine.Textures.Texture solidTexture = new LiteEngine.Textures.Texture("solid"); renderer.DrawDepth = 0.9f; DrawTiles(renderer); renderer.DrawDepth = 0.7f; //this sprite will rotate around it's top corner (20,20) renderer.DrawSprite(solidTexture, new RectangleF(20, 20, 20, 2f), Color.Red, _angle); //this sprite will rotate around it's center placed at (30,30) renderer.DrawSprite(solidTexture, new Vector2(30, 30), new Vector2(20, 2), _angle); //this sprite will rotate around it's center placed at (70,20) renderer.DrawSprite(solidTexture, new RectangleF(70, 20, 20, 2f), renderer.DrawDepth, _angle, new Vector2(0.5f, 0.5f), Color.Red); renderer.DrawPoint(new Vector2(0, 0), 1f, Color.White, 1f); renderer.DrawSprite(_stickmanAnimation.CurrentTexture, new RectangleF(10, 60, 30, 30)); _stickmanAnimation.Advance(gameTime.ElapsedGameTime.Milliseconds); //renderer.DrawSprite(new LiteEngine.Textures.Texture("point"), new RectangleF(2, 0, 1, 1), 0.5f, _angle, new Vector2(0.5f,0.5f), Color.Blue); //renderer.DrawSprite(new LiteEngine.Textures.Texture("point", new RectangleI(0, 0, 32, 32)), new RectangleF(2, 0, 1, 1), 0.5f, _angle, new Vector2(0.5f, 0.5f), Color.Blue); //draw non-rectangular sprite centered and rotating around (50,50) DrawNonRectangular(renderer, new Vector2(50, 50), new Vector2(0.5f, 0.5f)); //draw non-rectangular sprite rotating around its bottom right corner at (70,70) DrawNonRectangular(renderer, new Vector2(70, 70), new Vector2(1f, 1f)); //draw a non rectangular texture _angle += 0.01f; renderer.EndDraw(); }