Page 3 of 3
Re: raylib game framework
Posted: Sun May 03, 2020 11:39 am
by StarBootics
Hello everyone,
@Danilo : When do you think your Module will be ready for download ?
Best regards
StarBootics
Re: raylib game framework
Posted: Sun May 03, 2020 12:04 pm
by Caronte3D

Awesome library, I definitely will follow this post and hope the hard work of you (gurus) make this lib available from PB the easy way

Re: raylib game framework
Posted: Sun May 03, 2020 5:16 pm
by Danilo
Cyllceaux wrote:"long time ago" I started to port it by myself. I stopped it cause of ByVal Structures. (Pure Basic did not support it)
I wrote with ray about this and he said, I have to write my own wrapper in C.

Now he support pointers vor structures... which is great

It's still the same problem and round about 230 wrapper functions are needed for the ByVal structures.
I coded the first 3 by hand and then decided to use C for the job.
Code: Select all
Procedure rlBeginMode3D(*camera.rlCamera3D)
!MOV qword RAX, [p.p_camera]
!PUSH qword [RAX + 40]
!PUSH qword [RAX + 32]
!PUSH qword [RAX + 24]
!PUSH qword [RAX + 16]
!PUSH qword [RAX + 08]
!PUSH qword [RAX + 00]
!CALL _BeginMode3D
!ADD RSP, 48
EndProcedure
Procedure rlDrawCube(*position.rlVector3, width.rl_float, height.rl_float, length.rl_float, color.rlColor)
!MOV qword RAX, [p.p_position]
!MOVQ XMM0, QWORD [RAX]
!MOVSS XMM1, DWORD [RAX+8]
!MOVSS XMM2, DWORD [p.v_width]
!MOVSS XMM3, DWORD [p.v_height]
!MOVSS XMM4, DWORD [p.v_length]
!MOV EDI, DWORD [p.v_color]
!CALL _DrawCube
EndProcedure
Procedure rlDrawCubeWires(*position.rlVector3, width.rl_float, height.rl_float, length.rl_float, color.rlColor)
!MOV qword RAX, [p.p_position]
!MOVQ XMM0, QWORD [RAX]
!MOVSS XMM1, DWORD [RAX+8]
!MOVSS XMM2, DWORD [p.v_width]
!MOVSS XMM3, DWORD [p.v_height]
!MOVSS XMM4, DWORD [p.v_length]
!MOV EDI, DWORD [p.v_color]
!CALL _DrawCubeWires
EndProcedure
[/size]
StarBootics wrote:@Danilo : When do you think your Module will be ready for download ?
Structures: 100%
Enumerations: 100%
Procedure Imports: 73%
109 wrapper .c files are done and another round about 120 are waiting.
Should be ready in 2 days, and we have a working import on macOS.
After that comes testing on Linux (should run out-of-the-box I hope), and
I need to use a Windows virtual machine and VC++ for testing there.
MSVC++ is always a bit different, so I don't know what will come on this platform.
When the import is done and useable, it is required to translate some of the
100+ raylib examples (
Online) to PB.
So I think macOS is 2 days away. All OS hopefully still in May 2020.
The good thing is, raylib comes without any docs. No translation required!

Re: raylib game framework
Posted: Tue May 05, 2020 10:47 am
by Danilo
Done. And Linux works.

Only Windows missing...

Re: raylib game framework
Posted: Tue May 05, 2020 10:49 am
by Fred
That's cool stuff !
Re: raylib game framework
Posted: Tue May 05, 2020 12:48 pm
by luis
Danilo wrote:Now I import raylib‘s CloseWindow() as rl_CloseWindow(), with
modules I would need to write rl::rl_CloseWindow() ( Double-Whopper

),
because rl::CloseWindow() is not possible with PB.
I suffer every time I encounter, think, or read about this.
BTW: nice job Danilo

Re: raylib game framework
Posted: Tue May 05, 2020 1:24 pm
by StarBootics
Fred wrote:That's cool stuff !
Indeed !
Best regards
StarBootics
Re: raylib game framework
Posted: Tue May 05, 2020 6:44 pm
by Danilo
On macOS and Linux it works with a static import, so we get stand-alone executables.
Windows makes problems, as always, so it looks like I need to use the DLL import currently. That works.
Re: raylib game framework
Posted: Thu May 07, 2020 4:19 am
by Danilo
Re: raylib game framework
Posted: Thu May 07, 2020 11:23 am
by IceSoft
Danilo wrote:On macOS and Linux it works with a static import, so we get stand-alone executables.
Windows makes problems, as always, so it looks like I need to use the DLL import currently. That works.
Can you explain what not working during the static lib creation on windows?
Re: raylib game framework
Posted: Thu May 07, 2020 12:12 pm
by Danilo
IceSoft wrote:Can you explain what not working during the static lib creation on windows?
I will look into that later. The static lib that comes with raylib is compiled as C++,
so it can‘t be used as a C import (name mangling).
I tried several Compilers on Windows. The older VC++ compilers couldn‘t compile it,
and the newer (2015+) compilers use a new C runtime library (libucrt.lib / vcruntime.lib).
There came up several issues with missing runtime lib imports etc.
I have an idea how to get it working, but I can‘t do everything at the same time.
Currently I want to translate some of the raylib examples to PureBasic.
Re: raylib game framework
Posted: Thu May 07, 2020 12:20 pm
by IceSoft
Danilo wrote:
Currently I want to translate some of the raylib examples to PureBasic.
Yes thats more important.
Re: raylib game framework
Posted: Thu May 07, 2020 10:41 pm
by idle
Danilo wrote:IceSoft wrote:Can you explain what not working during the static lib creation on windows?
I will look into that later. The static lib that comes with raylib is compiled as C++,
so it can‘t be used as a C import (name mangling).
I tried several Compilers on Windows. The older VC++ compilers couldn‘t compile it,
and the newer (2015+) compilers use a new C runtime library (libucrt.lib / vcruntime.lib).
There came up several issues with missing runtime lib imports etc.
I have an idea how to get it working, but I can‘t do everything at the same time.
Currently I want to translate some of the raylib examples to PureBasic.
On windows if you can't use the same VS version PB is built with and you're using a recent VS, you'll need to add the crt libs as dependencies to the static lib and hope that there's no conflicts.