Skip to content

Instantly share code, notes, and snippets.

View jgranick's full-sized avatar

Joshua Granick jgranick

View GitHub Profile
@jgranick
jgranick / HelloWorld.hx
Created October 14, 2011 06:23
Minimal "Hello World" using haxe JS
class HelloWorld {
static function main () {
untyped console.log ("Hello haxe JS");
}
}
@jgranick
jgranick / HelloWorld.hx
Created October 14, 2011 06:38
Another minimal "Hello World" example in haxe JS
class HelloWorld {
static function main () {
untyped console.log ("Hello haxe JS");
}
}
@jgranick
jgranick / HelloWorld.hx
Created October 14, 2011 15:31
1 LOC ;)
class HelloWorld {
static function main () {
untyped console.log ("Hello haxe JS");
}
}
@jgranick
jgranick / project.pbxproj
Created October 31, 2011 18:46
Fixed project template?
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1EEEBA9B121AF1C60048A9DF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EEEBA9A121AF1C60048A9DF /* UIKit.framework */; };
@jgranick
jgranick / SDLStage.cpp
Created October 31, 2011 22:18
Simple GL application
#include "SDLStage.h"
SDLStage::SDLStage (int width, int height, int frameRate, int flags) {
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) == 0) {
screen = SDL_SetVideoMode (width, height, 0, flags);
if (screen != NULL) {
@jgranick
jgranick / SimpleHX.hx
Created October 31, 2011 22:53
Now using NME instead
import nme.display.Sprite;
class SimpleHX extends Sprite {
public function new () {
super ();
@jgranick
jgranick / DisplayingABitmap.hx
Created February 7, 2012 20:30
How to display a bitmap (NME recipe)
import nme.display.Bitmap;
import nme.display.Sprite;
import nme.Assets;
/**
* @author Joshua Granick
*/
class DisplayingABitmap extends Sprite {
@jgranick
jgranick / PlayingSound.hx
Created February 7, 2012 20:39
How to play a sound (NME recipe)
import nme.display.Sprite;
import nme.media.Sound;
import nme.Assets;
/**
* @author Joshua Granick
*/
class PlayingSound extends Sprite {
@jgranick
jgranick / NyanCat.hx
Created February 7, 2012 21:13
How to embed SWF content -- Without using <library /> (NME recipe)
package com.joshuagranick.nyancat;
import format.SWF;
import nme.display.Sprite;
import nme.Assets;
/**
* @author Joshua Granick
@jgranick
jgranick / NyanCat.hx
Created February 7, 2012 21:17
How to embed SWF content -- Using <library /> (NME recipe)
package com.joshuagranick.nyancat;
import nme.display.Sprite;
/**
* @author Joshua Granick
*/
class NyanCat extends Sprite {