-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extracted preloader, performance optimizations
- Loading branch information
1 parent
8bb3651
commit 38aee16
Showing
24 changed files
with
906 additions
and
414 deletions.
There are no files selected for viewing
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
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
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
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
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); | ||
} | ||
} |
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
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
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
Oops, something went wrong.