Jaylib - 1, Getting Started

John Gabriele

2020-12-30

Jaylib is a Janet binding to the wonderful Raylib graphics and game programming library.

To get started using Jaylib, first make sure you have Janet installed (latest release available at the Janet Downloads page). On GNU/Linux, building Janet from source and installing it with default settings will place everything Janet-related under /usr/local.

Installing Janet will provide you with the janet and jpm commands (in /usr/local/bin). jpm is the Janet package manager, and you’ll use it to install jaylib, which will automatically pull in and build raylib for you in the process. However, for that to work you’ll need to make sure you have build tools, plus some raylib build dependencies in place. On GNU/Linux, if you’re on Debian or Ubuntu this means you’ll need to make sure you’ve installed:

build-essential  # brings in compiler, make, etc.
libglfw3-dev
# libglu1-mesa-dev  <-- these get pulled
# libglx-dev        <-- in when you install
# libgl-dev         <-- libglfw3-dev
xorg-dev

(See the raylib wiki for more info on dependencies for your particular platform.) Next use jpm to install jaylib & raylib:

# jpm install jaylib

You’re now ready to roll. The jaylib readme contains a little hello-world jaylib program. Running that should give you a small window that looks something like:

Jaylib Hello World

When you run that app, your console should display some version info on the components upon which your program is built. Mine currently says:

INFO: Initializing raylib 3.0
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1920 x 1080
INFO:     > Render size:  800 x 400
INFO:     > Screen size:  800 x 400
INFO:     > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: OpenGL 3.3 Core profile supported
INFO: GL: OpenGL device information:
INFO:     > Vendor:   Intel Open Source Technology Center
INFO:     > Renderer: Mesa DRI Intel(R) HD Graphics 5000 (HSW GT3)
INFO:     > Version:  4.5 (Core Profile) Mesa 20.2.6
INFO:     > GLSL:     4.50
INFO: GL: Supported extensions count: 202
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: GL: Anisotropic textures filtering supported (max: 16X)
INFO: TEXTURE: [ID 1] Texture created successfully (1x1 - 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Compiled successfully
INFO: SHADER: [ID 2] Compiled successfully
INFO: SHADER: [ID 3] Program loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Internal vertex buffers initialized successfully in RAM (CPU)
INFO: RLGL: Internal vertex buffers uploaded successfully to VRAM (GPU)
INFO: RLGL: Default state initialized successfully
INFO: TEXTURE: [ID 2] Texture created successfully (128x128 - 1 mipmaps)
INFO: FONT: Default font loaded successfully
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 1] Unloaded default texture data from VRAM (GPU)
INFO: Window closed successfully

(Next up: Jaylib - 2, Docs)


Notice any errors, glaring omissions, or just clumsy wording? Please email me at approximately <jgabriele©fastmail·fm>. Thank you!