Skip to content

Commit

Permalink
added error display,
Browse files Browse the repository at this point in the history
extracted preloader,
performance optimizations
  • Loading branch information
Britzpetermann committed Oct 19, 2011
1 parent 8bb3651 commit 38aee16
Show file tree
Hide file tree
Showing 24 changed files with 906 additions and 414 deletions.
2 changes: 1 addition & 1 deletion MEIKYO/construct/src/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Main {
}
catch(e : Dynamic)
{
Log.error("Error building application! \n" + e);
Log.error("Error building application!\n" + e);
}

var i = 1 | 1 << 16;
Expand Down
2 changes: 2 additions & 0 deletions MEIKYO/construct/src/kumite/launch/Config.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ class Config implements Infos
{
public var sequencer : Sequencer;
public var launcher : Launcher;
public var preloadDisplay : PreloadDisplay;

public function new()
{
launcher = new Launcher();
sequencer = new Sequencer();
preloadDisplay = new PreloadDisplay();
}
}
15 changes: 6 additions & 9 deletions MEIKYO/construct/src/kumite/launch/Launcher.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package kumite.launch;

import js.Lib;
import js.Dom;
import bpmjs.ProgressMonitor;

import haxe.rtti.Infos;

class Launcher implements Infos
Expand All @@ -12,19 +16,12 @@ class Launcher implements Infos
@PostComplete
public function handlePostComplete()
{
Log.info();
sequencer.start("boot");
}

@Sequence("boot", "error")
public function showError()
public function showError(message : String)
{
//Log.error(sequencer.error);
Log.error(message);
}

@Sequence("boot", "percent")
public function bootPercent(value : Float)
{
Log.info(value);
}
}
53 changes: 53 additions & 0 deletions MEIKYO/construct/src/kumite/launch/PreloadDisplay.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package kumite.launch;

import js.Lib;
import js.Dom;
import bpmjs.ProgressMonitor;

import haxe.rtti.Infos;

class PreloadDisplay implements Infos
{
var preloaderDiv : HtmlDom;

public function new();

@Complete
public function complete()
{
preloaderDiv = Lib.document.createElement("div");
preloaderDiv.className = "Preloader";
Lib.document.body.appendChild(preloaderDiv);
}

@Sequence("boot", "monitor")
public function bootMonitor(monitor : ProgressMonitor)
{
var bar = "";
var count = 10;
for(i in 0...count)
{
var from = i / count;
var to = (i + 1) / count;
var diff = Map.linear(monitor.current, from, to, 0, 1);
if (diff < 0) diff = 0;
if (diff > 1) diff = 1;
var chars = "▁▂▃▄▅▆▇";
bar += chars.charAt(Std.int(diff * (chars.length - 1)));
}
preloaderDiv.innerHTML = "" + bar;
}

@Sequence("boot", "startComplete")
public function bootStartComplete()
{
untyped preloaderDiv.style.opacity = 0.8;
GLTween.to(preloaderDiv.style, 1000, {opacity : 0});
Timeout.execute(1000, removePreloader);
}

function removePreloader()
{
Lib.document.body.removeChild(preloaderDiv);
}
}
6 changes: 3 additions & 3 deletions MEIKYO/construct/src/kumite/scene/DelegateLayer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DelegateLayer extends Layer
}
catch(e : Dynamic)
{
Log.error("Error initializing layer:", layerId, e);
Log.error("Error initializing layer:\n" + layerId, e);
}
}

Expand All @@ -32,7 +32,7 @@ class DelegateLayer extends Layer
}
catch(e : Dynamic)
{
Log.error("Error rendering layer:", layerId, e);
Log.error("Error rendering layer:\n" + layerId, e);
}
}

Expand All @@ -44,7 +44,7 @@ class DelegateLayer extends Layer
}
catch(e : Dynamic)
{
Log.error("Error rendering layer:", layerId, e);
Log.error("Error rendering layer:\n" + layerId, e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion MEIKYO/construct/src/kumite/scene/SceneNavigator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class TransitionState extends State
override function enter()
{
enterTime = time.ms;
exitTime = time.ms + 8000;
exitTime = time.ms + 5000;

transitionContext.transition = 0;
transitionContext.outScene = navigator.lastScene;
Expand Down
1 change: 1 addition & 0 deletions MEIKYO/construct/src/kumite/spritemesh/Sprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kumite.spritemesh;
class Sprite
{
public var matrix : Matrix4;
public var image : GLTextureAtlasPartConfig;

public var vertexes : Float32Array;
public var normals : Float32Array;
Expand Down
Loading

0 comments on commit 38aee16

Please sign in to comment.