-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
diff --git a/c/raylib_bindings.c b/c/raylib_bindings.c
index 902a945..37e2a51 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) {
@@ -336,6 +336,24 @@ lean_obj_res closeWindow(void) {
return IO_UNIT;
}
+lean_obj_res maximizeWindow(void) {
+ MaximizeWindow();
+ return IO_UNIT;
+}
+
+
+lean_obj_res getScreenWidth(void) {
+ return lean_io_result_mk_ok(lean_uint32_to_nat(GetScreenWidth()));
+}
+
+lean_obj_res getScreenHeight(void) {
+ return lean_io_result_mk_ok(lean_uint32_to_nat(GetScreenHeight()));
+}
+
+lean_obj_res getWindowScaleDPI(void) {
+ return lean_io_result_mk_ok(vector2_obj_mk(GetWindowScaleDPI()));
+}
+
lean_obj_res beginDrawing(void) {
BeginDrawing();
return IO_UNIT;
@@ -402,6 +420,15 @@ 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 drawCube(lean_obj_arg position, double width, double height,
double length, lean_obj_arg color) {
DrawCube(vector3_of_arg(position), width, height, length,
@@ -416,6 +443,13 @@ lean_obj_res drawCubeWires(lean_obj_arg position, double width, double height,
return IO_UNIT;
}
+lean_obj_res drawCylinderEx(lean_obj_arg startPos, lean_obj_arg endPos, double startRadius, double endRadius,
+ lean_obj_arg sides, lean_obj_arg color) {
+ DrawCylinderEx(vector3_of_arg(startPos), vector3_of_arg(endPos), startRadius, endRadius,
+ lean_uint32_of_nat_mk(sides), color_of_arg(color));
+ return IO_UNIT;
+}
+
lean_obj_res drawGrid(lean_obj_arg slices, double spacing) {
DrawGrid(lean_uint32_of_nat_mk(slices), spacing);
return IO_UNIT;
diff --git a/lean/Raylean/Core.lean b/lean/Raylean/Core.lean
index e0818b6..ef40dfb 100644
--- a/lean/Raylean/Core.lean
+++ b/lean/Raylean/Core.lean
@@ -15,6 +15,18 @@ opaque closeWindow : IO Unit
@[extern "windowShouldClose"]
opaque windowShouldClose : IO Bool
+@[extern "maximizeWindow"]
+opaque maximizeWindow : IO Unit
+
+@[extern "getScreenWidth"]
+opaque getScreenWidth : IO Nat
+
+@[extern "getScreenHeight"]
+opaque getScreenHeight : IO Nat
+
+@[extern "getWindowScaleDPI"]
+opaque getWindowScaleDPI : IO Vector2
+
/- Cursor-related functions -/
@[extern "disableCursor"]
@@ -43,6 +55,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,12 +127,18 @@ 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 "drawCube"]
opaque drawCube : (position : @& Vector3) → (width : Float) → (height : Float) → (length : Float) → (color : @& Color) -> IO Unit
@[extern "drawCubeWires"]
opaque drawCubeWires : (position : @& Vector3) → (width : Float) → (height : Float) → (length : Float) → (color : @& Color) -> IO Unit
+@[extern "drawCylinderEx"]
+opaque drawCylinderEx : (startPos : @& Vector3) → (endPos : @& Vector3) → (startRadius : Float) → (endRadius : Float) → (sides : Nat) → (color : @& Color) -> IO Unit
+
@[extern "drawGrid"]
opaque drawGrid : (slices : Nat) → (spacing : Float) → IO Unit