Author Topic: Raylib for GLBasic! (hosted on Github)  (Read 4720 times)

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
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 :)
« Last Edit: 2020-May-09 by Schranz0r »
I <3 DGArray's :D

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 350
  • to program what I have todo how should I program?
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #1 on: 2020-May-04 »
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

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #2 on: 2020-May-04 »
It's Cross platform, so it should be fine on Android.  :good:
I <3 DGArray's :D

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #3 on: 2020-May-04 »
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()
« Last Edit: 2020-May-04 by Schranz0r »
I <3 DGArray's :D

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 400
    • View Profile
    • my personal website
Re: Raylib for GLBasic! (hosted on Github)
« Reply #4 on: 2020-May-04 »
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

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #5 on: 2020-May-04 »
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 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2747
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #6 on: 2020-May-05 »
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)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: Raylib for GLBasic! (hosted on Github)
« Reply #7 on: 2020-May-05 »
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.
« Last Edit: 2020-May-05 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #8 on: 2020-May-05 »
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
 
« Last Edit: 2020-May-05 by Schranz0r »
I <3 DGArray's :D

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: Raylib for GLBasic! (hosted on Github)
« Reply #9 on: 2020-May-05 »
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++).
« Last Edit: 2020-May-05 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 415
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #10 on: 2020-May-06 »
Awesome Schranz0r!  :good:

But you don't continue your Irrlicht Wrapper?

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #11 on: 2020-May-09 »
@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 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2747
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #12 on: 2020-May-09 »
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?
« Last Edit: 2020-May-09 by bigsofty »
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)

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5111
  • O Rly?
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #13 on: 2020-May-10 »
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 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2747
    • View Profile
Re: Raylib for GLBasic! (hosted on Github)
« Reply #14 on: 2020-May-10 »
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)