Raylib for GLBasic! (hosted on Github)

Previous topic - Next topic

Schranz0r

HUHU,

i start a new Project, and it works nice so far! :)


GITHUB

This (https://github.com/SliverLIVE/Raylib-for-GLBasic) is a wrapper from this: https://www.raylib.com
Instructions on Github. Feel free to help on this!
I also need maybe a better way to handle the Structs (Font, Image, Texture, Vector4, Vector3...) in GLBasic...
Any suggestions are welcome :)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Qedo

Congratulations Schranz0r very very very interesting project.
I will try it to understand the potential that seems high.
One question: What about multi-platform? think of Android and others
Thank you so much
Ciao

Schranz0r

It's Cross platform, so it should be fine on Android.  :good:
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Schranz0r

#3
So i changed the way to handle things!
The Types from GLBasic are now the same as the Structs from Raylib.
All functions and Types related to Raylib starting with the prefix "RL_"

Sample Code:
Code (glbasic) Select
LOCAL Title$ = "Raylib for GLBasic!"

RL_InitWindow(800,600, Title$)
RL_SetTargetFPS(60)


LOCAL col_lightgray AS RL_Color
col_lightgray.Set(200, 200, 200, 255)

LOCAL col_raywhite AS RL_Color
col_raywhite.Set(245, 245, 245, 255)

LOCAL col_red AS RL_Color
col_red.Set(255, 0, 0,255)


LOCAL fnt_default AS RL_Font
fnt_default = RL_GetFontDefault()

LOCAL fnt_PermMarker AS RL_Font
fnt_PermMarker = RL_LoadFont("fonts/PermanentMarker.ttf")

WHILE NOT RL_WindowShouldClose()

RL_BeginDrawing()

RL_ClearBackground(col_lightgray)
RL_DrawText("Congrats! You created your first window!", 190, 200, 20, col_red)
RL_DrawTextEx(fnt_PermMarker, "Oh, hi...! I'm the new Font!", 200, 250, 40, 2, col_raywhite)

RL_EndDrawing()

WEND

RL_CloseWindow()
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

dreamerman

Very interesting.. This may be huge for several reasons. As RayLib is cross platform, based on OpenGL and support WebGL and has 2d, 3d, music, net, compression, win related functions and so on. It all depends on how much it's mature or rather tested on real devices like mobiles and how much effort is put to keep it compatible with recent Android updates. I'm curious about that, due all current Android problems and absence of other platforms like Linux in GLB. Another big advantage over other such solutions is no dependencies for other libraries, no crazy problems with compilation.

For me important thing is that in contrast to many other 'game dev libraries' here You have access to more basic drawing routines, and some equivalent to GLB StartPoly / PolyVector can be written, so let's say some handmade spriteBatch functions - as this allows for multi layer animated tile map and so on. On other hand it goes on current GLBasic status with compilation for HTML5-WebGL (that could be used on iOS/MacOS), and all Android problems.

btw. using RL_ as prefix may be most readable and clean solution for GLB - adding some object interface can cause issues with other things.
Check my source code editor for GLBasic - link Update: 20.04.2020

Schranz0r

Hi dreamerman,

if you like/can/want, you can help me with this :)
Have some other ideas in mind!  :x
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

bigsofty

Nicely done sir! Too late to look at it tonight, will enjoy a proper look tomorrow.  :good:
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

spacefractal

#7
the main problem is its not combatible with current glbasic apps and is impossible to redone and update those, newer for the bigger projects. So we should not breaking that combatible at all with old apps. This is actuelly very important. Combatible was also in mind when im added some Android features to a GLBASIC command directly as its should been.

Gernot would not like to breaking combatible with old apps at all as well. A beginner cant property use this too.

But a Plugin system in glbasic would been very great. etc a way possible to automatic replace a glbasic command to a suitable FUNCTION used by the wrapper, etc a Prototype list, that can been picked up by the PRECOMPILER.

But dont mind me, this such of a project is very great and sure its can been done. Im take a look how such a wrapper can been done later. This is NOT important now at all! Get it work first is first priotity.

EDIT: Im have a idea how to do that by replacing g++ to launch the "wrapper" tool first and then g++ from the tool to perform that task. So dont think about that by now. Im need to do that tool first.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Schranz0r

#8
But, to make it work from the compiler i have to wrapp it in the Sourcecode (c/c++)...
And wrapp this in C++ is much easier then in GLBasic itself!

In Source: Add Lib, Include Headerfile

Pseudo-code:
Code (glbasic) Select

namespace Raylib{
    void SETSCREEN(int width, int height, bool fullscreen)
    {
        InitWindow(width, height, __GLBASIC__::project_name.c_str()); // didn't know the internal projectname... :)
        if(fullscreen)
            ToggleFullscreen();
    }
}


no need to wrapp the whole thing in a gbas file, simple direkt calls...
This way you can say to the compiler to use the Raylib:: and not the __GLBASIC__:: namespace for this functions
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

spacefractal

#9
using namespace can been complicered, a least for me, which require updating glb.h file as well me thinks. But its dont matter at all how!

We do a plugin system later. Its actuelly not important now. But later its will. But im have a idea about it.

We do defensivt need a tool to do that before launching the final exe code (g++).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

SnooPI

Awesome Schranz0r!  :good:

But you don't continue your Irrlicht Wrapper?

Schranz0r

@SnooPI:
I just start the Wrapper from Irrlicht-Engine, was never into it to complete it ^^

Update to Raylib:

All Core-Functions are now in!
See https://www.raylib.com/cheatsheet/cheatsheet.html for what's inside Core!
Only one function is skipped: void SetTraceLogCallback(TraceLogCallback callback);
I see no use, and didn't know how to do it in GLBasic atm. :)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

bigsofty

#12
Great stuff and a lot of fun to mess around with, thank you Schranz0r!  :happy:

One thing, did you write a Raylib to GLB parser type of util or did you do the conversion by hand (via find/replace etc.) for all the various calls/enums?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Schranz0r

For the functions i wrote a program, just a simple one...
I do the most part by hand :)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

bigsofty

Cool beans, I may try to convert some of the C demos if I get the time to GLB, I'll keep you informed how this works out. ;)
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)