Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Granick jgranick

View GitHub Profile
@jgranick
jgranick / MineHX.hx
Created Feb 7, 2012
How to switch graphics based on screen density (NME recipe)
View MineHX.hx
package com.eclecticdesignstudio.minehx;
import nme.display.Sprite;
import nme.system.Capabilities;
import nme.Assets;
/**
* ...
@jgranick
jgranick / ScreenResize.hx
Created Feb 7, 2012
How to dynamically handle different screen sizes (NME recipe)
View ScreenResize.hx
import nme.display.Sprite;
import nme.display.StageAlign;
import nme.display.StageScaleMode;
import nme.Lib;
/**
* @author Joshua Granick
*/
class ScreenResize extends Sprite {
@jgranick
jgranick / gist:1763850
Created Feb 8, 2012
NMML File Specification
View gist:1763850
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- <meta />
Use meta nodes to set metadata for your application. The description is ignored
on most targets, but is useful for packaging like Chrome Apps or Opera Widgets.
For compatibility with Android and webOS, the package name must include at least
@jgranick
jgranick / GameLoop.hx
Created Feb 8, 2012
How to create a simple game loop (NME recipe)
View GameLoop.hx
import nme.display.Sprite;
import nme.events.Event;
/**
* @author Joshua Granick
*/
class GameLoop extends Sprite {
@jgranick
jgranick / ConditionalCompilation.hx
Created Feb 9, 2012
How to use conditional compilation (NME recipe)
View ConditionalCompilation.hx
import nme.display.Sprite;
/**
* @author Joshua Granick
*/
class ConditionalCompilation extends Sprite {
public function new () {
@jgranick
jgranick / JoystickExample.hx
Created Feb 9, 2012
How to access a joystick/gamepad (NME recipe)
View JoystickExample.hx
package com.joshuagranick.joystickexample;
import nme.display.Sprite;
import nme.events.JoystickEvent;
import nme.Lib;
/**
* @author Joshua Granick
@jgranick
jgranick / KeyboardTest.hx
Created Feb 14, 2012
How to bind keyboard events using the "KeyBinding" library (NME recipe)
View KeyboardTest.hx
import com.eclecticdesignstudio.control.KeyBinding;
import nme.display.Sprite;
import nme.text.TextField;
/**
* @author Joshua Granick
*/
class KeyboardTest extends Sprite {
@jgranick
jgranick / BackButtonExample.hx
Created Feb 21, 2012
How to override the back button on Android (NME recipe)
View BackButtonExample.hx
import nme.display.Sprite;
import nme.Lib;
/**
* @author Joshua Granick
*/
class BackButtonExample extends Sprite {
@jgranick
jgranick / PiratePig.hx
Created Feb 23, 2012
Pirate Pig for NME
View PiratePig.hx
package com.eclecticdesignstudio.piratepig;
import nme.Assets;
import nme.display.Bitmap;
import nme.display.BitmapData;
import nme.display.Sprite;
import nme.display.StageAlign;
import nme.display.StageScaleMode;
import nme.events.Event;
@jgranick
jgranick / gist:2031376
Created Mar 13, 2012
ObjectHash class (from Actuate)
View gist:2031376
#if flash
import flash.utils.TypedDictionary;
#end
private class ObjectHash <T> {
#if flash