Page 3 of 3
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Fri Jan 13, 2023 9:25 pm
by ccode_new
Hello mk-soft,
did you test this?
That's why I've renamed the structures since I first used the RayLib.
This function also only needs Vector2.
This doesn't work!
Code: Select all
#include "raylib_pb_helper.h"
#include "rlgl.h"
void pbhelper_DrawTextPro(Font* font, const char *text, Vector2 *position, Vector2 *origin, float rotation, float fontSize, float spacing, Color tint) {
if( font && text && position && origin)
rlPushMatrix();
rlTranslatef(position->x, position->y, 0.0f);
rlRotatef(rotation, 0.0f, 0.0f, 1.0f);
rlTranslatef(-origin->x, -origin->y, 0.0f);
DrawTextEx(*font, text, (Vector2){ 0.0f, 0.0f }, fontSize, spacing, tint);
rlPopMatrix();
}
I found the mistake:
It is considered solved.
I had only one small mistake in this declaration (raylib.pbi)
DrawTextPro(*in_font.ray::Font, text.p-utf8, *in_position.ray::Vector2, *origin.ray::Vector2, rotation.rl_float, fontSize.rl_float, spacing.rl_float, tint.rl_ColorLong) __PBAS(DrawTextPro) (Mistake with float - Variable)
A small note:
The matrix structure exists both in "raylib.h" and in "rlgl.h".
(On MacOS the OSX_DEPLOYMENT_TARGET = 11.0) > 11 not work!
It works!
/*
The "raylib4.2" has so many great improvements and additional useful features.
I'm trying to keep porting it. (no ugly inline-c)
*/
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Thu Feb 02, 2023 8:37 pm
by ccode_new
...
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Thu Feb 02, 2023 9:54 pm
by Joubarbe
Oh, so you actually ported the latest version of raylib? Thanks!
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Mon Feb 13, 2023 8:52 pm
by ccode_new
How to statically build the "raylib" library on Windows with PureBasic compatibility? (.lib / .a)
(Using Microsoft Visual Studio C compiler or msys2)
Does anyone have experience with this?
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Mon Feb 13, 2023 10:55 pm
by idle
ccode_new wrote: Mon Feb 13, 2023 8:52 pm
How to statically build the "raylib" library on Windows with PureBasic compatibility? (.lib / .a)
(Using Microsoft Visual Studio C compiler or msys2)
Does anyone have experience with this?
It's problematic to build it as a static lib on windows due to conflicting c run times. If you can get hold of the same sdk Fred uses to compile PB on windows you can do it but I think it requires a msdn sub to get the old version he uses.
Also note raylib parses a lot structures by value which is problematic for us in PB but it can be addressed easy enough with inline c I provided a couple of examples of using raylib4 wtih inline c here
viewtopic.php?t=79332
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Tue Feb 14, 2023 9:56 pm
by chi
ccode_new wrote: Mon Feb 13, 2023 8:52 pm
How to statically build the "raylib" library on Windows with PureBasic compatibility? (.lib / .a)
I'm pretty sure you can't! PB's C runtime on Windows is very old and Raylib needs some of the newer features...
Fortunately, you can do it the other way around. I created a custom msvcrt.lib so you can use UCRT with PB (C backend only). Just rename the original msvcrt.lib (PB64Folder\PureLibraries\Windows\Libraries) to msvcrt_orig.lib and copy msvcrt_v143.lib from the zip file to the same folder. Now make a copy of msvcrt_v143.lib and rename it to msvcrt.lib. (Don't forget to rename msvcrt_orig.lib to msvcrt.lib if you want to go back and use the old CRT and/or the ASM backend)
To create a statically linked raylib.lib, just clone the Github repository and open raylib/projects/VS2022/Raylib.sln with VS and compile Release | x64. Replace your libraylib_win_x64.lib with the one you just created and you should be able to compile all examples statically linked without the need for raylib.dll. I've also included the 4.2 lib in the zip.
ray_msvcrt.7z (4.52MB)
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Wed Feb 15, 2023 2:09 am
by ccode_new
@chi
Thanks very much!
The replacement of "msvcrt.lib" was successful.
I can now create a static library using "MS Visual Studio" and it works.
Can I tell PureBasic to use a different msvcrt.lib when linking?
So some kind of Makefile for PureBasic?
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Wed Feb 15, 2023 12:20 pm
by chi
ccode_new wrote: Wed Feb 15, 2023 2:09 am
Thanks very much!
The replacement of "msvcrt.lib" was successful.
I can now create a static library using "MS Visual Studio" and it works.
Great, I'm glad to hear that! I wasn't 100% sure if everything would work on another computer...
ccode_new wrote: Wed Feb 15, 2023 2:09 am
Can I tell PureBasic to use a different msvcrt.lib when linking?
So some kind of Makefile for PureBasic?
The easiest way would be to write a small IDE plugin to switch between libraries, but you could also intercept the linker command line and replace msvcrt there (but is more complex). I'll come up with something

Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Wed Feb 15, 2023 8:31 pm
by Joubarbe
Why do I have an error about ASM backend when I try to run any example? I thought PB 6 had a C backend by default?
EDIT: Wow, wait... All that time, I was still on ASM backend, since one of the betas of PB6. There's nothing in the documentation (?), and I had to read about adding the new compiler through the changelog. Something is wrong here.
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Sun Feb 19, 2023 12:31 am
by gltianya
chi wrote: Tue Feb 14, 2023 9:56 pm
ccode_new wrote: Mon Feb 13, 2023 8:52 pm
How to statically build the "raylib" library on Windows with PureBasic compatibility? (.lib / .a)
I'm pretty sure you can't! PB's C runtime on Windows is very old and Raylib needs some of the newer features...
Fortunately, you can do it the other way around. I created a custom msvcrt.lib so you can use UCRT with PB (C backend only). Just rename the original msvcrt.lib (PB64Folder\PureLibraries\Windows\Libraries) to msvcrt_orig.lib and copy msvcrt_v143.lib from the zip file to the same folder. Now make a copy of msvcrt_v143.lib and rename it to msvcrt.lib. (Don't forget to rename msvcrt_orig.lib to msvcrt.lib if you want to go back and use the old CRT and/or the ASM backend)
To create a statically linked raylib.lib, just clone the Github repository and open raylib/projects/VS2022/Raylib.sln with VS and compile Release | x64. Replace your libraylib_win_x64.lib with the one you just created and you should be able to compile all examples statically linked without the need for raylib.dll. I've also included the 4.2 lib in the zip.
ray_msvcrt.7z (4.52MB)
Can you provide X86 of ray_msvcrt , or guide how to make it? Especially how to make msvcrt for x86 platform?
Thanks a lot.
Using the msvcrt_v143.lib you provided, I compiled the
https://github.com/utelle/SQLite3MultipleCiphers/ source code into a static link library, and initially successfully used it in purebasic.
Steps: Replace msvcrt.lib and sqlite3.lib respectively, and use pbcompilerc.exe as the compilation backend.
English is not my mother tongue, this message is translated by Google
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Sun Mar 05, 2023 7:53 pm
by ccode_new
Hi!
A small update to "RayLib 4.2" follows.
There are still some errors in the PureBasic source code. (From me and from Mr. Krahn)
By implementing the RayLib examples (from the website) or by trying them out, you always get to know new errors.
[url=
https://github.com/ccode-new/raylib-pur ... ee/PureRay([/url] (March 2025)
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Thu Mar 23, 2023 3:12 pm
by chi
@ccode_new, @gltianya
You can use
RuntimeSwitcher to create a custom msvcrt.lib (x86+x64) and switch between CRT and UCRT.
Re: [Module] raylib-purebasic (Windows/Linux/macOS)
Posted: Thu May 18, 2023 6:09 pm
by Josepho
Hi i download the module from the last post of @code_new and im not getting errors but im not watching anything, am i doing something wrong?
Btw i also was using the asmcompiler the whole time, this was not very obvious to discover, i switched it to the c today