Point.cs 1013 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using OpenTK.Graphics.OpenGL;
  8. namespace bbiwarg.Graphics
  9. {
  10. class Point : IGraphicElement
  11. {
  12. public Vertex position;
  13. public Color color;
  14. public float size;
  15. public Point(Vertex position, Color color, float size) {
  16. this.position = position;
  17. this.color = color;
  18. this.size = size;
  19. }
  20. public void draw(int width, int height) {
  21. GL.Color4(color);
  22. float relX = position.x - width/2;
  23. float relY = height/2-position.y;
  24. GL.Begin(BeginMode.Polygon);
  25. GL.Vertex3(relX - size, relY + size, -position.z);
  26. GL.Vertex3(relX + size, relY + size, -position.z);
  27. GL.Vertex3(relX + size, relY - size, -position.z);
  28. GL.Vertex3(relX - size, relY - size, -position.z);
  29. GL.End();
  30. }
  31. }
  32. }