Skip to content

Instantly share code, notes, and snippets.


zloedi zloedi

  • Sofia Bulgaria
View GitHub Profile
zloedi / Nav.cs
Last active Oct 25, 2021
Flood fill pather in C#
View Nav.cs
//#define NAV_FOUR_WAY
public static class Nav {
public const int FREE = ( int )0x0fffffff;
public const int BLOC = ( int )0x40000000;
static int Min( int a, int b ) {
return a < b ? a : b;
zloedi / minimal size mingw exe example Makefile
Last active Mar 20, 2021
mingw minimal windows exe using SDL (exe size ~9K)
View minimal size mingw exe example Makefile
# Thanks goes to -- Small, Freestanding Windows Executables
no_crt.exe: main.c
x86_64-w64-mingw32-gcc -o no_crt.exe main.c -pedantic-errors \
-std=c99 -Wall -Wextra \
-O3 \
-fno-tree-loop-distribute-patterns \
-fno-stack-protector -mno-stack-arg-probe \
-mconsole -DM_CONSOLE \
-I/usr/local/x86_64-w64-mingw32/include \
`sdl2-config --static-libs` \
zloedi / minilist.h
Last active Aug 27, 2020
Single header C library to turn your buffer into a generic doubly linked list, by sacrificing the first few elements. Provides some typesafety through the ML_Add() macro.
View minilist.h
// Copyright (c) 2020 Stoiko Todorov
// This work is licensed under the terms of the MIT license.
// For a copy, see
// This lib turns an array into a linked list by sacrificing the first
// few elements of the array
#ifndef ML_TYPE
// by default max numItems is 65535, redefine ML_TYPE if needed
#define ML_TYPE unsigned short
zloedi / nav_flood.h
Created Oct 5, 2019
Tiny single header flood fill pathfinder
View nav_flood.h
// #define FLOOD_NAV_IMPLEMENTATION before #include "nav_flood.h" to unwrap the implementation
// #define NAV_FOUR_WAY before #include "nav_flood.h" for four-way flood implementation
#define NAV_FREE 0x0fffffff
#define NAV_BLOC 0x40000000
// Internal struct used to hold flood front
typedef struct {
int capMask;
int *buf;
zloedi / DebugExtensions.cs
Last active Apr 5, 2019
Unity Debug.DrawImage and Debug.DrawText routines in single file/static class.
View DebugExtensions.cs
using UnityEngine;
using System.Collections.Generic;
using UnityEditor;
public static class DebugEx
public static float CharactersOffset = -4;
zloedi / roguelike_FOV.c
Last active Nov 1, 2021
Efficient roguelike grid FOV / shadowcasting / line of sight in a single C function inspired by
View roguelike_FOV.c
// Copyright (c) 2021 Stoiko Todorov
// This work is licensed under the terms of the MIT license.
// For a copy, see
// What this function does:
// Rasterizes a single Field Of View octant on a grid, similar to the way
// field of view / line of sight / shadowcasting is implemented in some
// roguelikes.
// Uses rays to define visible volumes instead of tracing lines from origin
// to pixels.