Skip to content

Instantly share code, notes, and snippets.

class Basic {
static function main() {
trace('basic example');
}
}
@ruby0x1
ruby0x1 / URLUtil.hx
Created February 18, 2015 13:24
Example android JAR utility written in haxe
// http://notes.underscorediscovery.com/haxe-from-1000ft
import android.util.Log;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.net.Uri;
import android.content.Intent;
@:nativeGen
> haxelib run haxelibcounter
HaxelibCounter.hx:69: haxelibcounter
HaxelibCounter.hx:76: > found args { any => true, length => 0, valid => [], invalid => [{ name => /Users/sven/dev/haxe-entry-point-example/, value => }] }
HaxelibCounter.hx:69: usage:
HaxelibCounter.hx:69: --count | displays the number of haxelib libraries installed
HaxelibCounter.hx:69: --show-names | must be specified with --count, lists installed haxelibs one per line
@ruby0x1
ruby0x1 / Random.hx
Last active August 29, 2015 14:17
Random.hx
package ;
//Adapted from code by Grant Skinner, see bottom of file.
//This is cut from https://github.com/underscorediscovery/luxe under MIT license
/**
Given an `initial` value for the seed, subsequent generated numbers will be predictable,
and the `seed` value updated to reflect the current seed which can be used to resume predictability
from an ongoing set. Uses a Park–Miller pseudo random number generator.
@ruby0x1
ruby0x1 / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ruby0x1
ruby0x1 / Test.hx
Last active August 29, 2015 14:19
Write luxe pixels from GL framebuffer as RGB to a raw file
import snow.api.buffers.Uint8Array;
import snow.modules.opengl.GL;
//....
override function onkeyup( e:KeyEvent ) {
if(e.keycode == Key.key_h) {
@ruby0x1
ruby0x1 / luxe-alpha-2.0-changes.md
Created April 27, 2015 17:50
luxe-alpha-2.0 initial work

Parcel:

  • new Parcel implementation
  • update options and creation options for all new resource types and settings
  • initial work toward parcel diff loading
  • add parcel event endpoints, for progress, complete, failed events
  • added ParcelChange type for information on progress or failure events
  • added length properties for counting resources
  • added state, for unloaded loading loaded
  • added listed which returns an array of resource id's in the parcel
  • added loaded which returns an array of resource id's that are loaded by this parcel
@ruby0x1
ruby0x1 / Pool_example.hx
Last active August 29, 2015 14:20
luxe.structural.Pool example
//creation
var player_bullets : Pool<Sprite>;
player_bullets = new Pool<Sprite>(20,
function(index,total){
var _sprite = new Sprite({ pos: new Vector(-999,-999), visible:false });
var _projectile = _sprite.add( new Projectile({
bullet_type:'player'
}) );
@ruby0x1
ruby0x1 / PlayerTeam.hx
Created May 13, 2015 21:28
Flag / Team component
package game;
import luxe.Vector;
import luxe.Sprite;
import luxe.Color;
import luxe.Component;
import phoenix.Texture;
class PlayerTeam extends Component {
@ruby0x1
ruby0x1 / ServerGame.js
Created March 27, 2012 14:53
Multi-player games in HTML5 : Server Side Game Class
var Game = Class.extend({
init : function( player, opponent ) {
this.id = UUID();
this.player = player;
this.opponent = opponent;
},