powerful-morning-89
12/10/2021, 3:22 PMbright-gpu-74537
12/10/2021, 8:11 PMpowerful-morning-89
12/10/2021, 8:11 PMbright-gpu-74537
12/10/2021, 8:11 PMbright-gpu-74537
12/10/2021, 8:12 PMbright-gpu-74537
12/10/2021, 8:13 PMbright-gpu-74537
12/10/2021, 8:20 PMpowerful-morning-89
12/10/2021, 8:24 PMColor I'd do @:struct @:structInit class which let you do c
HL_PRIM void HL_NAME(hl_raylib_clear_background)(Color* color) {
ClearBackground(*c);
}bright-gpu-74537
12/10/2021, 8:24 PMpowerful-morning-89
12/10/2021, 8:25 PM@:struct gets rid of the extra hl_type* field on hashlink classes.
Now, one thing I just remembered: I think @:struct will only work on latest hashlink from git, and not with 1.11.bright-gpu-74537
12/10/2021, 8:26 PMpowerful-morning-89
12/10/2021, 8:28 PMc
typedef struct {
hl_type *;
Color c;
} hl_color;
HL_PRIM void HL_NAME(hl_raylib_clear_background)(hl_color* color) {
ClearBackground(color.c);
}
I'm not really a fan of typedefs because they're a bit slow.bright-gpu-74537
12/10/2021, 8:30 PMhl_dyn_geti(color, hl_hash_utf8("r"), &hlt_i32); type things?powerful-morning-89
12/10/2021, 8:30 PMbright-gpu-74537
12/10/2021, 8:31 PMpowerful-morning-89
12/10/2021, 8:31 PMbright-gpu-74537
12/10/2021, 8:34 PMbright-gpu-74537
12/10/2021, 8:35 PMpowerful-morning-89
12/10/2021, 8:35 PMhx
@:hlNative("raylib","raylib_")
class RayLibHL {
public static var RAYWHITE:Color = {r: 245, g: 245, b: 245, a: 255};
public static var GRAY:Color = {r: 130, g: 130, b: 130, a: 130};
public static function initWindow(width:Int, height:Int, title:String) {}
public static function windowShouldClose():Bool {
return false;
}
public static function closeWindow() {}
public static function beginDrawing() {}
public static function endDrawing() {}
public static function clearBackground(color:Color) {}
public static function measureText(text:String, fontSize:Int):Int {
return 0;
}
public static function drawText(text:String, posX:Int, posY:Int, fontSize:Int, color:Color) {}
}
the haxe compiler wll automatically convert initWindow to @:hlNative("raylib", "raylib_init_window")bright-gpu-74537
12/10/2021, 8:36 PMbright-gpu-74537
12/10/2021, 8:37 PMbright-gpu-74537
12/10/2021, 8:37 PMvoid*, or void**powerful-morning-89
12/10/2021, 8:37 PMcamelCase => snake_case when you have`@:hlNative` on the class.
As for hdll resolution, that's just `dlopen`/whatever windows does, so however the OS resolves dynamic libraries.powerful-morning-89
12/10/2021, 8:39 PMvoid* represents.
random user data => vdynamic* => Dynamic
A blob of data => vbyte* => hl.Bytes
For void**, hl.Ref<Whatever>.bright-gpu-74537
12/10/2021, 8:40 PMvoid** really... normal pointers are probably easy enoughbright-gpu-74537
12/10/2021, 8:40 PMhl.Ref<vdynamic*> is valid? (i havent tried at all yet)powerful-morning-89
12/10/2021, 8:41 PMhl.Ref<Dynamic>.
On the C side that would be vdynamic **.bright-gpu-74537
12/10/2021, 8:41 PMbright-gpu-74537
12/10/2021, 8:42 PM