Updating templates path
This commit is contained in:
31
templates/html5/haxe/ApplicationMain.hx
Executable file
31
templates/html5/haxe/ApplicationMain.hx
Executable file
@@ -0,0 +1,31 @@
|
||||
#if lime_html5
|
||||
|
||||
import ::APP_MAIN_PACKAGE::::APP_MAIN_CLASS::;
|
||||
import lime.LiME;
|
||||
|
||||
class ApplicationMain {
|
||||
|
||||
public static function main () {
|
||||
|
||||
|
||||
|
||||
//Create the game class, give it the runtime
|
||||
var _main_ = Type.createInstance (::APP_MAIN::, []);
|
||||
//Create an instance of lime
|
||||
var _lime = new LiME();
|
||||
|
||||
//Create the config from the project.nmml info
|
||||
var config = {
|
||||
width : ::WIN_WIDTH::,
|
||||
height : ::WIN_HEIGHT::,
|
||||
title : "::APP_TITLE::"
|
||||
};
|
||||
|
||||
//Start up
|
||||
_lime.init( _main_, config );
|
||||
|
||||
} //main
|
||||
} //ApplicationMain
|
||||
|
||||
|
||||
#end //lime_html5
|
||||
113
templates/html5/haxe/NMEPreloader.hx
Normal file
113
templates/html5/haxe/NMEPreloader.hx
Normal file
@@ -0,0 +1,113 @@
|
||||
// import flash.display.Sprite;
|
||||
// import flash.events.Event;
|
||||
|
||||
|
||||
class NMEPreloader // extends Sprite
|
||||
{
|
||||
// private var outline:Sprite;
|
||||
// private var progress:Sprite;
|
||||
|
||||
public function new()
|
||||
{
|
||||
// super();
|
||||
|
||||
// var backgroundColor = getBackgroundColor ();
|
||||
// var r = backgroundColor >> 16 & 0xFF;
|
||||
// var g = backgroundColor >> 8 & 0xFF;
|
||||
// var b = backgroundColor & 0xFF;
|
||||
// var perceivedLuminosity = (0.299 * r + 0.587 * g + 0.114 * b);
|
||||
// var color = 0x000000;
|
||||
|
||||
// if (perceivedLuminosity < 70) {
|
||||
|
||||
// color = 0xFFFFFF;
|
||||
|
||||
// }
|
||||
|
||||
// var x = 30;
|
||||
// var height = 9;
|
||||
// var y = getHeight () / 2 - height / 2;
|
||||
// var width = getWidth () - x * 2;
|
||||
|
||||
// var padding = 3;
|
||||
|
||||
// outline = new Sprite ();
|
||||
// outline.graphics.lineStyle (1, color, 0.15, true);
|
||||
// outline.graphics.drawRoundRect (0, 0, width, height, padding * 2, padding * 2);
|
||||
// outline.x = x;
|
||||
// outline.y = y;
|
||||
// addChild (outline);
|
||||
|
||||
// progress = new Sprite ();
|
||||
// progress.graphics.beginFill (color, 0.35);
|
||||
// progress.graphics.drawRect (0, 0, width - padding * 2, height - padding * 2);
|
||||
// progress.x = x + padding;
|
||||
// progress.y = y + padding;
|
||||
// progress.scaleX = 0;
|
||||
// addChild (progress);
|
||||
}
|
||||
|
||||
|
||||
public function getBackgroundColor():Int
|
||||
{
|
||||
return ::WIN_BACKGROUND::;
|
||||
}
|
||||
|
||||
|
||||
public function getHeight():Float
|
||||
{
|
||||
var height = ::WIN_HEIGHT::;
|
||||
|
||||
if (height > 0) {
|
||||
|
||||
return height;
|
||||
|
||||
} else {
|
||||
|
||||
return 640;// flash.Lib.current.stage.stageHeight;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getWidth():Float
|
||||
{
|
||||
var width = ::WIN_WIDTH::;
|
||||
|
||||
if (width > 0) {
|
||||
|
||||
return width;
|
||||
|
||||
} else {
|
||||
|
||||
return 960;// todo flash.Lib.current.stage.stageWidth;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function onInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function onLoaded() {
|
||||
// dispatchEvent (new Event (Event.COMPLETE));
|
||||
}
|
||||
|
||||
|
||||
public function onUpdate(bytesLoaded:Int, bytesTotal:Int) {
|
||||
|
||||
var percentLoaded = bytesLoaded / bytesTotal;
|
||||
|
||||
if (percentLoaded > 1)
|
||||
{
|
||||
percentLoaded == 1;
|
||||
}
|
||||
|
||||
progress.scaleX = percentLoaded;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
36
templates/html5/haxe/lime/AssetData.hx
Normal file
36
templates/html5/haxe/lime/AssetData.hx
Normal file
@@ -0,0 +1,36 @@
|
||||
package lime;
|
||||
|
||||
|
||||
import lime.utils.Assets;
|
||||
|
||||
|
||||
class AssetData {
|
||||
|
||||
private static var initialized:Bool = false;
|
||||
|
||||
public static var className = new Map <String, Dynamic> ();
|
||||
public static var library = new Map <String, LibraryType> ();
|
||||
public static var path = new Map <String, String> ();
|
||||
public static var type = new Map <String, AssetType> ();
|
||||
|
||||
public static function initialize():Void {
|
||||
|
||||
if (!initialized) {
|
||||
|
||||
::if (assets != null)::::foreach assets::::if (type == "font")::className.set ("::id::", nme.lime_::flatName::);::else::path.set ("::id::", "::resourceName::");::end::
|
||||
type.set ("::id::", Reflect.field (AssetType, "::type::".toUpperCase ()));
|
||||
::end::::end::
|
||||
::if (libraries != null)::::foreach libraries::library.set ("::name::", Reflect.field (LibraryType, "::type::".toUpperCase ()));
|
||||
::end::::end::
|
||||
initialized = true;
|
||||
|
||||
} //initialized
|
||||
|
||||
} //initialize
|
||||
|
||||
|
||||
} //AssetData
|
||||
|
||||
|
||||
::foreach assets::::if (type == "font")::class lime_::flatName:: extends flash.text.Font { }::end::
|
||||
::end::
|
||||
8
templates/html5/hxml/debug.hxml
Executable file
8
templates/html5/hxml/debug.hxml
Executable file
@@ -0,0 +1,8 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-js ::OUTPUT_FILE::
|
||||
-cp ::OUTPUT_DIR::/haxe
|
||||
-D html5
|
||||
-D html
|
||||
--remap flash:lime
|
||||
-debug
|
||||
#--js-modern
|
||||
7
templates/html5/hxml/release.hxml
Executable file
7
templates/html5/hxml/release.hxml
Executable file
@@ -0,0 +1,7 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-js ::OUTPUT_FILE::
|
||||
-cp ::OUTPUT_DIR::/haxe
|
||||
-D html5
|
||||
-D html
|
||||
--remap flash:lime
|
||||
#--js-modern
|
||||
BIN
templates/html5/hxswfml.n
Executable file
BIN
templates/html5/hxswfml.n
Executable file
Binary file not shown.
42
templates/html5/template/index.html
Executable file
42
templates/html5/template/index.html
Executable file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>::APP_TITLE::</title>
|
||||
|
||||
<style>
|
||||
#lime_canvas {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: ::WIN_WIDTH::px;
|
||||
height: ::WIN_HEIGHT::px;
|
||||
margin-left:-50%;
|
||||
left:50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="padding: 0; margin: 0; background-color: #FFFFFF;">
|
||||
|
||||
<!-- <div id="haxe:trace" style="position: absolute; z-index: 2147483647;::if !debug:: display: none;::end::"></div> -->
|
||||
|
||||
::if (LIB_NME)::
|
||||
|
||||
<div id="haxe:jeash" style="background-color: #::WIN_FLASHBACKGROUND::; width: ::if (WIN_WIDTH == 0)::100%::else::::WIN_WIDTH::px::end::; height: ::if (WIN_HEIGHT == 0)::100%::else::::WIN_HEIGHT::px::end::" data-framerate="::WIN_FPS::"></div>
|
||||
|
||||
::if DEBUG::<script type="text/javascript" src="./webgl-debug.js"></script>::end::
|
||||
|
||||
<script>function winParameters () { return ::WIN_PARAMETERS::; }</script>
|
||||
<script id="haxe:jeash:script" type="text/javascript" src="./::APP_FILE::.js"></script>
|
||||
|
||||
::else::
|
||||
|
||||
<script type="text/javascript" src="./::APP_FILE::.js"></script>
|
||||
|
||||
::end::
|
||||
|
||||
::if DEBUG::<script type="text/javascript" src="./webgl-debug.js"></script>::end::
|
||||
<canvas id="lime_canvas" tabindex="1" width="::WIN_WIDTH::" height="::WIN_HEIGHT::">
|
||||
</canvas>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user