Skip to content

Instantly share code, notes, and snippets.

@Lightnet
Lightnet / raylib_hex01.c
Last active November 8, 2025 02:09
Sample raylib 5.5 hex bar.
/*********************************************************************
* raylib 5.5 + raygui – Hex-Bar Progress Bar (100% fill)
* gcc raylib_hex01.c -o hexbar -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
*********************************************************************/
#define RAYGUI_IMPLEMENTATION
#include "raylib.h"
#include "raymath.h"
#include "raygui.h"
#include <stdio.h>
@Lightnet
Lightnet / raylib_jolt_character.cpp
Created October 30, 2025 20:16
sample raylib jolt physics character controller test move and jump.
#define RAYLIB_IMPLEMENTATION // <-- tells raylib to include its source once
#include <raylib.h>
#include <Jolt/Jolt.h>
#include <Jolt/RegisterTypes.h>
#include <Jolt/Core/Factory.h>
#include "Jolt/Physics/PhysicsSettings.h"
#include <Jolt/Core/JobSystemThreadPool.h>
#include <Jolt/Physics/PhysicsSystem.h>
@Lightnet
Lightnet / raylib_ode_capsule_controller.c
Created October 27, 2025 22:16
raylib ODE capsule controller test.
#include "raylib.h"
#include <ode/ode.h>
#include <stdio.h>
#include <math.h> // Ensure math.h is included for PI
// Global ODE variables
dWorldID world;
dSpaceID space;
dJointGroupID contactgroup;
dGeomID floorGeom, cube1Geom, cube2Geom;
@Lightnet
Lightnet / README.md
Last active October 22, 2025 02:13
Sample raylib, flecs ODE cube controller test.

Note for cmake ODE must build first then raylib due to config in ODE conflicts.

raylib 5.5 ode 0.16.6 flecs v4.1.1

KEY_C = enable/disable mouse orbiting mouse motion to rotate camera Q and E keys to rotate the camera’s yaw left and right

@Lightnet
Lightnet / README.md
Last active October 20, 2025 22:15
Sample refine Raylib, Flecs, and raygui for transform 3D hierarchy.

I kept it simple but with the raygui it easy to debug to control transform to update real time.

// Transform3D component
typedef struct {
    Vector3 position;         // Local position
    Quaternion rotation;      // Local rotation
    Vector3 scale;            // Local scale
    Matrix localMatrix;       // Local transform matrix
    Matrix worldMatrix;       // World transform matrix
 bool isDirty; // Flag to indicate if transform needs updating
@Lightnet
Lightnet / raylib_flecs_ode_controller.c
Created October 18, 2025 06:01
Sample player controller move test for raylib, ode and flecs.
// flecs 4.1.1
// raylb 5.5
// ode 0.16.6
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "raylib.h"
#include "raymath.h"
#include "ode/ode.h"
#include "flecs.h"
@Lightnet
Lightnet / Flecs 4 Documentation for Hierarchical 3D Transformation Systems.md
Last active October 1, 2025 20:39
Flecs 4.x Documentation for Hierarchical 3D Transformation Systems

Flecs 4.x Documentation for Hierarchical 3D Transformation Systems

This guide outlines how to set up a hierarchical 3D transformation system using Flecs 4.x, focusing on correct entity-component-system (ECS) configuration, transformation order, and parent-child relationships. It is tailored for AI agents and developers building 3D applications (e.g., with OpenGL or other rendering APIs) where entities have position, rotation, and scale, and transformations are propagated through a parent-child hierarchy.Key Concepts1. Flecs Basics

  • Entities: Unique identifiers representing objects (e.g., a cube in a 3D scene).
  • Components: Data structures attached to entities (e.g., Transform3D for position, rotation, scale).
  • Systems: Functions that operate on entities with specific components, executed in a defined order (e.g., EcsPreUpdate, EcsOnUpdate).
  • Pairs: Relationships between entities, used for hierarchies (e.g., (EcsChildOf, ParentEntity) to denote a child-parent relationship).
  1. Hierarchical Transformat
@Lightnet
Lightnet / README.md
Created October 1, 2025 04:47
Sample SDL 3.2 Flecs 4.1 cimgui 1.92 cube test render.

Flecs: 4.1 Glad: 2.0.8 opengl: 330 sdl: 3.2 just sample test. cimgui: 1.92

This is just cube render set up test.

Sample test for getting the font working as cimgui conflict with font type from imgui.

rlgl_font.c main point.

raylib 5.5 cimgui

@Lightnet
Lightnet / raylib_picking.c
Last active September 26, 2025 22:51
Sample raylib 5.5 flecs 4.1 raygui picking single cube test.
// raylib 5.5
// flecs v4.1
// https://github.com/SanderMertens/flecs/blob/master/examples/c/systems/custom_pipeline/src/main.c
// right mouse toggle camera capture
// W,A,S,D = move camera when capture mouse
// escape to close app
// left mouse button to select cube
#include <stdio.h>
#include <flecs.h>