Skip to content

Instantly share code, notes, and snippets.

@frosty
Created October 8, 2012 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frosty/3851209 to your computer and use it in GitHub Desktop.
Save frosty/3851209 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<project>
<app title="Flixel Test" file="Flixel Test" main="Main" version="0.0.1" company="Zaphod" />
<window width="1024" height="768" fps="30" orientation="portrait" resizable="true" if="target_flash" />
<window width="0" height="0" fps="30" orientation="landscape" fullscreen="true" unless="target_flash" />
<set name="BUILD_DIR" value="Export" />
<set name="SWF_VERSION" value="10.1" />
<app preloader="org.flixel.system.FlxPreloader" />
<!--<setenv name="no_console" value="1" />-->
<classpath name="Source" />
<haxelib name="nme" />
<haxelib name="flixel"/>
<assets path="Assets" rename="assets" if="android" >
<sound path="data/beep.wav" id="Beep" />
<!-- Your sound embedding code here... -->
</assets>
<assets path="Assets" rename="assets" if="desktop" >
<sound path="data/beep.wav" id="Beep" />
<!-- Your sound embedding code here... -->
</assets>
<assets path="Assets" rename="assets" if="target_flash" >
<sound path="data/beep.mp3" id="Beep" />
<!-- Your sound embedding code here... -->
</assets>
<assets path="assets/data" include="*.ttf" type="font" />
<assets path="assets" include="*.fgr" type="text" />
<assets path="assets" include="*.csv" type="text" />
<assets path="assets" include="*.txt" type="text" />
<assets path="assets" include="*.png" type="image" />
<assets path="assets/data" include="*.png" type="image" />
<assets path="assets/data/vcr" include="*.png" type="image" />
<assets path="assets/data/vis" include="*.png" type="image" />
<icon name="Assets/HaxeFlixel.svg" />
<ndll name="std" />
<ndll name="regexp" />
<ndll name="zlib" />
<ndll name="nme" haxelib="nme" />
</project>
package;
import nme.display.StageAlign;
import nme.display.StageScaleMode;
import nme.display.Sprite;
import nme.events.Event;
import nme.events.KeyboardEvent;
import nme.Lib;
import nme.ui.Keyboard;
import org.flixel.FlxGame;
/**
* @author Joshua Granick
*/
class Main extends Sprite
{
public function new ()
{
super();
if (stage != null)
init();
else
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(?e:Event = null):Void
{
if (hasEventListener(Event.ADDED_TO_STAGE))
{
removeEventListener(Event.ADDED_TO_STAGE, init);
}
initialize();
var demo:FlxGame = new TestGame();
addChild(demo);
#if (cpp || neko)
Lib.current.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUP);
#end
}
#if (cpp || neko)
private function onKeyUP(e:KeyboardEvent):Void
{
if (e.keyCode == Keyboard.ESCAPE)
{
Lib.exit();
}
}
#end
private function initialize():Void
{
Lib.current.stage.align = StageAlign.TOP_LEFT;
Lib.current.stage.scaleMode = StageScaleMode.NO_SCALE;
}
// Entry point
public static function main() {
Lib.current.addChild(new Main());
}
}
package;
import nme.Assets;
import nme.geom.Rectangle;
import nme.net.SharedObject;
import org.flixel.FlxButton;
import org.flixel.FlxG;
import org.flixel.FlxPath;
import org.flixel.FlxSave;
import org.flixel.FlxSprite;
import org.flixel.FlxState;
import org.flixel.FlxText;
import org.flixel.FlxU;
class MenuState extends FlxState
{
override public function create():Void
{
#if !neko
FlxG.bgColor = 0xff131c1b;
#else
FlxG.bgColor = {rgb: 0x131c1b, a: 0xff};
#end
FlxG.mouse.show();
}
override public function destroy():Void
{
super.destroy();
}
override public function update():Void
{
super.update();
}
}
package;
import nme.Lib;
import org.flixel.FlxGame;
class TestGame extends FlxGame
{
public function new()
{
var stageWidth:Int = Lib.current.stage.stageWidth;
var stageHeight:Int = Lib.current.stage.stageHeight;
var ratioX:Float = stageWidth / 1024;
var ratioY:Float = stageHeight / 768;
var ratio:Float = Math.min(ratioX, ratioY);
super(Math.floor(stageWidth / ratio), Math.floor(stageHeight / ratio), MenuState, ratio, 30, 30);
forceDebugger = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment