monotonicity

A city-building and transport simulation game written in Lean

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67
  68. 68
  69. 69
diff --git a/c/raylib_bindings.c b/c/raylib_bindings.c
index 902a945..17da156 100644
--- a/c/raylib_bindings.c
+++ b/c/raylib_bindings.c
@@ -314,11 +314,11 @@ static inline Camera2D camera2D_of_arg(lean_obj_arg camera) {
   return (Camera2D){offset, target, rotation, zoom};
 }
 
-lean_obj_res getRandomValue(uint32_t min, uint32_t max)
-    __attribute__((optnone)) {
-  // BUG: This always seems to return `min`
-  return lean_io_result_mk_ok(lean_box_uint32(GetRandomValue(min, max)));
-}
+// lean_obj_res getRandomValue(uint32_t min, uint32_t max)
+//     __attribute__((optnone)) {
+//   // BUG: This always seems to return `min`
+//   return lean_io_result_mk_ok(lean_box_uint32(GetRandomValue(min, max)));
+// }
 
 lean_obj_res initWindow(lean_obj_arg width, lean_obj_arg height,
                         b_lean_obj_arg title) {
@@ -402,6 +402,20 @@ lean_obj_res beginMode3D(lean_obj_arg camera) {
   return IO_UNIT;
 }
 
+lean_obj_res getWorldToScreen (lean_obj_arg position, lean_obj_arg camera) {
+  return lean_io_result_mk_ok(vector2_obj_mk(GetWorldToScreen(vector3_of_arg(position), camera3D_of_arg(camera))));
+}
+
+lean_obj_res drawLine3D(lean_obj_arg startPos, lean_obj_arg endPos, lean_obj_arg color) {
+  DrawLine3D(vector3_of_arg(startPos), vector3_of_arg(endPos), color_of_arg(color));
+  return IO_UNIT;
+}
+
+lean_obj_res drawPoint3D(lean_obj_arg position, lean_obj_arg color) {
+  DrawPoint3D(vector3_of_arg(position), color_of_arg(color));
+  return IO_UNIT;
+}
+
 lean_obj_res drawCube(lean_obj_arg position, double width, double height,
                       double length, lean_obj_arg color) {
   DrawCube(vector3_of_arg(position), width, height, length,
diff --git a/lean/Raylean/Core.lean b/lean/Raylean/Core.lean
index e0818b6..908f271 100644
--- a/lean/Raylean/Core.lean
+++ b/lean/Raylean/Core.lean
@@ -43,6 +43,9 @@ opaque beginMode3D : (camera : @& Camera3D) → IO Unit
 @[extern "endMode3D"]
 opaque endMode3D : IO Unit
 
+@[extern "getWorldToScreen"]
+opaque getWorldToScreen : (position : @& Vector3) → (camera : @& Camera3D) → IO Vector2
+
 /- Timing-related functions -/
 
 @[extern "setTargetFPS"]
@@ -112,6 +115,12 @@ opaque drawText : (text : @& String) → (posX : Nat) → (posY : Nat) → (font
 
 /- Basic geometric 3D shapes drawing functions -/
 
+@[extern "drawLine3D"]
+opaque drawLine3D : (startPos : @& Vector3) → (endPos : @& Vector3) → (color : @& Color) → IO Unit
+
+@[extern "drawPoint3D"]
+opaque drawPoint3D : (position : @& Vector3) → (color : @& Color) → IO Unit
+
 @[extern "drawCube"]
 opaque drawCube : (position : @& Vector3) → (width : Float) → (height : Float) → (length : Float) → (color : @& Color) -> IO Unit