Raylib and Classes
- Posted by Icy_Viking Aug 26, 2022
- 718 views
Hello all,
I am doing this as an expermint for now.
I'm using the classes.e file to help with the structs that Raylib has. I'm wondering if this works or could get extran help to make sure I'm doing this correctly.
C Code
typedef struct Vector2 { float x; // Vector x component float y; // Vector y component } Vector2; typedef struct Color { unsigned char r; // Color red value unsigned char g; // Color green value unsigned char b; // Color blue value unsigned char a; // Color alpha value } Color; RLAPI void DrawPixelV(Vector2 position, Color color);
Eu code
include classes.e sequence TVector2 = class("TVector2") TVector2 = addProperty(TVector2,"x",0) TVector2 = addProperty(TVector2,"y",0) addMethod(TVector2,"Vector2",routine_id("Vector2")) sequence Vector2 = classes:new(TVector2) sequence TColor = class("TColor") TColor = addProperty(TColor,"r",0) TColor = addProperty(TColor,"g",0) TColor = addProperty(TColor,"b",0) TColor = addProperty(TColor,"a",0) sequence Color = classes:new(TColor) public constant xDrawPixelV = define_c_proc(ray,"DrawPixelV",{C_FLOAT,C_UCHAR}) public procedure DrawPixelV(void = callMethod(Vector2,"Vector2",{"Vector2"}), void = callMethod(Color,"Color",{"Color"})) c_proc(xDrawPixelV,{Something here}) end procedure
I'm a bit confused on how to use it with DLL functions.