Re: raylibshim - A shim library for Euphoria and Raylib
- Posted by Maccuq Jul 21, 2019
- 1164 views
Hi, You are passing wrong arguments to DrawTexture function.
C DrawTexture function definition
RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint);
Example
include flags.e include std/convert.e include Euraylib.ew constant width = 800 constant height = 450 atom black = bytes_to_int({0, 0, 0, 0}) atom yello = bytes_to_int({255, 255, 0, 255}) atom white = bytes_to_int({255, 255, 255, 255}) InitWindow(width,height,"Simple Texture") while not WindowShouldClose() do BeginDrawing() ClearBackground(black) -- 1 placeholder -- 2 defalut font -- 3 gLoadTextureFromImage("raylib_logo.png") -- we are passing font texture loaded by defalut (Index 2) sequence texutre_info = {2, 150, 150, 1, 0} DrawTexture(texutre_info, width / 2, height / 2, white) DrawText("This is Texture",1,1,20,yello) EndDrawing() end while --UnloadTexture(tex)
Euraylib.ew
public constant xDrawTexture = define_c_proc(ray,"+DrawTexture",{C_UINT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_UINT}), xDrawTextureV = define_c_proc(ray,"+DrawTextureV",{C_POINTER,C_FLOAT,C_FLOAT,C_UINT}), xDrawTextureEx = define_c_proc(ray,"+DrawTextureEx",{C_POINTER,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_UINT}), xDrawTextureRec = define_c_proc(ray,"+DrawTextureRec",{C_POINTER,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_UINT}), xDrawTextureQuad = define_c_proc(ray,"+DrawTextureQuad",{C_POINTER,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_UINT}), xDrawTexturePro = define_c_proc(ray,"+DrawTexturePro",{C_POINTER,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_UINT}), xDrawTextureNPatch = define_c_proc(ray,"+DrawTextureNPatch",{C_POINTER,C_UINT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT,C_UINT}) public procedure DrawTexture(sequence seq, atom x,atom y,atom tint) c_proc(xDrawTexture,{seq[1],seq[2],seq[3],seq[4],seq[5],x,y,tint}) end procedure