Created
October 8, 2012 07:34
-
-
Save frosty/3851209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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