Skip to content

Instantly share code, notes, and snippets.

View RednibCoding's full-sized avatar

Michael Binder RednibCoding

View GitHub Profile
@RednibCoding
RednibCoding / Gui.bmx
Last active April 19, 2025 22:12
BlitzMax immediate mode gui
' === GUI STATE SETUP ===
Type TGuiState
Field winWidth:Int, winHeight:int
Field mouseX:Int, mouseY:Int
Field guiMouseOver:Int
Field mouseWheelDelta:Int
Field mouseDown:Int, lastMouseDown:Int
Field spacing:Int = 4
Field widgetHeight:Int = 24
@RednibCoding
RednibCoding / CamSwitcher.py
Created March 3, 2025 11:54
Cave CamSwitcher script
import cave # type: ignore
# Private module-level variables (not accessible outside this script)
_cam_switcher_data = {
"targetOneName": "",
"targetTwoName": ""
}
# Add this to the first entity that the camera can switch to (it must have a CameraComponent)
class CamSwitcherTargetOne(cave.Component):
@RednibCoding
RednibCoding / rc_tga.h
Last active January 15, 2025 23:01
Single header c library for loading and writing tga image files
/*
* TGA File Handling Library
* by Michael Binder (RednibCoding)
*
* This library provides functionality to load and save TGA (Targa) image files, including support for uncompressed
* and RLE-compressed (32-bit RGBA and 24-bit RGB) images. The library is simple and self-contained, designed for
* easy integration into projects requiring TGA image manipulation.
*
* Key Features:
* - TGA Loading from Memory and Files:
@RednibCoding
RednibCoding / LPM_3D_Format_Documentation.md
Last active January 6, 2025 15:45
LPM (Low Poly Model) Format Documentation

LPM (Low Poly Model) 3D Format Documentation

Overview

The LPM format is a lightweight, human-readable format designed to store low-polygon 3D models. It supports vertices, normals, UVs, faces, and skeletal animations. Its simplicity makes it easy to parse and implement in custom tools.

Features

  • Single texture per model
  • Comments supported (lines starting with #)
  • Compact and straightforward structure
  • Skeletal animations support (optional)
@RednibCoding
RednibCoding / SMD_Format_Documentation.md
Last active January 5, 2025 11:49
StudioModel Data (SMD) Format Documentation

SMD 3D Model Format Documentation

Overview

SMD (StudioModel Data) is a plain-text file format used for 3D models, primarily in Valve's Source and GoldSrc engines. SMD is also known to be used by Sauerbraten and third party tools for The Sims and Mount & Blade. It stores geometry, skeletal animations, and optionally vertex animations in a simple, easy-to-parse structure.

Key Features

  • Reference Models: Default pose with geometry and bone hierarchy.
/**
* Simple assert function that throws an error if the test is false
*/
export function assert(condition: unknown, msg?: string): asserts condition {
if (condition === false) throw new AssertionError(msg);
}
@RednibCoding
RednibCoding / 0 Dlang debuggin in vs-code.md
Last active March 22, 2025 11:03
Dlang debuggin in vs-code

Setup

To setup debugging for Dlang programs on Windows with VsCode follow these steps:

  • make sure you have the D Programming Language (code-d) (VsCode extension) installed
  • make sure you have the C/C++ extension pack (VsCode extension) installed
  • create a .vscode folder at the root of your DLang project
  • copy the launch.json and tasks.json into it
  • in the launch.json at line: "program": "./my-app.exe", change my-app.exe to your executable name (look in the dub.json under name).
  • click on the debug tab in VsCode, then click on the debug button at the top (or press F5)
@RednibCoding
RednibCoding / MmoCharacterController.cs
Last active November 9, 2023 09:16
MmoCharacterController for the flax engine
/*
How to use:
1. Create a CharacterController in your scene
2. Add an AnimatedModel (your player character) as child to the CharacterController
3. Adjust the size of the CharacterController capsule so it fits the size of your player character
4. Add a Camera as child to the CharacterController
5. Set the Layer of the CharacterController to "Player" (can be found under Properties->General->Layer while the PlayerController is selected)
6. Add this MmoCharacterController script to the CharacterController
*/
@RednibCoding
RednibCoding / Create a static library of a .c file.md
Last active September 24, 2024 13:57
Create a static library of a .c file for windows and linux

How do i create a static library file of my test.c with gcc?

You can create a static library .lib file using the GCC compiler by following these steps:

  1. Compile the source files into object files:
gcc -c test.c
@RednibCoding
RednibCoding / 0 Odin debugging on windows.md
Last active April 18, 2025 07:09
Odin debugging on windows with vscode. See: readme

Setup

To setup debugging for Odin programs on Windows with VsCode follow these steps:

  • make sure you have the C/C++ extension pack (VsCode extension) installed
  • create a .vscode folder at the root of your Odin project
  • copy the launch.json and tasks.json into it
  • click on the debug tab in VsCode, then click on the debug button at the top (or press F5)

Note: if you want to use a starter template which also sets up a tracking allocator which tracks and reports memory leaks you can use: https://github.com/RednibCoding/Odin-Starter