Raylib and Classes

new topic     » topic index » view thread      » older message » newer message

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.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu