Skip to content

Instantly share code, notes, and snippets.

View Bigfoot71's full-sized avatar
👾

Le Juez Victor Bigfoot71

👾
View GitHub Profile
@Bigfoot71
Bigfoot71 / r3d_dds.c
Created September 5, 2025 16:40
DDS loader which was used in R3D
/*
* Copyright (c) 2025 Le Juez Victor
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose, including commercial
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not claim that you
@Bigfoot71
Bigfoot71 / instructions
Created August 21, 2025 06:46
gl-profiling
Get a glad header (4.6 core): https://gen.glad.sh/
Build with: `gcc prof.c -o prof -lSDL2`
@Bigfoot71
Bigfoot71 / debanding.frag
Created July 6, 2025 20:20
debanding used in bit-crush demo
#version 330 core
noperspective in vec2 vTexCoord;
uniform sampler2D uTexColor;
out vec4 FragColor;
float GradientNoise(in vec2 fragCoord)
{
// from: https://www.shadertoy.com/view/lfyBWK
return fract(52.9829189 * fract(dot(fragCoord, vec2(0.06711056, 0.00583715))));
@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
@Bigfoot71
Bigfoot71 / idman.hpp
Created November 17, 2024 01:11
A template class that generates unique IDs and recycles removed ones for reuse.
// This code is distributed under the Unlicense license.
// For more details, please visit https://unlicense.org/
#ifndef IDMAN_HPP
#define IDMAN_HPP
#include <type_traits>
#include <set>
/**
// This code is distributed under the Unlicense license.
// For more details, please visit https://unlicense.org/
template <class T>
class CircularBuffer
{
private:
std::unique_ptr<T[]> buffer;
size_t frontIndex;
size_t backIndex;
@Bigfoot71
Bigfoot71 / formatShader.lua
Last active June 24, 2023 01:03
Lua script (>=5.1) to convert a GLSL shader into a C string.
local function formatString(inputString)
local outputString = ""
for line in inputString:gmatch("[^\r\n]+") do
if line:match("%S") then -- Check if row is empty
local formattedLine = line:gsub("^%s*", "") -- Remove spaces before the first character of the line
@Bigfoot71
Bigfoot71 / AndroidManifest.xml
Last active September 4, 2025 06:38
Example of AdMob integration in Raymob
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- Add this for apps targeting Android 13 or higher & GMA SDK version 20.3.0 or lower -->
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<application>
@Bigfoot71
Bigfoot71 / display.lua
Created April 17, 2023 21:23
Script to handle display resizing in Löve2D
local lg = love.graphics
local Display = {
size = {
w = 0,
h = 0,
ox = 0,
oy = 0
};
@Bigfoot71
Bigfoot71 / example.lua
Created November 10, 2022 15:03
table.partition function, to divide a table into 'n' tables or 'n' by 'n' (only works with tables with a numeric index starting from [1])
require("table-partition.lua")
do -- Dividing a table with a length of 167 into 7 tables
local TBL = {}
for i = 1, 167 do TBL[i] = i end
local TBLS = table.partition(TBL, 7)