Skip to content

Instantly share code, notes, and snippets.

View stillwwater's full-sized avatar

Lucas stillwwater

  • Microsoft
  • Canada
View GitHub Profile
@stillwwater
stillwwater / pixelperfect.c
Created August 16, 2021 06:55
Pixel perfect camera in SDL2
#include "SDL.h"
#include "stb/stb_image.h"
#define CAMERA_BORDER 1
typedef struct {
SDL_Renderer *renderer;
SDL_Texture *target;
int width;
@stillwwater
stillwwater / export-atlas.lua
Created December 21, 2020 02:59
Aseprite exporter for texture atlas files
------------------------------------------------------------------------
-- Export texture atlas file format
--
-- The file format is as follows:
--
-- # version VERSION_NUMBER
-- # ASEPRITE_FILE
-- i IMAGE_FILE NUMBER_OF_FRAMES
-- s SPRITE_X SPRITE_Y SPRITE_W SPRITE_H SPRITE_PIVOT_X SPRITE_PIVOT_Y
-- a ANIM_NAME ANIM_START ANIM_END ANIM_DIRECTON ANIM_FRAME_TIME_SECONDS
" _
" (_)
" __ ___ _ __ ___ _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" (_)_/ |_|_| |_| |_|_| \___|
"
syntax on
set mouse=a " :O
@stillwwater
stillwwater / Pool.cs
Last active July 16, 2020 02:36
Better GameObject Pooling In Unity
using System.Collections.Generic;
using UnityEngine;
class Pool<T> where T : Component
{
readonly List<T> pool;
readonly T prefab;
readonly Transform parent;
int id;
@stillwwater
stillwwater / nebula-dark-term
Created April 24, 2020 07:35
Terminal colors for vim-nebula
! vim-nebula terminal colors
! theme
*.cursorColor: #c9cbd1
*.foreground: #c9cbd1
*.background: #0a121d
! black
*.color0: #273845
*.color8: #273845
@stillwwater
stillwwater / var2ini.pas
Created July 18, 2018 01:44
Converts .var files to INI, YAML, or .var with stripped comments.
{
Converts .var files to INI, YAML, or .var with stripped comments.
input:
"""
This string documents
the file.
"""
:name
key value # this is a comment
class FastIniParser
{
class Env
{
public const char DEF = '=';
public const char NEW_LINE = '\n';
public const char COMMENT = ';';
public const char OPEN_TAG = '[';
public const char CLOSE_TAG = ']';
}
@stillwwater
stillwwater / desklapse.py
Created May 6, 2018 22:19
records desktop timelapses
"""
-- desklapse v1.0 --
record desklapse.py [PROJECT_NAME] [TIME_INTERVAL (SECONDS)]
record desklapse.py [PROJECT_NAME] [TIME_INTERVAL (MINUTES)] -m
convert to video desklapse.py [PROJECT_NAME] compile
compile and clean desklapse.py [PROJECT_NAME] compile -c
remove frames desklapse.py [PROJECT_NAME] clean
"""
hmmm
====
a simple python program that fixes a typo in its
source code, then comits!
- this is hmmm.py version -1.00
"""
import sys
import itertools
class Smol:
def __init__(self, tapesize=1):
self.env = {
'+': lambda: self.incdec(1, 0),
'-': lambda: self.incdec(-1, 0),
'>': lambda: self.incdec(0, 1),
'<': lambda: self.incdec(0, -1),