GithubHelp home page GithubHelp logo

a740g / raylib-64 Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 14.58 MB

QB64-PE bindings for raylib (a simple and easy-to-use library to learn videogames programming)

Home Page: https://qb64phoenix.com/forum/showthread.php?tid=1776

License: MIT License

FreeBasic 25.34% C++ 46.48% C 3.16% GLSL 2.80% Visual Basic 6.0 0.41% BASIC 21.81%
game-development game-programming qb64 qb64-pe qbasic qbasic64 quickbasic quickbasic64 raylib raylib-binding

raylib-64's Introduction

raylib for QB64-PE

raylib (v5.0)

raylib for QB64-PE is a QB64-PE binding library for raylib. raylib is a simple and easy-to-use library to enjoy videogames programming.

raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education.

Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4

SUPPORTED PLATFORMS

API Windows (x86-64) Linux (x86-64) macOS (x86-64)
core ✔️ ✔️ ✔️
reasings ✔️ ✔️ ✔️
physac ✔️ ✔️ ✔️
raymath ✔️ ✔️ ✔️
raygui

EXAMPLE

' raylib [core] example - Basic window

'$INCLUDE:'include/raylib.bi'

Const screenWidth = 800
Const screenHeight = 450

InitWindow screenWidth, screenHeight, "raylib [core] example - basic window"

SetTargetFPS 60

Do Until WindowShouldClose
    BeginDrawing

    ClearBackground RAYWHITE

    DrawText "Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY

    EndDrawing
Loop

CloseWindow

System

'$INCLUDE:'include/raylib.bas'

More examples are available in the repository.

FAQ

Why are you loading the shared library using C/C++? Why not use QB64's built-in DECLARE DYNAMIC LIBRARY?

  • When I initially started out, I wanted to use DECLARE DYNAMIC LIBRARY to keep things simple. However, some QB64 language limitations got in the way. For example, you cannot return UTDs from functions and subs and functions cannot take UDT variables by value (yet). raylib does a lot of both. So, I had to make a hard choice of wrapping these functions in C/C++ in a QB64-friendly way. Also, I used a custom autogen program to do the heavy lifting and it made a lot of sense to do the autogen to C/C++.

Why does some raylib TYPEs like Camera, Texture2D, Sound etc. generate an error?

  • Some TYPEs and TYPE member variables had to be renamed to resolve clashes with QB64 keywords. E.g. Sound is RSound. Also QB64 does not support TYPE aliases. So, there is no Camera. It's just Camera2D or Camera3D. There is no Texture2D. It's just Texture. As a general rule of the thumb, if a raylib identifier clashes with a QB64-PE keyword an R is prefixed to the raylib identifier. Hence, Font become RFont, Sound becomes RSound and so on.

Why have you changed a lot of raylib functions like LoadTexture, GetMousePosition, GetMonitorPosition etc. to QB64 SUBs? Should't these be FUNCTIONSs?

  • Unfortunately, QB64 does not support returning UDTs from FUNCTIONs (yet) and many raylib functions return UDTs. So, to work around this limitation, I changed many raylib functions to SUBs that would otherwise be a FUNCTION. The return value is returned to the caller via a SUB parameter. This is usually the last parameter and has the name retVal.

What QB64 statements and functions should I avoid while using raylib?

  • Any statement or functions that require the QB64 graphics OpenGL window (including all input stuff) should be avoided. Use the raylib alternatives for those.

Does all of raylib work with QB64?

  • Well, mostly. Callbacks are a challenge. But, it can be done if you are willing to mix a little bit of C with QB64. Stuff requiring usage of pointers can be a little difficult. I simplified many functions by carefully wrapping them inside QB64 friendly routines. Also, I have included pointer support routines for cases where you have to work with raylib structs (TYPEs) that contain pointers and arrays.

Which version of QB64 should I use with raylib-64?

I found a bug. How can I help?

  • Let me know using GitHub issues or fix it yourself and submit a PR!

CREDITS

  • Martin Olivier for Dylib (without this raylib-64 would not be possible; thank you Martin!)
  • Matt Kilgore for qb64pe-json (I used this for the autogen program to do most of the heavy lifting; thank you Matt!)
  • Paul Martin for testing raylib-64 and porting many raylib C examples to QB64-PE (thank you mechatronic3000 a.k.a. justsomeguy!)
  • Ramon Santamaria for the awesome raylib library (thank you Ray!)
  • Rick Christy for the raylib-64 logo (generously designed and contributed the logo; thank you Rick!)
  • Various artists for the example assets taken directly from the raylib repository (thank you all!)

HELP NEEDED

Made with ❤️ by a740g

raylib-64's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mechatronic3000

raylib-64's Issues

thanks

No issues (yet) - just wanted to say thanks for doing this. I tested other bindings and they did not work beyond creating a simple screen.

I will test when i get some free time.

Fails to Run on later versions of QB64pe

It appears to broken with QB64pe v3.10 and v3.11.

It compiles with 3.10, but does not run. It wont compile with 3.11.

I'm running Linux Mint 21.2

Here is the compile log for 3.11

g++ -no-pie -w -std=gnu++14 -DFREEGLUT_STATIC -I./internal/c/libqb/include -I./internal/c/parts/core/src/ -I./internal/c/parts/core/glew/include/ -DDEPENDENCY_CONSOLE_ONLY -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE internal/c/libqb.cpp -c -o internal/c/libqb_make_001000000.o g++ -no-pie -w -std=gnu++14 -DFREEGLUT_STATIC -I./internal/c/libqb/include -I./internal/c/parts/core/src/ -I./internal/c/parts/core/glew/include/ -DDEPENDENCY_CONSOLE_ONLY -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE internal/c/qbx.cpp -c -o internal/c/qbx.o g++ -O2 -no-pie -w -std=gnu++14 -DFREEGLUT_STATIC -I./internal/c/libqb/include -I./internal/c/parts/core/src/ -I./internal/c/parts/core/glew/include/ -DDEPENDENCY_CONSOLE_ONLY -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE -Wall internal/c/libqb/src/threading.cpp -c -o internal/c/libqb/src/threading.o g++ -O2 -no-pie -w -std=gnu++14 -DFREEGLUT_STATIC -I./internal/c/libqb/include -I./internal/c/parts/core/src/ -I./internal/c/parts/core/glew/include/ -DDEPENDENCY_CONSOLE_ONLY -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE -Wall internal/c/libqb/src/buffer.cpp -c -o internal/c/libqb/src/buffer.o g++ -O2 -no-pie -w -std=gnu++14 -DFREEGLUT_STATIC -I./internal/c/libqb/include -I./internal/c/parts/core/src/ -I./internal/c/parts/core/glew/include/ -DDEPENDENCY_CONSOLE_ONLY -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE -Wall internal/c/libqb/src/filepath.cpp -c -o internal/c/libqb/src/filepath.o In file included from internal/c/qbx.cpp:2: internal/c/common.h:97:21: error: expected identifier before ‘-’ token 97 | # define QB_TRUE -1 | ^ /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:19:5: note: in expansion of macro ‘QB_TRUE’ 19 | QB_TRUE = -1, | ^~~~~~~ internal/c/common.h:97:21: error: expected ‘}’ before ‘-’ token 97 | # define QB_TRUE -1 | ^ /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:19:5: note: in expansion of macro ‘QB_TRUE’ 19 | QB_TRUE = -1, | ^~~~~~~ In file included from internal/c/../temp/regsf.txt:1, from internal/c/qbx.cpp:1105: /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:18:1: note: to match this ‘{’ 18 | { | ^ In file included from internal/c/qbx.cpp:2: internal/c/common.h:97:21: error: expected unqualified-id before ‘-’ token 97 | # define QB_TRUE -1 | ^ /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:19:5: note: in expansion of macro ‘QB_TRUE’ 19 | QB_TRUE = -1, | ^~~~~~~ In file included from internal/c/../temp/regsf.txt:1, from internal/c/qbx.cpp:1105: /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:21:1: error: expected declaration before ‘}’ token 21 | }; | ^ In file included from internal/c/qbx.cpp:2: /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h: In function ‘qb_bool __init_raylib()’: internal/c/common.h:97:22: error: invalid conversion from ‘int’ to ‘qb_bool’ [-fpermissive] 97 | # define QB_TRUE -1 | ^ | | | int /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:1428:16: note: in expansion of macro ‘QB_TRUE’ 1428 | return QB_TRUE; | ^~~~~~~ internal/c/common.h:96:22: error: invalid conversion from ‘int’ to ‘qb_bool’ [-fpermissive] 96 | # define QB_FALSE 0 | ^ | | | int /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:1446:24: note: in expansion of macro ‘QB_FALSE’ 1446 | return QB_FALSE; | ^~~~~~~~ internal/c/common.h:96:22: error: invalid conversion from ‘int’ to ‘qb_bool’ [-fpermissive] 96 | # define QB_FALSE 0 | ^ | | | int /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:1979:16: note: in expansion of macro ‘QB_FALSE’ 1979 | return QB_FALSE; | ^~~~~~~~ internal/c/common.h:97:22: error: invalid conversion from ‘int’ to ‘qb_bool’ [-fpermissive] 97 | # define QB_TRUE -1 | ^ | | | int /mnt/LocalNAS4/LocalNAS/QbasicPrograms/raylib-64/include/raylib.h:1986:12: note: in expansion of macro ‘QB_TRUE’ 1986 | return QB_TRUE; | ^~~~~~~ make: *** [Makefile:388: internal/c/qbx.o] Error 1 make: *** Waiting for unfinished jobs....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.