Raylib plugin

raylib is a simple and easy-to-use library to enjoy videogames programming. You can find more information about raylib at the raylib website

How to learn coding with raylib

“raylib does not provide the typical API documentation or a big set of tutorials. The library is designed to be minimalistic and be learned just from a cheatsheet with all required functionality and a big collection of examples to see how to use that functionality. Best way to learn to code is reading code.” [raylib website, Aug. 2022]

Many of the original raylib examples, which are written in C, were converted to SmallBASIC and are available on Github. To make it easier for you, you will find all the converted examples in the list below. If you are new to raylib it is best to start with the first example.

The original cheatsheet for C can be found here. A simple SmallBASIC version is available at Github.

How to setup SmallBASIC to use the raylib plugin

The raylib plugin is included in the release version of SmallBASIC. SmallBASIC should find the plugin automatically. If you have problems loading the plugin, you can copy the library (libraylib.dll or libraylib.so) to the folder of your BASIC file. Additionally you need the file raylibc.bas. If it is not found automatically, please copy it the folder of your BASIC file, too. You have also the option to give the full path to the plugin or to raylibc.bas with the ìmport command.

Since raylib uses its own window management, you cannot use it together with the SDL version of SmallBASIC (sbasicg.exe or sbasicg). Please use instead the console version (sbasic.exe or sbasic).

In Linux call: sbasic MyRaylibProgram.bas.

or if you are using the AppImage: SmallBASIC-Console_12.24-x86_64.AppImage MyRaylibProgram.bas

If you are working in Windows, then start your program with: sbasic.exe MyRaylibProgram.bas


Core examples









Structures and Variables


camera2D.target.x = 0
camera2D.target.y = 0
camera2D.offset.x = 0
camera2D.offset.y = 0
camera2D.rotation = 0
camera2D.zoom = 1


camera.position = [4, 2, 4]
camera.target = [0, 0, 0]
camera.up = [0, 1, 0]
camera.fovy = 60
camera.projection = c.CAMERA_PERSPECTIVE


position = [0, 0, 0]


rectangle.x = 0
rectangle.y = 0
rectangle.width = 100
rectangle.height = 100
rectangle = {x: 0, y: 0, width: 100, height: 100}
rectangle = [x, y, width, height]
rectangle = [0, 0, 100, 100]


vector2.x = 0
vector2.y = 0
vector2 = {x: 0, y: 0}
vector2 = [x, y]
vector2 = [0, 0]


vector3.x = 0
vector3.y = 0
vector3.z = 0
vector3 = {x: 0, y: 0, z: 0}
vector3 = [x, y, z]
vector3 = [0, 0, 0]