r/raylib

I built a new fast and portable texture atlas builder with a LibGDX exporter
▲ 94 r/raylib+8 crossposts

I built a new fast and portable texture atlas builder with a LibGDX exporter

Hey everyone, I was building this tool for my internal use, and thought I would spin it off as a full tool and sell it in case it was useful for anyone else. I wanted something extremely fast and with good CLI integration, and something very portable as well. So that's what I built, in Zig with a Dear ImGui interface.

I am mostly focusing on code-first environments right now, like LibGDX. This is the exporter I use for my own projects in Haxe/Heaps.io, as it uses the LibGDX format.

https://clydegames.itch.io/packrat

Anyway, thanks for checking it out. Let me know what you think.

u/CLYDEgames — 1 day ago
▲ 36 r/raylib

Cool pong game I made with Raylib and my barely finished game framework

I was bored so I started working on a mini "game framework" to see how far I could get and what I could make. This isn't that impressive but I just wanted to show it. It has a basic components and scenes working. ignore the awful gameplay.

u/Key_Art_5590 — 2 days ago
▲ 5 r/raylib

How to create a working fullscreen?

I've just started using raylib, and I can't get the ToggleFullscreen or the ToggleBorderlessWindowed functions to work properly. Whenever I use them i can never alt-tab out of them. How do I fix this?

reddit.com
u/Buffy_Boi — 3 days ago
▲ 103 r/raylib+2 crossposts

Experimenter with better 3d models, animations are tough

Decided to implement better models but animations are still rough :)

My hats off to professional animators, without free packs this would be impossible for me :(

u/Responsible_Mine894 — 4 days ago
▲ 1 r/raylib

Minecraft clone. No cubes are drawn only models and I added a render distance yet it still lags. Why?

MAIN python file

#Recreating Minecraft in Raylib part 2: Indev
#To Do:
#1D A chunk and block class - Easy although I fear it lags my game
#2D 2d stuff like hearts, inventory - Hearts cube was fine but
#3D Better placing and destroying physics - Used screen center rather than where the player mouse was
#4D Jumping/Gravity - Forgot to set gravity to the oppposite of its power. Kept setting it to 0 and the player would just slow down rather than fall
#5 Collison with blocks
#6D Make multiple chunks
#7D Improve preformance with meshes and instances (fking what?) - We added the set config flags line we guchi for bow
#8 Day night cycle - More annoying than I could ever imagine
#9D Leaves - Not too hard just annoying didnt make too many either.
# Link to making a 3d texture atlas good luck bro https://www.raylib.com/examples/shaders/loader.html?name=shaders_texture_tiling

import pyray as pr
import math
import random
import asyncio
import Block
import Chunk
#Mixer
import pygame as pg
pg.init()
pg.mixer.init()

async def main():
pr.set_config_flags(pr.FLAG_VSYNC_HINT)

pr.init_window(800, 600, "Minecraft 0.2")
pr.disable_cursor()
pr.init_audio_device()

#Camera
camera = pr.Camera3D((4, 3, 4), (1, 0.5, 1), (0, 1, 0), 100, pr.CAMERA_PERSPECTIVE)
cameraMode = pr.CAMERA_FIRST_PERSON
#DayNight cycle
day_night = "nan"
sky_cycle_add_inc = 200
sky_cycle_cc = 0
day_night_level = 0.0
#Player
player = pr.Vector3(camera.position.x, camera.position.y, camera.position.z)
# model
player_size = pr.Vector3(0.5, 3, 0.5)
player_mesh = pr.gen_mesh_cube(1.0, 4.0, 1.0)
player_model = pr.load_model_from_mesh(player_mesh)
player_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].color = pr.BLUE
# gravity
gravity = 0
grav_vel = 0.05
jumpH = 2
#UI
# Hearts
hearts = []
heart_x = 100
# make hearts
for i in range(10):
new_heart = pr.Rectangle(heart_x, pr.get_screen_height() - 140, 30, 30)
heart_x += 35
hearts.append(new_heart)
# Inventory
inventory = []
inventory_x = 100
for i in range(10):
new_i = pr.Rectangle(inventory_x, pr.get_screen_height() - 100, 60, 60)
inventory_x += 60
inventory.append(new_i)
#World
world_size = 3
# Chunks
chunks = []
chunk_x = 1
chunk_z = 1
chunk_size = 16
# Blocks
blocks = []
block_size = pr.Vector3(1, 1, 1)
# make chunks
for z in range(world_size):
for x in range(world_size):
new_chunk = Chunk.chunk(chunk_x, 1, chunk_z, chunk_size, blocks, block_size)
chunks.append(new_chunk)
chunk_x += chunk_size
chunk_x = 1
chunk_z += chunk_size

#Textures
# Atlas
#atlas_texture = pr.Texture2D(pr.load_texture("Assets/Images/textures/texture_atlas.png"))
# Grass texture
grass_mesh = pr.gen_mesh_cube(1, 1, 1)
grass_model = pr.load_model_from_mesh(grass_mesh)
grass_texture = pr.load_texture("Assets/Images/textures/grass_tex.jpeg")
grass_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = grass_texture
# Stone texture
stone_mesh = pr.gen_mesh_cube(1, 1, 1)
stone_model = pr.load_model_from_mesh(stone_mesh)
stone_texture = pr.load_texture("Assets/Images/textures/stone_tex.png")
stone_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = stone_texture
# Wood texture
wood_mesh = pr.gen_mesh_cube(1, 1, 1)
wood_model = pr.load_model_from_mesh(wood_mesh)
wood_texture = pr.load_texture("Assets/Images/textures/wood_tex.jpeg")
wood_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = wood_texture
# Leaves texture
leaves_mesh = pr.gen_mesh_cube(1, 1, 1)
leaves_model = pr.load_model_from_mesh(leaves_mesh)
leaves_texture = pr.load_texture("Assets/Images/textures/leaves_tex.png")
leaves_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = leaves_texture
# Planks texture
plank_mesh = pr.gen_mesh_cube(1, 1, 1)
plank_model = pr.load_model_from_mesh(plank_mesh)
plank_texture = pr.load_texture("Assets/Images/textures/plank_tex.png")
plank_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = plank_texture
# Water texture
water_mesh = pr.gen_mesh_cube(1, 1, 1)
water_model = pr.load_model_from_mesh(water_mesh)
water_texture = pr.load_texture("Assets/Images/textures/water_tex.jpeg")
water_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = water_texture
# Heart
"""heart_image = pr.Image(pr.load_image("Assets/Images/heart_tex.png"))
heart_texture = pr.Texture2D(pr.load_texture_from_image(heart_image))"""

while not pr.window_should_close():
pr.update_camera(camera, cameraMode)
#Interact with blocks
screenCenter = pr.Vector2(float(pr.get_screen_width()/2), float(pr.get_screen_height()/2))
ray = pr.get_screen_to_world_ray(screenCenter, camera)
for block in blocks:
# bounding box for collison
block_box = pr.BoundingBox(pr.Vector3(block.x - block_size.x/2, block.y - block_size.y/2, block.z - block_size.z/2),
pr.Vector3(block.x + block_size.x/2, block.y + block_size.y/2, block.z + block_size.z/2))
mouse_ray_collison = pr.get_ray_collision_box(ray, block_box)
#Interacting with block
# mouse looking at block
if (mouse_ray_collison.hit):
# delete block
if (pr.is_mouse_button_pressed(pr.MOUSE_BUTTON_LEFT)):
blocks.remove(block)
# new block
if (pr.is_mouse_button_pressed(pr.MOUSE_BUTTON_RIGHT)):
new_block = Block.block(block.x, block.y + 1, block.z, block_size, "plank")
blocks.append(new_block)

pr.begin_drawing()
pr.clear_background(pr.SKYBLUE)
#Draw
#3D stuff
pr.begin_mode_3d(camera)

#Player
# draw
player = pr.Vector3(camera.position.x, camera.position.y, camera.position.z)
# gravity
gravity += grav_vel
camera.position.y -= gravity
camera.target.y -= gravity
# reset position
if (pr.is_key_pressed(pr.KEY_R)):
camera.position = pr.Vector3( 4, 4, 4)
gravity = -grav_vel
#Blocks
for block in blocks:
# Player collison
if pr.check_collision_boxes(pr.BoundingBox(pr.Vector3(player.x - player_size.x/2, player.y - player_size.y/2, player.z - player_size.z),
pr.Vector3(player.x + player_size.x/2, player.y + player_size.y/2, player.z + player_size.z/2)),
pr.BoundingBox(pr.Vector3(block.x - block_size.x/2, block.y - block_size.y/2, block.z - block_size.z/2),
pr.Vector3(block.x + block_size.x/2, block.y + block_size.y/2, block.z + block_size.z/2))):
# execption
if (block.type != "water"):
gravity = -grav_vel
if (pr.is_key_pressed(pr.KEY_SPACE)):
gravity -= jumpH

#Draw chunks
for chunk in chunks:
chunk.draw(camera, grass_model, stone_model, wood_model, leaves_model, plank_model, water_model)

#Draw player
#pr.draw_cube(player, player_size.x, player_size.y, player_size.z, pr.BLUE)
pr.draw_model(player_model, pr.Vector3(camera.position.x, camera.position.y, camera.position.z) , 1, pr.WHITE)

pr.end_mode_3d()

#2D stuff
#Day night cycle
if (day_night == "day"):
sky_cycle_cc += 1
if (sky_cycle_cc >= sky_cycle_add_inc):
day_night_level += 0.1
sky_cycle_cc = 0
if (day_night_level == 0.5):
day_night == "night"
if (day_night == "night"):
sky_cycle_cc += 1
if (sky_cycle_cc >= sky_cycle_add_inc):
day_night_level -= 0.1
sky_cycle_cc = 0
if (day_night_level == 0.0):
day_night == "day"
pr.draw_rectangle(0, 0, pr.get_screen_width(), pr.get_render_height(), pr.fade(pr.BLACK, day_night_level))
#UI
# Crosshair
pr.draw_rectangle(int(pr.get_screen_width()/2), int(pr.get_screen_height()/2), 2, 10, pr.WHITE)
pr.draw_rectangle(int(pr.get_screen_width()/2) - 4, int(pr.get_screen_height()/2) + 4, 10, 2, pr.WHITE)
# Hearts
for ht in hearts:
pr.draw_rectangle(int(ht.x), int(ht.y), int(ht.width), int(ht.height), pr.RED)
#pr.draw_texture(heart_texture, int(ht.x), int(ht.y), pr.WHITE)
# Inventory
for iv in inventory:
pr.draw_rectangle_lines_ex(pr.Rectangle(int(iv.x), int(iv.y), int(iv.width), int(iv.height)), 8.0, pr.GRAY)

# Numbers
pr.draw_fps(10, 10)

pr.end_drawing()
await asyncio.sleep(0)

#Exit game
else:
pr.unload_model(grass_model)
pr.unload_model(stone_model)
pr.unload_model(wood_model)
pr.unload_model(leaves_model)
pr.unload_model(plank_model)
pr.unload_model(water_model)
#pr.unload_texture(heart_texture)
# Reset window if fullscreen
if (pr.is_window_fullscreen()):
pr.toggle_fullscreen() # Exit fullscreen
pr.set_window_size(1920, 1080); # Reset to desired default resolution

pr.close_window()

asyncio.run(main())#Recreating Minecraft in Raylib part 2: Indev
#To Do:
#1D A chunk and block class - Easy although I fear it lags my game
#2D 2d stuff like hearts, inventory - Hearts cube was fine but
#3D Better placing and destroying physics - Used screen center rather than where the player mouse was
#4D Jumping/Gravity - Forgot to set gravity to the oppposite of its power. Kept setting it to 0 and the player would just slow down rather than fall
#5 Collison with blocks
#6D Make multiple chunks
#7D Improve preformance with meshes and instances (fking what?) - We added the set config flags line we guchi for bow
#8 Day night cycle - More annoying than I could ever imagine
#9D Leaves - Not too hard just annoying didnt make too many either.
# Link to making a 3d texture atlas good luck bro https://www.raylib.com/examples/shaders/loader.html?name=shaders_texture_tiling

import pyray as pr
import math
import random
import asyncio
import Block
import Chunk
#Mixer
import pygame as pg
pg.init()
pg.mixer.init()

async def main():
pr.set_config_flags(pr.FLAG_VSYNC_HINT)

pr.init_window(800, 600, "Minecraft 0.2")
pr.disable_cursor()
pr.init_audio_device()

#Camera
camera = pr.Camera3D((4, 3, 4), (1, 0.5, 1), (0, 1, 0), 100, pr.CAMERA_PERSPECTIVE)
cameraMode = pr.CAMERA_FIRST_PERSON
#DayNight cycle
day_night = "nan"
sky_cycle_add_inc = 200
sky_cycle_cc = 0
day_night_level = 0.0
#Player
player = pr.Vector3(camera.position.x, camera.position.y, camera.position.z)
# model
player_size = pr.Vector3(0.5, 3, 0.5)
player_mesh = pr.gen_mesh_cube(1.0, 4.0, 1.0)
player_model = pr.load_model_from_mesh(player_mesh)
player_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].color = pr.BLUE
# gravity
gravity = 0
grav_vel = 0.05
jumpH = 2
#UI
# Hearts
hearts = []
heart_x = 100
# make hearts
for i in range(10):
new_heart = pr.Rectangle(heart_x, pr.get_screen_height() - 140, 30, 30)
heart_x += 35
hearts.append(new_heart)
# Inventory
inventory = []
inventory_x = 100
for i in range(10):
new_i = pr.Rectangle(inventory_x, pr.get_screen_height() - 100, 60, 60)
inventory_x += 60
inventory.append(new_i)
#World
world_size = 3
# Chunks
chunks = []
chunk_x = 1
chunk_z = 1
chunk_size = 16
# Blocks
blocks = []
block_size = pr.Vector3(1, 1, 1)
# make chunks
for z in range(world_size):
for x in range(world_size):
new_chunk = Chunk.chunk(chunk_x, 1, chunk_z, chunk_size, blocks, block_size)
chunks.append(new_chunk)
chunk_x += chunk_size
chunk_x = 1
chunk_z += chunk_size

#Textures
# Atlas
#atlas_texture = pr.Texture2D(pr.load_texture("Assets/Images/textures/texture_atlas.png"))
# Grass texture
grass_mesh = pr.gen_mesh_cube(1, 1, 1)
grass_model = pr.load_model_from_mesh(grass_mesh)
grass_texture = pr.load_texture("Assets/Images/textures/grass_tex.jpeg")
grass_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = grass_texture
# Stone texture
stone_mesh = pr.gen_mesh_cube(1, 1, 1)
stone_model = pr.load_model_from_mesh(stone_mesh)
stone_texture = pr.load_texture("Assets/Images/textures/stone_tex.png")
stone_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = stone_texture
# Wood texture
wood_mesh = pr.gen_mesh_cube(1, 1, 1)
wood_model = pr.load_model_from_mesh(wood_mesh)
wood_texture = pr.load_texture("Assets/Images/textures/wood_tex.jpeg")
wood_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = wood_texture
# Leaves texture
leaves_mesh = pr.gen_mesh_cube(1, 1, 1)
leaves_model = pr.load_model_from_mesh(leaves_mesh)
leaves_texture = pr.load_texture("Assets/Images/textures/leaves_tex.png")
leaves_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = leaves_texture
# Planks texture
plank_mesh = pr.gen_mesh_cube(1, 1, 1)
plank_model = pr.load_model_from_mesh(plank_mesh)
plank_texture = pr.load_texture("Assets/Images/textures/plank_tex.png")
plank_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = plank_texture
# Water texture
water_mesh = pr.gen_mesh_cube(1, 1, 1)
water_model = pr.load_model_from_mesh(water_mesh)
water_texture = pr.load_texture("Assets/Images/textures/water_tex.jpeg")
water_model.materials[0].maps[pr.MATERIAL_MAP_DIFFUSE].texture = water_texture
# Heart
"""heart_image = pr.Image(pr.load_image("Assets/Images/heart_tex.png"))
heart_texture = pr.Texture2D(pr.load_texture_from_image(heart_image))"""

while not pr.window_should_close():
pr.update_camera(camera, cameraMode)
#Interact with blocks
screenCenter = pr.Vector2(float(pr.get_screen_width()/2), float(pr.get_screen_height()/2))
ray = pr.get_screen_to_world_ray(screenCenter, camera)
for block in blocks:
# bounding box for collison
block_box = pr.BoundingBox(pr.Vector3(block.x - block_size.x/2, block.y - block_size.y/2, block.z - block_size.z/2),
pr.Vector3(block.x + block_size.x/2, block.y + block_size.y/2, block.z + block_size.z/2))
mouse_ray_collison = pr.get_ray_collision_box(ray, block_box)
#Interacting with block
# mouse looking at block
if (mouse_ray_collison.hit):
# delete block
if (pr.is_mouse_button_pressed(pr.MOUSE_BUTTON_LEFT)):
blocks.remove(block)
# new block
if (pr.is_mouse_button_pressed(pr.MOUSE_BUTTON_RIGHT)):
new_block = Block.block(block.x, block.y + 1, block.z, block_size, "plank")
blocks.append(new_block)

pr.begin_drawing()
pr.clear_background(pr.SKYBLUE)
#Draw
#3D stuff
pr.begin_mode_3d(camera)

#Player
# draw
player = pr.Vector3(camera.position.x, camera.position.y, camera.position.z)
# gravity
gravity += grav_vel
camera.position.y -= gravity
camera.target.y -= gravity
# reset position
if (pr.is_key_pressed(pr.KEY_R)):
camera.position = pr.Vector3( 4, 4, 4)
gravity = -grav_vel
#Blocks
for block in blocks:
# Player collison
if pr.check_collision_boxes(pr.BoundingBox(pr.Vector3(player.x - player_size.x/2, player.y - player_size.y/2, player.z - player_size.z),
pr.Vector3(player.x + player_size.x/2, player.y + player_size.y/2, player.z + player_size.z/2)),
pr.BoundingBox(pr.Vector3(block.x - block_size.x/2, block.y - block_size.y/2, block.z - block_size.z/2),
pr.Vector3(block.x + block_size.x/2, block.y + block_size.y/2, block.z + block_size.z/2))):
# execption
if (block.type != "water"):
gravity = -grav_vel
if (pr.is_key_pressed(pr.KEY_SPACE)):
gravity -= jumpH

#Draw chunks
for chunk in chunks:
chunk.draw(camera, grass_model, stone_model, wood_model, leaves_model, plank_model, water_model)

#Draw player
#pr.draw_cube(player, player_size.x, player_size.y, player_size.z, pr.BLUE)
pr.draw_model(player_model, pr.Vector3(camera.position.x, camera.position.y, camera.position.z) , 1, pr.WHITE)

pr.end_mode_3d()

#2D stuff
#Day night cycle
if (day_night == "day"):
sky_cycle_cc += 1
if (sky_cycle_cc >= sky_cycle_add_inc):
day_night_level += 0.1
sky_cycle_cc = 0
if (day_night_level == 0.5):
day_night == "night"
if (day_night == "night"):
sky_cycle_cc += 1
if (sky_cycle_cc >= sky_cycle_add_inc):
day_night_level -= 0.1
sky_cycle_cc = 0
if (day_night_level == 0.0):
day_night == "day"
pr.draw_rectangle(0, 0, pr.get_screen_width(), pr.get_render_height(), pr.fade(pr.BLACK, day_night_level))
#UI
# Crosshair
pr.draw_rectangle(int(pr.get_screen_width()/2), int(pr.get_screen_height()/2), 2, 10, pr.WHITE)
pr.draw_rectangle(int(pr.get_screen_width()/2) - 4, int(pr.get_screen_height()/2) + 4, 10, 2, pr.WHITE)
# Hearts
for ht in hearts:
pr.draw_rectangle(int(ht.x), int(ht.y), int(ht.width), int(ht.height), pr.RED)
#pr.draw_texture(heart_texture, int(ht.x), int(ht.y), pr.WHITE)
# Inventory
for iv in inventory:
pr.draw_rectangle_lines_ex(pr.Rectangle(int(iv.x), int(iv.y), int(iv.width), int(iv.height)), 8.0, pr.GRAY)

# Numbers
pr.draw_fps(10, 10)

pr.end_drawing()
await asyncio.sleep(0)

#Exit game
else:
pr.unload_model(grass_model)
pr.unload_model(stone_model)
pr.unload_model(wood_model)
pr.unload_model(leaves_model)
pr.unload_model(plank_model)
pr.unload_model(water_model)
#pr.unload_texture(heart_texture)
# Reset window if fullscreen
if (pr.is_window_fullscreen()):
pr.toggle_fullscreen() # Exit fullscreen
pr.set_window_size(1920, 1080); # Reset to desired default resolution

pr.close_window()

asyncio.run(main())

u/False-Increase4614 — 4 days ago
▲ 6 r/raylib

C Polymorphism, Partial redrawing (clipping?) and double-buffer update for my UI

Hello everyone,

Last time here I posted several questions in relation to creating a retained-mode UI. So far, the project has been going on smoothly, and I've taken a similar approach to what zraygui does (code from zraygui):

struct _widget {
    Layout *parent;
    Rectangle rect;
    char *label;
    WidgetType type;
    Component *component;
    bool visible;
    bool active;
    MouseEvent widgetStatus;
    MouseListeners mouseListener;
};

The widgets share a common struct type Widget, but polymorphism happens inside the Component. It is an empty struct type, and for each type of widget, a pointer to their unique structs is cast as Component* into component. Then when manipulating the widget, the Component* is cast back to the original pointer type, enabling access to the fields.

I found this approach very smart, and I plan on implementing a similar thing (unless another better polymorphism exists in C). In my Widget struct, I have

typedef struct Widget {
  Frame* parent;
  Rect bounds;
  bool active;
  void *
  void (*draw)(Widget *w);
}

Implementing partial rendering seemed easy, just redraw the exact area indicated by bounds, until i remembered I have to call EndDrawing() which swaps buffers. Hence, the updated widget will only exist on one buffer, and If I don't call EndDrawing(), inputs will not be polled.

I would like to create something similar to FLTK, which only renders the parts that need to be updated (AFAIK, I only studied a small part of the code yet, but it seems very interesting to learn about performant desktop UI systems)

So I have two ideas :
- Ditch the double buffer and write a custom "EndDrawing()" which does not swap but keeps all other functionality

- Draw to a render texture that I apply on both buffers. While exploring this idea, I realized that it could be beneficial for tooltips and floating windows, as they could be other textures overlaid on the main one.

reddit.com
u/Any-Fox-1822 — 4 days ago
▲ 0 r/raylib

How far should I learn OpenGL?

I'm learning Raylib because I don't really like dealing with more conventional game engines. I feel more comfortable being able to build things in a more direct way, without having to rely on 600 different types of nodes that I don't understand in Godot, or menus within menus full of features I'll never use like in Unity.

IA generated this code for a simple camera in Go:

rl.BeginMode2D(c.Camera)
{
    rl.PushMatrix()
    {
        rl.Translatef(0, 25*50, 0)
        rl.Rotatef(90, 1, 0, 0)
    }
    rl.PopMatrix()
}
rl.EndMode2D()

However, I don't feel comfortable using code that I don't understand. I still haven't managed to understand what Mode2D or a Matrix actually are, and why it needs to be pushed and popped, when i try to find any good answer i just find links to OpenGL articles.

I don't know if I'm failing on find the right documentation, or if I actually need to learn some OpenGL to use Raylib understanding what I'm doing.

reddit.com
u/DromedarioDeChapeu — 4 days ago
▲ 4 r/raylib

a lot of "undefined reference"s even when raylib is linked

I am using devuan testing that is up to date with the latest raylib version, a test program does compile and link and checking with ldd all the stuff is properly linked.

With my makefile

# Tuxanci 2 - A first person shooter
# Copyright (C) 2025-2026  Connor Thomson
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Enable debug. true or false?
DEBUG    ?= false

# Paths
SRC      := src
INCLUDE  := include
BUILD    ?= build
TARGET   := tuxanci2

# clang might work too
CSTD     ?= c99

CFLAGS   := -std=$(CSTD) \
            -lraylib \
			-Wall \
			-Wextra \
			-Werror \
			-pedantic \
			-pedantic-errors \
			-I$(INCLUDE)

# If DEBUG is true, enable debugging stuff
ifeq '$(DEBUG)' 'true'
# Define DEBUG
FLAGS    += -DDEBUG

# Compile for debugging
CFLAGS   += -O0 -g
endif

# Find all C source files
CSRCS := $(shell find src -name "*.c")

all: $(TARGET)

$(BUILD):
	mkdir -p $(BUILD)

$(TARGET): $(BUILD)
	$(CC) $(CFLAGS) $(CSRCS) -o $(TARGET)

# Remove $(BUILD)
clean:
	rm -rf $(BUILD)

i get

connor@dell:~/tuxanci2$ make
cc -std=c99 -lraylib -Wall -Wextra -Werror -pedantic -pedantic-errors -Iinclude src/main.c src/monitor.c src/window.c src/log.c -o tuxanci2
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccG6XtfP.o: in function `monitorUpdate':
monitor.c:(.text+0x5): undefined reference to `GetCurrentMonitor'
/usr/bin/x86_64-linux-gnu-ld.bfd: monitor.c:(.text+0x28): undefined reference to `GetMonitorWidth'
/usr/bin/x86_64-linux-gnu-ld.bfd: monitor.c:(.text+0x3b): undefined reference to `GetMonitorHeight'
/usr/bin/x86_64-linux-gnu-ld.bfd: monitor.c:(.text+0x4e): undefined reference to `GetMonitorRefreshRate'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccG6XtfP.o: in function `monitorInit':
monitor.c:(.text+0x60): undefined reference to `GetCurrentMonitor'
/usr/bin/x86_64-linux-gnu-ld.bfd: monitor.c:(.text+0x73): undefined reference to `GetMonitorWidth'
/usr/bin/x86_64-linux-gnu-ld.bfd: monitor.c:(.text+0x86): undefined reference to `GetMonitorHeight'
/usr/bin/x86_64-linux-gnu-ld.bfd: monitor.c:(.text+0x99): undefined reference to `GetMonitorRefreshRate'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccN6CUEt.o: in function `windowSetFullscreen':
window.c:(.text+0x19): undefined reference to `SetWindowState'
/usr/bin/x86_64-linux-gnu-ld.bfd: window.c:(.text+0x25): undefined reference to `ClearWindowState'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccN6CUEt.o: in function `windowUpdateWindowValues':
window.c:(.text+0x31): undefined reference to `WindowShouldClose'
/usr/bin/x86_64-linux-gnu-ld.bfd: window.c:(.text+0x5c): undefined reference to `SetWindowSize'
/usr/bin/x86_64-linux-gnu-ld.bfd: window.c:(.text+0x8d): undefined reference to `SetWindowSize'
/usr/bin/x86_64-linux-gnu-ld.bfd: window.c:(.text+0xb6): undefined reference to `SetTargetFPS'
/usr/bin/x86_64-linux-gnu-ld.bfd: window.c:(.text+0xe4): undefined reference to `SetWindowTitle'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccN6CUEt.o: in function `windowInit':
window.c:(.text+0x169): undefined reference to `InitWindow'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccy7ca6B.o: in function `logInit':
log.c:(.text+0xa): undefined reference to `SetTraceLogLevel'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccy7ca6B.o: in function `logWarning':
log.c:(.text+0x4f): undefined reference to `TraceLog'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccy7ca6B.o: in function `logError':
log.c:(.text+0x7e): undefined reference to `TraceLog'
/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccy7ca6B.o: in function `logFatal':
log.c:(.text+0xad): undefined reference to `TraceLog'
collect2: error: ld returned 1 exit status
make: *** [Makefile:56: tuxanci2] Error 1
connor@dell:~/tuxanci2$ 
reddit.com
u/Bubbly_Tough_284 — 3 days ago
▲ 38 r/raylib+1 crossposts

Made my first raylib game demo at 15 years old. Looking for feedback!

Link to game: https://kc-games-studio.itch.io/avoid-b

Hey everyone!

I've been working on my first larger game project in raylib + C++, and I wanted to share the demo with the community.

It's a small underwater action game where you fight enemies, collect powerups, survive waves, and take on boss fights. It includes features like:

  • Multiple enemy types
  • Boss battles
  • Powerups (shield, speed boost, double coins, healing)
  • Melee and ranged combat
  • Controller support
  • Level progression system
  • Custom UI, sounds, and animations

This is still just a demo version. The full version will be available soon, and I'm continuing to add content, improve the gameplay, and polish the code.

Also, I'm not even 16 years old yet, so I know the game isn't perfect and there are probably a lot of things that could be improved. I'm still learning game development and C++, which is one of the reasons I'm posting here.

I'd really appreciate any feedback, whether it's about:

  • Gameplay
  • Code structure
  • Performance
  • Art/UI
  • General raylib development tips

Thanks for checking it out!

u/Pale-Candidate-4122 — 5 days ago
▲ 7 r/raylib

Raylib Extensions

If you share my view that raylib is somewhat low level where a lot one has to build themselves.

Which is 1 of the benefits of raylib having control of everything yourself.

Please share what kind of high level libraries as extensions to raylib would you be interested in seeing built so that it can be imported and used where only raylib is the library's only dependency.

Based off upvotes I will attempt to build library extension for raylib where raylib is the library's only dependency.

If there is already a resource with libraries built on top of raylib please share.

If you have built one and open sourced already please share below for others to find.

reddit.com
u/the3dwin — 5 days ago
▲ 0 r/raylib

Raylib AI Agent SKILL

Just found this Awesome Library RayLib for building video games and could not believe how fast I got to build and run a game.

Also from the little I know about C programming the games run fast.

Wanted to contribute to this project so had AI build me an AI agent SKILL.md that can be used to build games using Raylib:

I posted it on the GitHub repo so please go add reaction emojies or comment.

https://github.com/raysan5/raylib/issues/6065

Comment below your experience, let me know how well it is working or anything you think the skill is missing.

u/the3dwin — 6 days ago
▲ 29 r/raylib+1 crossposts

[PoG] Decided on name and working on demo

Decided on name and now working on demo :) Anyone willing to play test early are welcome !

Lots of free placeholder music and assets still :)

Here is a quick demo loop :)

u/Responsible_Mine894 — 6 days ago
▲ 37 r/raylib

Some screenshots of my game Conflict 3049 - improvements continue, game is still available on itch with source code and shader code included

Game Link: https://matty77.itch.io/conflict-3049

The 3d assets are mainly purchased from 3drt.com and from the itch.io asset store.

The audio assets are a mix of purchased, generative AI and self made effects.

The source code is C# using raylib_cs and the download inlcudes all the relevant source needed to compile and run the game.

It's single player, a set of last stand scenarios.

There's some options in game that aren't documented : Press F1 to bring up a console menu of sorts for debugging but it lets you run the game slightly different if you choose to. Press F5 to bring up immersive view mode which shows scenes like the above rather than the traditional RTS view that normally shows.

The config file lets you change things as well.

The game runs on modern PCs and also I can get it running on my older 2014 potato PC with some minor config changes at a reasonable framerate.

u/Haunting_Art_6081 — 6 days ago
▲ 6 r/raylib

Retained-mode UI rendering with raylib : Where to start ?

Hello everyone,

I'm working on a retained mode UI library with a similar look and feel to raygui, either in C++ with classes and interfaces, or plain C with function pointers if I really feel adventurous. This isn't meant to be a serious project, more of a proof of concept.

However I kind of feel lost as to what I should implement first. So here are a few questions that i'd like to ask :

I would like the library to only draw when necessary, that is only when events occur rather than constantly. How does raylib handle events, and are there debug options to print all input ? PollInputEvents() is basically a per-backend implementation.

Are there widget categories I should try to go after first (besides the button) ?

Do you have resources on building such interfaces ? I found a book called Developing User Interfaces by Dan Olsen, but it isn't available on the Internet Archive.

reddit.com
u/Any-Fox-1822 — 7 days ago
▲ 22 r/raylib+2 crossposts

Odin OpenXr with Raylib

LINK: https://github.com/cody977/odin-openxr-raylib

--DISCLAIMER--

I am only a hobbyist programmer and wanted to use Odin for VR so I used Claude to get OpenXr working with Raylib. Everything is AI generated (since I could not do it alone). Has been tested and working on Windows 11 with Quest3 using Steam Link.

I will be using this to make my own VR engine but sharing as someone smarter than me can improve on it and bring the VR world to Odin.

--ABOUT--

A minimal PC VR application in Odin. raylib provides the OpenGL context and all the drawing; OpenXR provides head pose, per-eye projection, controller input, and the swapchain images the compositor displays.

The trick that makes it work: raylib's RenderTexture2D is a plain struct holding OpenGL object ids. Nothing requires those ids to come from raylib, so we build a framebuffer around the texture OpenXR hands us. From that point on BeginTextureMode renders straight into the headset's swapchain, and ordinary raylib draw calls — DrawModelEx, materials, custom shaders — work unchanged.

Features

  • Stereo rendering with correct asymmetric per-eye projection
  • Head and controller tracking
  • Full Meta Touch input: triggers, grips, thumbsticks, A/B/X/Y, menu, haptics
  • Desktop mirror window
  • ~900 lines across 10 files, no engine, no abstraction layer

Requirements

Windows, an OpenXR runtime (SteamVR or Meta Link), and a tethered headset. Odin has no Android target, so standalone Quest builds are not possible.

Setup

  1. odin run . -out:editor.exe

scene.odin is the file you edit; everything prefixed xr_ is plumbing. See the guide PDF for how it all fits together and a symptom-to-cause table for the failures that are silent in VR.

Just download the folder and run it, ensure that your headset is connected and steam VR is running first.

u/Huge-Square-3197 — 7 days ago
▲ 8 r/raylib

OS dark title bar (CPP)?

so im using cpp, and im working on a game and i want to ask if it is possible to make the os title bar look dark themed?

reddit.com
u/NR_5tudio-nezar- — 7 days ago
▲ 38 r/raylib+1 crossposts

I'm building a custom 3D game engine from scratch using C++ and Raylib. What do you think?

Hi, I am using C++ and Raylib to achieve this; the 3D game engine's standout features so far include the ability to create Lua scripts to modify object behavior and the capacity to add 3D models in formats like .obj, gltf, etc.

You can also export your creations as executables (.exe).

u/Pretty-Produce-6748 — 8 days ago
▲ 59 r/raylib+2 crossposts

Hey, I'm doing a TD game for linux, C, raylib, no assets.

I've been working on a little tower defense game in C with Raylib. Everything is code, no assets. Even the music sinthesis is procedural. Also, it is multithread.

I will upload a demo on itchio ere tomorrow dawn. (If life gives me the option).

u/silsen_ — 9 days ago