1. Raylib Wrapper 5.5 Released!

Hi,

I have finished wrapping Raylib 5.5 for openEuphoria. I've also added a simple animation example as well. The wrapper uses Greg's Euphoria FFI library. This allows the easy wrapping of C style structs.

https://github.com/gAndy50/EuRayLib5

include std/ffi.e 
include raylib.e 
 
constant MAX_FRAME_SPEED = 15 
constant MIN_FRAME_SPEED = 1 
 
constant WIDTH = 800 
constant HEIGHT = 450 
 
public enum tex_id, 
	 tex_width, 
	 tex_height, 
	 tex_mipmaps, 
	 tex_format 
 
InitWindow(WIDTH,HEIGHT,"Sprite Animation") 
 
sequence scarfy = LoadTexture("scarfy.png") 
 
sequence pos = {350.0,280.0} 
sequence frameRec = {0.0, 0.0, scarfy[tex_width] / 6, scarfy[tex_height]} 
 
integer currentFrame = 0 
 
integer framesCounter = 0 
integer framesSpeed = 8 
 
SetTargetFPS(60) 
 
while not WindowShouldClose() do 
	framesCounter += 1 
	 
	if framesCounter >= 60 / framesSpeed then 
		framesCounter = 0 
		currentFrame += 1 
		 
		if currentFrame > 5 then 
			currentFrame = 0 
		end if 
		 
		frameRec[1] = currentFrame * scarfy[tex_width] / 6 
	end if 
	 
	if IsKeyPressed(KEY_RIGHT) then 
		framesSpeed += 1 
		elsif IsKeyPressed(KEY_LEFT) then 
			framesSpeed -= 1 
	end if 
	 
	if framesSpeed > MAX_FRAME_SPEED then 
		framesSpeed = MAX_FRAME_SPEED 
		elsif framesSpeed < MIN_FRAME_SPEED then 
			framesSpeed = MIN_FRAME_SPEED 
	end if 
	 
	BeginDrawing() 
	 
	ClearBackground(RAYWHITE) 
	 
	DrawTexture(scarfy,15,40,WHITE) 
	DrawRectangleLines(15,40,scarfy[tex_width],scarfy[tex_height],LIME) 
	DrawRectangleLines(15 + frameRec[1],40 + frameRec[2], frameRec[3], frameRec[4], RED) 
	 
	for i = 1 to MAX_FRAME_SPEED do 
		if i < framesSpeed then 
			DrawRectangle(250 + 21 * i, 205,20,20,RED) 
			DrawRectangleLines(250 + 21 * i,205,20,20,MAROON) 
		end if 
	end for 
	 
	DrawTextureRec(scarfy,frameRec,pos,WHITE) 
	 
	EndDrawing() 
end while 
 
UnloadTexture(scarfy) 
 
CloseWindow() 
 
new topic     » topic index » view message » categorize

2. Re: Raylib Wrapper 5.5 Released!

Icy_Viking said...

Hi,

I have finished wrapping Raylib 5.5 for openEuphoria. I've also added a simple animation example as well. The wrapper uses Greg's Euphoria FFI library. This allows the easy wrapping of C style structs.

https://github.com/gAndy50/EuRayLib5

Thank you, great work

I was just a bit confused at the beginning.
the libffi-euphoria repository already contains a different version of raylib
and maybe you could add a link to the libffi-euphoria to the readme (as far as i know, libffi is not yet in the openeuphoria release).
But in the end I got all the examples to work

Andreas

new topic     » goto parent     » topic index » view message » categorize

3. Re: Raylib Wrapper 5.5 Released!

andreasWagner said...
Icy_Viking said...

Hi,

I have finished wrapping Raylib 5.5 for openEuphoria. I've also added a simple animation example as well. The wrapper uses Greg's Euphoria FFI library. This allows the easy wrapping of C style structs.

https://github.com/gAndy50/EuRayLib5

Thank you, great work

I was just a bit confused at the beginning.
the libffi-euphoria repository already contains a different version of raylib
and maybe you could add a link to the libffi-euphoria to the readme (as far as i know, libffi is not yet in the openeuphoria release).
But in the end I got all the examples to work

Andreas

Thanks for the support. I'll add the FFI library into the repo.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Raylib Wrapper 5.5 Released!

andreasWagner said...

I was just a bit confused at the beginning.
the libffi-euphoria repository already contains a different version of raylib

FYI those libraries are only provided to demonstrate how to use libffi. That whole project is still "proof of concept" and libffi will be integrated directly into Euphoria.

-Greg

new topic     » goto parent     » topic index » view message » categorize

5. Re: Raylib Wrapper 5.5 Released!

ghaberek said...
andreasWagner said...

I was just a bit confused at the beginning.
the libffi-euphoria repository already contains a different version of raylib

FYI those libraries are only provided to demonstrate how to use libffi. That whole project is still "proof of concept" and libffi will be integrated directly into Euphoria.

-Greg

I think the "proof of concept" is working. Libffi has been great for Euphoria and for wrapping libraries.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Raylib Wrapper 5.5 Released!

Hallo,

around line 263,264 in rlgl.e this

xrlTranslatef = define_c_proc(ray,"+rlTranslatef",{C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT}), --4 parameter 
xrlRotatef = define_c_proc(ray,"+rlRotatef",{C_FLOAT,C_FLOAT,C_FLOAT}),               --3 parameter   

should be this:

xrlTranslatef = define_c_proc(ray,"+rlTranslatef",{C_FLOAT,C_FLOAT,C_FLOAT}), --3 parameter 
xrlRotatef = define_c_proc(ray,"+rlRotatef",{C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT}), --4 parameter 

according to rlgl.h

RLAPI void rlTranslatef(float x, float y, float z);   // Multiply the current matrix by a translation matrix 
RLAPI void rlRotatef(float angle, float x, float y, float z);  // Multiply the current matrix by a rotation matrix 

I noticed this with the example core_2d_camera_mouse_zoom.ex from libffi-euphoria.

Hope this helps.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Raylib Wrapper 5.5 Released!

andreasWagner said...

Hallo,

around line 263,264 in rlgl.e this

xrlTranslatef = define_c_proc(ray,"+rlTranslatef",{C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT}), --4 parameter 
xrlRotatef = define_c_proc(ray,"+rlRotatef",{C_FLOAT,C_FLOAT,C_FLOAT}),               --3 parameter   

should be this:

xrlTranslatef = define_c_proc(ray,"+rlTranslatef",{C_FLOAT,C_FLOAT,C_FLOAT}), --3 parameter 
xrlRotatef = define_c_proc(ray,"+rlRotatef",{C_FLOAT,C_FLOAT,C_FLOAT,C_FLOAT}), --4 parameter 

according to rlgl.h

RLAPI void rlTranslatef(float x, float y, float z);   // Multiply the current matrix by a translation matrix 
RLAPI void rlRotatef(float angle, float x, float y, float z);  // Multiply the current matrix by a rotation matrix 

I noticed this with the example core_2d_camera_mouse_zoom.ex from libffi-euphoria.

Hope this helps.

Good catch. I have fixed it. It is now correct on the EuRaylib 5.5 repo.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu