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
@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);
@fserb
fserb / polygon.hx
Created March 24, 2014 22:25
SAT for Polygon intersection in 50 lines of Haxe
// Given a Vec2 vector class...
function hitPolygonAxis(points: Array<Vec2>, ret: Array<Float>) {
for (i in 0...points.length) {
var a = points[i];
var b = points[(i+1) % points.length];
var v = Vec2.make(b.x - a.x, b.y - a.y).normal();
// we should be able to only use half circunference.
ret.push(v.angle());
}
}
@fserb
fserb / macro.hx
Created November 8, 2013 20:43
Macro example
class MyClass {
/*
usage:
function x() {
var c = new MyClass();
var x = c.func(10);
}
*/
macro public function func(ethis: Expr, block: Expr): Expr {
@01010111
01010111 / hello.p8
Last active March 9, 2019 11:46
ECS in P8 ✨
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
--pecs - pico-8 ecs
--01010111
function _init()
local rect = get_id()
add_component(rect, 'position', { x=60, y=60 })
add_component(rect, 'physics', { vx=2, vy=0, ax=0, ay=2, dx=0.9, dy=1.0 })
@Ohmnivore
Ohmnivore / gist:6622d99de2d8aa2cce0f
Created May 20, 2014 00:09
Haxe laoder for Ogmo Editor
package ;
#if CLIENT
#else
import entities.Flag;
import entities.HealthPack;
import entities.Spawn;
import flixel.util.FlxPoint;
#end
@01010111
01010111 / OgmoExample.hx
Created June 11, 2019 16:05
Example of using OgmoUtils class
using OgmoUtils;
class OgmoExample
{
public function new(level_json:String)
{
var data = level_json.parse_level_json();
var tile_layer = data.get_tile_layer('tiles');
trace(tile_layer.data2D);
@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()
{
}
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
// note : I found (visually) that there is a little mistake in this rotation version but I haven't found where in the code
// edit : I think I understood the mistake but it's quite annoying to fix :)
int[][] result;
float t, c;
@SimpleDrunk
SimpleDrunk / hexagon mosaic
Created December 6, 2013 01:28
『openframeworks』shader制作六边形马赛克效果 http://blog.csdn.net/simpledrunk/article/details/17095821
//testApp.h
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
@companje
companje / subdivide-tetrahedron.cpp
Created August 4, 2012 16:21
Subdivide a tetrahedron to a sphere with ofMesh in openFrameworks
#include "ofMain.h"
#include "ofAppGlutWindow.h"
class ofApp : public ofBaseApp {
public:
ofMesh mesh;
ofEasyCam cam;
void setup() {