Skip to content

Instantly share code, notes, and snippets.

View thatcosmonaut's full-sized avatar

Evan Hemsley thatcosmonaut

View GitHub Profile
Checks: "-*,readability-identifier-naming"
CheckOptions:
readability-identifier-naming.ParameterCase: camelBack
readability-identifier-naming.LocalVariableCase: camelBack
readability-identifier-naming.MemberIgnoredRegexp: "[A-Z]+.*"
readability-identifier-naming.MemberCase: camelBack
@thatcosmonaut
thatcosmonaut / SDL.json
Last active September 10, 2024 17:19
rpav/c2ffi on SDL3/SDL.h
[
{ "tag": "typedef", "ns": 0, "name": "__u_char", "location": "/usr/include/bits/types.h:31:23", "type": { "tag": ":unsigned-char", "bit-size": 8, "bit-alignment": 8 } },
{ "tag": "typedef", "ns": 0, "name": "__u_short", "location": "/usr/include/bits/types.h:32:28", "type": { "tag": ":unsigned-short", "bit-size": 16, "bit-alignment": 16 } },
{ "tag": "typedef", "ns": 0, "name": "__u_int", "location": "/usr/include/bits/types.h:33:22", "type": { "tag": ":unsigned-int", "bit-size": 32, "bit-alignment": 32 } },
{ "tag": "typedef", "ns": 0, "name": "__u_long", "location": "/usr/include/bits/types.h:34:27", "type": { "tag": ":unsigned-long", "bit-size": 64, "bit-alignment": 64 } },
{ "tag": "typedef", "ns": 0, "name": "__int8_t", "location": "/usr/include/bits/types.h:37:21", "type": { "tag": ":signed-char", "bit-size": 8, "bit-alignment": 8 } },
{ "tag": "typedef", "ns": 0, "name": "__uint8_t", "location": "/usr/include/bits/types.h:38:23", "type": { "tag": ":unsigned-char", "bit-size": 8, "bit-alignment": 8 }
@thatcosmonaut
thatcosmonaut / refresh_backport.py
Last active July 10, 2024 20:50
Automated backporting from SDL3 -> Refresh
import argparse
sdl_license_text = """/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
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.
@thatcosmonaut
thatcosmonaut / buildshader.py
Last active March 26, 2024 17:26
Portable shader build script for use with SDL_gpu
#!/usr/bin/env python3
# Simple DirectMedia Layer
# Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
#
# 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,
using System;
using System.Runtime.InteropServices;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace KeyboardTest
{
unsafe class KeyboardTestGame : Game
{
@thatcosmonaut
thatcosmonaut / Glicko2.cs
Created November 28, 2023 20:06
Glicko-2 C#
// An implementation of the Glicko-2 system
// http://www.glicko.net/glicko/glicko2.pdf
// Copyright (c) 2023 Evan "cosmonaut" Hemsley
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@thatcosmonaut
thatcosmonaut / build_moonlibs.sh
Last active January 12, 2025 22:02
Build moonlibs
#!/bin/bash
set -ex
rm -rf win64
mkdir win64
rm -rf lib64
mkdir lib64
rm -rf macos
mkdir macos
@thatcosmonaut
thatcosmonaut / MotionSystem.cs
Last active September 28, 2023 18:12
Samurai Gunn 2 MotionSystem
using System;
using System.Collections.Generic;
using MoonTools.ECS;
using MoonWorks.Math.Fixed;
using SamuraiGunn2.Content;
namespace SamuraiGunn2
{
public class MotionSystem : MoonTools.ECS.System
{
@thatcosmonaut
thatcosmonaut / DebugRenderer.cs
Last active September 26, 2023 21:50
MoonWorks + Dear Imgui
#if DEBUG
using MoonWorks;
using MoonWorks.Graphics;
using MoonWorks.Math.Float;
using ImGuiNET;
using Buffer = MoonWorks.Graphics.Buffer;
namespace SamuraiGunn2
{
public class DebugRenderer
@thatcosmonaut
thatcosmonaut / phong.frag
Created August 15, 2023 05:50
Phong Lighting Shader
#version 450
layout(location = 0) in vec3 InColor;
layout(location = 1) in vec3 InNormal;
layout(location = 2) in vec3 InFragPos;
layout(location = 0) out vec4 FragColor;
layout(binding = 0, set = 3) uniform UBO
{
vec3 LightPos;