Skip to content

Instantly share code, notes, and snippets.

zloedi zloedi

  • Snapshot Games
  • Sofia Bulgaria
Block or report user

Report or block zloedi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zloedi
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
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;
#if UNITY_EDITOR
using UnityEditor;
#endif
public static class DebugEx
{
public static float CharactersOffset = -4;
@zloedi
zloedi / roguelike_FOV.c
Last active Jan 30, 2019
Efficient roguelike grid FOV / shadowcasting in a single C function inspired by http://blogs.msdn.com/b/ericlippert/archive/2011/12/12/shadowcasting-in-c-part-one.aspx
View roguelike_FOV.c
/*
What this function does:
Rasterizes a single Field Of View octant on a grid, similar to the way
FOV / shadowcasting is implemented in some roguelikes.
Uses rays to define visible volumes instead of tracing lines from origin to pixels.
Minimal processing per pixel (each pixel is hit only once most of the time).
Clips to bitmap
Steps on pixel centers
Optional attenuation
Optional circle clip
You can’t perform that action at this time.