Skip to content

Instantly share code, notes, and snippets.

View KeyMaster-'s full-sized avatar

Tilman Schmidt KeyMaster-

View GitHub Profile
@KeyMaster-
KeyMaster- / PhysBody.hx
Created April 4, 2015 22:16
Luxe rectangles physics engine (WIP, and very basic)
package ;
import luxe.Component;
import luxe.Rectangle;
import luxe.Vector;
class PhysBody {
public var rect:Rectangle;
public var vel:Vector;
public var acc:Vector;
@KeyMaster-
KeyMaster- / InputSystem.hx
Created July 17, 2015 14:42
Old OpenFL input system for an entity component system framework
/*
* Author: Richard Lord
* Copyright (c) Big Room Ventures Ltd. 2007
* Version: 1.0.2
* Modified and extended by Tilman Schmidt (@KeyMaster_)
* - Fixed key buffer size to contain enough bits for all keys
* - Added buffering for entity component system framework
* - Added keyUp and keyDown lookups
*
* Licence Agreement
@KeyMaster-
KeyMaster- / ScreenfluidExample.hx
Created April 26, 2015 20:21
Example use of a screen-wide fluid to create global drag for nape bodies
var screenShape = new Polygon(Polygon.rect(0, 0, Luxe.screen.w, Luxe.screen.h, true));
screenShape.fluidEnabled = true;
//Density of 0.3, Viscosity of 3. These are values you just have to experiment with until it feels right
screenShape.fluidProperties = new FluidProperties(0.3, 3);
//It's important to set the collisionMask (second parameter) to 0 here,
//so the shape doesn't collide with anything (we want everything to just move through it)
screenShape.filter = new InteractionFilter(1, 0);
//Set up a body holding the shape and add it to the space
var screenBody = new Body(BodyType.STATIC);
@KeyMaster-
KeyMaster- / PlyImporter.hx
Last active August 29, 2015 14:08
Importer for PLY files from Blender into Luxe
package;
import luxe.Mesh;
import haxe.io.StringInput;
import luxe.options.MeshOptions;
import luxe.Vector;
import phoenix.Batcher;
import phoenix.geometry.Geometry;
import PlyParser;
import phoenix.geometry.Vertex;
/**
@KeyMaster-
KeyMaster- / BytesUtil.hx
Last active August 29, 2015 14:03
haxe.io.Bytes to bit string representation
import haxe.io.Bytes;
class BytesUtil {
/**
* Represent a Bytes object as single bits in a string
* @param b The bytes
* @return A string of '0's and '1's representing the bytes
*/
public static function toBits(b:Bytes):String {
var s:String = "";