raylib game framework

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: raylib game framework

Post by StarBootics »

Hello everyone,

@Danilo : When do you think your Module will be ready for download ?

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: raylib game framework

Post by Caronte3D »

:shock: 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 :wink:
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: raylib game framework

Post 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. :D

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. :D

The good thing is, raylib comes without any docs. No translation required! :twisted:
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: raylib game framework

Post by Danilo »

Done. And Linux works. :)
Only Windows missing...

Image
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: raylib game framework

Post by Fred »

That's cool stuff !
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: raylib game framework

Post 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 :wink:
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: raylib game framework

Post by StarBootics »

Fred wrote:That's cool stuff !
Indeed !

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: raylib game framework

Post 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.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: raylib game framework

Post by Danilo »

User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: raylib game framework

Post 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?
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: raylib game framework

Post 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.
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: raylib game framework

Post by IceSoft »

Danilo wrote: Currently I want to translate some of the raylib examples to PureBasic.
Yes thats more important.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: raylib game framework

Post 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.
Windows 11, Manjaro, Raspberry Pi OS
Image
Post Reply