Skip to content

Instantly share code, notes, and snippets.

View lewislepton's full-sized avatar
🏳️‍🌈
tofu bouncing bonanza

Lewis Lepton lewislepton

🏳️‍🌈
tofu bouncing bonanza
View GitHub Profile
@elsassph
elsassph / ResourceGenerator.hx
Created July 3, 2016 13:21
Haxe build macro converting a JSON file into strongly typed, inline/dce friendly, properties
package;
#if macro
import haxe.Json;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
import sys.io.File;
import sys.FileSystem;
@wighawag
wighawag / Main.hx
Last active March 21, 2017 17:50
Kha White Noise
import kha.System;
import kha.Scheduler;
class Main{
public static function main(){
System.init({
title: "dsp",
width: 800,
height: 600,
}, initialized);
@zaynyatyi
zaynyatyi / Game.hx
Last active June 28, 2019 21:37
Actuate in kha using manual update
package;
import motion.actuators.SimpleActuator;
class Game
{
public function new()
{
}
@Ohmnivore
Ohmnivore / OgmoLoader.hx
Created December 7, 2014 03:53
Basic HaxeFlixel Ogmo Editor loader
package util;
import flixel.FlxG;
import haxe.xml.Fast;
import flixel.tile.FlxTilemap;
import haxe.Json;
import flixel.tile.FlxTile;
import flixel.FlxObject;
import openfl.Assets;
import entities.Spawn;
@snorpey
snorpey / circle rotated rectangle collision.js
Last active March 1, 2024 13:43
Calculate collision between circle and rotated rectangle
// Ported to JavaScript from
// http://www.migapro.com/circle-and-rotated-rectangle-collision-detection/
//
// An example:
// var circle: { x: 20, y: 10, radius: 20 };
// var rect: { x: 30, y: 30, width: 100, height: 100, rotation: Math.PI / 2 };
// collideCircleWithRotatedRectangle( circle, rect );
// // returns true.
//
//
@kristopherjohnson
kristopherjohnson / Stopwatch.swift
Last active July 13, 2022 11:24
Swift classes for calculating elapsed time, similar to .NET's System.Diagnostics.Stopwatch class
// Copyright (c) 2017 Kristopher Johnson
//
// 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 furnished to do so, subject to
// the following conditions:
//
@hamaluik
hamaluik / AABB.hx
Created October 6, 2014 05:38
Continuous collision detection between two moving AABBs using Minkowski differences.
package ;
import openfl.display.Sprite;
/**
* ...
* @author Kenton Hamaluik
*/
class AABB
{
public var center:Vector = new Vector();
@hamaluik
hamaluik / AABB.hx
Last active March 14, 2024 16:57
Minkowski Difference Collision Detection
package ;
import openfl.display.Sprite;
/**
* ...
* @author Kenton Hamaluik
*/
class AABB
{
public var center:Vector = new Vector();
@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active May 22, 2024 23:03
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 24, 2024 03:20
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);