Skip to content

Instantly share code, notes, and snippets.

#include <raylib.h>
#include <raymath.h>
#include <stdint.h>
#define min(a, b) (a) < (b) ? (a) : (b)
#define max(a, b) (a) > (b) ? (a) : (b)
static void
GridFromHeightMap(Vector3 *grid_positions, // output grid
int32_t grid_width, // point count x axis
@Bigfoot71
Bigfoot71 / example.c
Last active August 20, 2025 20:58
Sound spatialization with raylib
#include <raylib.h>
#include <raymath.h>
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist)
{
// Calculate direction vector and distance between listener and sound source
Vector3 direction = Vector3Subtract(position, listener.position);
float distance = Vector3Length(direction);
// Apply logarithmic distance attenuation and clamp between 0-1
// --- Library --------------------------------------------------------------------------
#include <string.h>
#include <assert.h>
struct ui_box {int x,y,w,h;};
typedef unsigned long long ui_id;
struct ui_node {
int parent;
int lst, end, nxt;
int siz[2];