forum-msg-id-134086-edit
Original date:2019-07-20 14:46:59 Edited by: Icy_Viking Subject: Re: raylibshim - A shim library for Euphoria and Raylib
Thanks Greg, this will come in handy. I know some C and C++ programming. So it shouldn't be too hard to deal with.
EDIT: OK, I was able to incorpate rayshimlib.c into the raylib visual studio project file and build it from there. After checking the raylib.DLL, I noticed that the shim functions are inside of the DLL, so they can be loaded. I had to do a little reworking with the Euraylib.ew file, but I got it to work!
--Had to change a couple function names, but it works. I'll add the rest of the functions soon. --Maybe I have to rework this a little? public constant xDrawTexture = define_c_proc(ray,"+DrawTexture",{C_POINTER,C_INT,C_INT,C_UINT,C_UINT,C_UINT,C_UINT}) public procedure DrawTexture(atom tex,atom x,atom y,atom r,atom g,atom b,atom a) c_proc(xDrawTexture,{tex,x,y,r,g,b,a}) end procedure constant shimLoadTexture = define_c_proc( ray, "+shimLoadTexture", C_STRING & C_POINTER ), shimLoadTextureFromImage = define_c_proc( ray, "+shimLoadTextureFromImage", C_IMAGE & C_POINTER ), $ public function gLoadTexture( sequence filename ) atom texture = allocate_data( SIZEOF_TEXTURE2D, TRUE ) mem_set( texture, NULL, SIZEOF_TEXTURE2D ) c_proc( shimLoadTexture, {allocate_string(filename,TRUE),texture} ) atom id = peek4u( texture + Texture2D_id ) atom width = peek4s( texture + Texture2D_width ) atom height = peek4s( texture + Texture2D_height ) atom mipmaps = peek4s( texture + Texture2D_mipmaps ) atom format = peek4s( texture + Texture2D_format ) return {id,width,height,mipmaps,format} end function public function gLoadTextureFromImage( sequence image ) atom data = image[IMAGE_DATA] atom width = image[IMAGE_WIDTH] atom height = image[IMAGE_HEIGHT] atom mipmaps = image[IMAGE_MIPMAPS] atom format = image[IMAGE_FORMAT] atom texture = allocate_data( SIZEOF_TEXTURE2D, TRUE ) mem_set( texture, NULL, SIZEOF_TEXTURE2D ) c_proc( shimLoadTextureFromImage, {data,width,height,mipmaps,format,texture} ) atom id = peek4u( texture + Texture2D_id ) width = peek4s( texture + Texture2D_width ) height = peek4s( texture + Texture2D_height ) mipmaps = peek4s( texture + Texture2D_mipmaps ) format = peek4s( texture + Texture2D_format ) return {id,width,height,mipmaps,format} end function
Now the problem is, I don't know how to display the image using DrawTexture?
without warning include std/machine.e include std/convert.e include Euraylib.ew --include raylibshim.e constant width = 800 constant height = 450 atom black = bytes_to_int({0,0,0,0}) atom white = bytes_to_int({255,255,255,255}) atom yello = bytes_to_int({255,255,0,255}) InitWindow(width,height,"Simple Texture") gLoadTextureFromImage("raylib_logo.png") --this works fine. while not WindowShouldClose() do BeginDrawing() ClearBackground(black) DrawText("This is Texture",1,1,20,yello) DrawTexture(1,50,50,0,0,0,0) --not sure how to load display the texture EndDrawing() end while CloseWindow()
Not Categorized, Please Help
|
- history, backlinks
- Last modified Jul 20, 2019 by Icy_Viking