Skip to content

Instantly share code, notes, and snippets.

View thatcosmonaut's full-sized avatar

Evan Hemsley thatcosmonaut

View GitHub Profile
@thatcosmonaut
thatcosmonaut / gms2_gamepad_db_composer.py
Last active October 5, 2021 21:12 — forked from offalynne/gms2_gamepad_db_composer.py
GMS2 Gamepad DB Composer
#!/usr/bin/python
# @offalynne, 2021
# Modified for python 3 by @thatcosmonaut
import re
import os
import sys
import urllib.request
@thatcosmonaut
thatcosmonaut / OrthographicCamera.cs
Created July 6, 2021 02:58
an orthographic camera example for FNA
public struct OrthographicCamera : ICamera
{
public Matrix View { get; }
public Matrix Projection { get; }
public Vector3 Position { get; }
public Vector3 Forward { get; }
public Vector3 Up { get; }
public Vector3 Right { get; }
version: '3'
services:
nginx:
image: staticfloat/nginx-certbot
restart: always
ports:
- 80:80/tcp
- 443:443/tcp
environment:
@thatcosmonaut
thatcosmonaut / Resolution.cs
Created December 14, 2020 04:41
auto letterboxing
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace IndependentResolutionRendering
{
static class Resolution
{
static private int s_virtual_width;
static private int s_virtual_height;
static private int s_screen_width;
@thatcosmonaut
thatcosmonaut / PaletteCrushEffect.fx
Created December 10, 2020 20:49
Busted mojoshader GLSL output
#include "Macros.fxh"
#define FLT_MAX 3.402823466e+38
DECLARE_TEXTURE(Texture, 0);
DECLARE_TEXTURE(Palette, 1);
BEGIN_CONSTANTS
int PaletteWidth _ps(c0) _cb(c0);
@thatcosmonaut
thatcosmonaut / GMEvents
Created November 19, 2020 00:13
GM event number reference
-1:1 properties
2:0 alarm0
2:1 alarm1
2:2 alarm2
2:3 alarm3
2:4 alarm4
2:5 alarm5
2:6 alarm6
2:7 alarm7
2:8 alarm8
@thatcosmonaut
thatcosmonaut / FuckNone.cs
Created November 5, 2020 06:56
Stress test for FNA dynamic buffer updates using None
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace FuckNone
{
class FuckNoneGame : Game
{
static int BUFFER_SIZE = 8388608;
static int UPDATES_PER_FRAME = 32;
# RenderDoc Python console, powered by python 3.8.5.
# The 'pyrenderdoc' object is the current CaptureContext instance.
# The 'renderdoc' and 'qrenderdoc' modules are available.
# Documentation is available: https://renderdoc.org/docs/python_api/index.html
# Alias renderdoc for legibility
rd = renderdoc
def saveColorBuffer(controller, drawCall, drawCallCounter):
controller.SetFrameEvent(drawCall.eventId, True)
@thatcosmonaut
thatcosmonaut / ShaderEffect.fx
Created September 8, 2020 04:05
sampling from a cube map as though it were a 3d texture
float ComputeShadow(float4 positionLightSpace, int directionalLightIndex)
{
float bias = 0.005;
// maps to [-1, 1]
float3 projectionCoords = positionLightSpace.xyz / positionLightSpace.w;
// map our UV sample coordinates to a cube map sample vector
float3 cubeMapSampleVector;
if (directionalLightIndex == 0)
@thatcosmonaut
thatcosmonaut / Background.fx
Last active June 24, 2020 04:17
FNA Background Shader Example
#define SV_POSITION POSITION
uniform float time;
struct VertexShaderOutput {
float4 Position : TEXCOORD0;
float4 Color : COLOR0;
float2 TextureCoordinates : TEXCOORD1;
};