Failing test case for flx scene switch
This commit is contained in:
2
src/test/.gitignore
vendored
Normal file
2
src/test/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export/
|
||||
release/
|
90
src/test/Project.xml
Normal file
90
src/test/Project.xml
Normal file
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<!-- _________________________ Application Settings _________________________ -->
|
||||
|
||||
<app title="Test" file="Test" main="Main" version="0.0.1" company="NQNStudios" />
|
||||
|
||||
<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
|
||||
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
|
||||
<app preloader="flixel.system.FlxPreloader" />
|
||||
|
||||
<!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2-->
|
||||
<set name="SWF_VERSION" value="11.8" />
|
||||
|
||||
<!-- ____________________________ Window Settings ___________________________ -->
|
||||
|
||||
<!--These window settings apply to all targets-->
|
||||
<window width="1280" height="720" fps="60" background="#000000" hardware="true" vsync="false" resizable="false" />
|
||||
|
||||
<!--Desktop-specific-->
|
||||
<window if="desktop" orientation="landscape" fullscreen="false" />
|
||||
|
||||
<!--Mobile-specific-->
|
||||
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />
|
||||
|
||||
<!-- _____________________________ Path Settings ____________________________ -->
|
||||
|
||||
<set name="BUILD_DIR" value="export" />
|
||||
<classpath name="source" />
|
||||
<assets path="assets" />
|
||||
|
||||
<!-- _______________________________ Libraries ______________________________ -->
|
||||
|
||||
<haxelib name="flixel" />
|
||||
|
||||
<haxelib name="kiss" />
|
||||
<haxelib name="kiss-flixel" />
|
||||
|
||||
<haxeflag name="--macro" value="kiss.Kiss.setup()" />
|
||||
|
||||
<haxelib name="hollywoo" />
|
||||
<haxelib name="hollywoo-flixel" />
|
||||
|
||||
<!--In case you want to use the addons package-->
|
||||
<haxelib name="flixel-addons" />
|
||||
|
||||
<!--In case you want to use the ui package-->
|
||||
<haxelib name="flixel-ui" />
|
||||
|
||||
<!--In case you want to use nape with flixel-->
|
||||
<!--<haxelib name="nape-haxe4" />-->
|
||||
|
||||
<!-- ______________________________ Haxedefines _____________________________ -->
|
||||
|
||||
<haxedef name="profileKiss" unless="release" />
|
||||
<haxedef name="kissCache" />
|
||||
|
||||
<!--Enable the Flixel core recording system-->
|
||||
<!--<haxedef name="FLX_RECORD" />-->
|
||||
|
||||
<!--Disable the right and middle mouse buttons-->
|
||||
<!--<haxedef name="FLX_NO_MOUSE_ADVANCED" />-->
|
||||
|
||||
<!--Disable the native cursor API on Flash-->
|
||||
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->
|
||||
|
||||
<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->
|
||||
<haxedef name="FLX_NO_MOUSE" if="mobile" />
|
||||
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
|
||||
<haxedef name="FLX_NO_TOUCH" if="desktop" />
|
||||
<!--<haxedef name="FLX_NO_GAMEPAD" />-->
|
||||
|
||||
<!--Disable the Flixel core sound tray-->
|
||||
<!--<haxedef name="FLX_NO_SOUND_TRAY" />-->
|
||||
|
||||
<!--Disable the Flixel sound management code-->
|
||||
<!--<haxedef name="FLX_NO_SOUND_SYSTEM" />-->
|
||||
|
||||
<!--Disable the Flixel core focus lost screen-->
|
||||
<!--<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />-->
|
||||
|
||||
<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
|
||||
<haxedef name="FLX_NO_DEBUG" unless="debug" />
|
||||
|
||||
<!--Enable this for Nape release builds for a serious peformance improvement-->
|
||||
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />
|
||||
|
||||
<!-- _________________________________ Custom _______________________________ -->
|
||||
|
||||
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
|
||||
</project>
|
BIN
src/test/assets/blackSquare.png
Normal file
BIN
src/test/assets/blackSquare.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 819 B |
BIN
src/test/assets/grayBackground1000x720.png
Normal file
BIN
src/test/assets/grayBackground1000x720.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
src/test/assets/grayBackground1280x580.png
Normal file
BIN
src/test/assets/grayBackground1280x580.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
src/test/assets/grayBackground1280x720.png
Normal file
BIN
src/test/assets/grayBackground1280x720.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
src/test/assets/pageTurn.wav
Normal file
BIN
src/test/assets/pageTurn.wav
Normal file
Binary file not shown.
BIN
src/test/assets/whiteBackground1280x720.png
Normal file
BIN
src/test/assets/whiteBackground1280x720.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
src/test/assets/whiteSquare.png
Normal file
BIN
src/test/assets/whiteSquare.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
4
src/test/source/AssetPaths.hx
Normal file
4
src/test/source/AssetPaths.hx
Normal file
@@ -0,0 +1,4 @@
|
||||
package;
|
||||
|
||||
@:build(flixel.system.FlxAssets.buildFileReferences("assets", true))
|
||||
class AssetPaths {}
|
7
src/test/source/Main.hx
Normal file
7
src/test/source/Main.hx
Normal file
@@ -0,0 +1,7 @@
|
||||
package;
|
||||
|
||||
import flixel.FlxGame;
|
||||
import openfl.display.Sprite;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class Main extends Sprite {}
|
3
src/test/source/Main.kiss
Normal file
3
src/test/source/Main.kiss
Normal file
@@ -0,0 +1,3 @@
|
||||
(method new []
|
||||
(super)
|
||||
(addChild (new FlxGame 0 0 TestState 60 60 true false)))
|
39
src/test/source/Test.hollywoo
Normal file
39
src/test/source/Test.hollywoo
Normal file
@@ -0,0 +1,39 @@
|
||||
// When the sound device is non-functional, the FlxSound finish callback won't be called.
|
||||
// Don't let that stop Hollywoo:
|
||||
{(prop &mut soundPlayed false)(cc)}
|
||||
(preload
|
||||
(newFlxSound "pageFlip" AssetPaths.pageTurn__wav))
|
||||
{(delay 1 ->:Void (assert soundPlayed)) (cc)}
|
||||
AWAITPLAYSOUND "pageFlip"
|
||||
{(set soundPlayed true) (cc)}
|
||||
|
||||
// Through scene transitions, set background sprites need to maintain the same size.
|
||||
(defMacro makeSetAndScene [asset]
|
||||
`(preload
|
||||
(newFlxSet ,asset ,asset)
|
||||
(newSceneFromSet ,asset ,asset Day Exterior)))
|
||||
|
||||
(var basicSceneKey AssetPaths.whiteBackground1280x720__png)
|
||||
(makeSetAndScene basicSceneKey)
|
||||
(prop &mut sk "")
|
||||
(prop &mut firstWidth 0.0)
|
||||
(prop &mut firstHeight 0.0)
|
||||
(defMacro testSetBackground [asset]
|
||||
`(commands
|
||||
(makeSetAndScene ,asset)
|
||||
{(set sk ,asset) (cc)}
|
||||
SETSCENE sk
|
||||
(withSceneSet sk set
|
||||
(assert (or (= FlxG.width set.width) (= FlxG.height set.height)))
|
||||
(set firstWidth set.width)
|
||||
(set firstHeight set.height))
|
||||
SETSCENE basicSceneKey
|
||||
SETSCENE sk
|
||||
(withSceneSet sk set
|
||||
(assert (and (= firstWidth set.width) (= firstHeight set.height))))))
|
||||
|
||||
(testSetBackground AssetPaths.grayBackground1280x720__png)
|
||||
(testSetBackground AssetPaths.grayBackground1000x720__png)
|
||||
(testSetBackground AssetPaths.grayBackground1280x580__png)
|
||||
|
||||
(Sys.exit 0)
|
41
src/test/source/TestState.hx
Normal file
41
src/test/source/TestState.hx
Normal file
@@ -0,0 +1,41 @@
|
||||
package;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
import hollywoo_flixel.FlxDirector;
|
||||
import hollywoo_flixel.FlxMovie;
|
||||
import hollywoo_flixel.MovieFlxState;
|
||||
import hollywoo_flixel.ActorFlxSprite;
|
||||
import kiss_flixel.SpriteTools;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxSubState;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.tweens.FlxTween;
|
||||
|
||||
@:build(kiss.AsyncEmbeddedScript.build("hollywoo-flixel", "src/hollywoo_flixel/HollywooFlixelDSL.kiss", "Test.hollywoo"))
|
||||
class Test extends FlxMovie {
|
||||
public function new(director:FlxDirector) {
|
||||
super(director);
|
||||
}
|
||||
}
|
||||
|
||||
class TestState extends MovieFlxState {
|
||||
var t:Test;
|
||||
|
||||
public override function create() {
|
||||
super.create();
|
||||
t = new Test(director);
|
||||
t.run();
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
t.doCleanup();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
t.update(elapsed);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user