Updating templates path

This commit is contained in:
underscorediscovery
2013-11-28 01:23:25 -03:30
parent b809d8cc68
commit ba35d41715
70 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
import ::APP_MAIN::;
import lime.LiME;
class ApplicationMain {
public static var _main_ : ::APP_MAIN::;
public static var _lime : LiME;
public static function main () {
//Create the runtime
_lime = new LiME();
//Create the game class, give it the runtime
_main_ = new ::APP_MAIN::();
var config = {
fullscreen : ::WIN_FULLSCREEN::,
resizable : ::WIN_RESIZABLE::,
borderless : ::WIN_BORDERLESS::,
aliasing : ::WIN_ANTIALIASING::,
stencil_buffer : ::WIN_STENCIL_BUFFER::,
depth_buffer : ::WIN_DEPTH_BUFFER::,
vsync : ::WIN_VSYNC::,
fps : ::WIN_FPS::,
width : ::WIN_WIDTH::,
height : ::WIN_HEIGHT::,
title : "::APP_TITLE::"
};
//Start up
_lime.init( _main_, config );
}
}

View File

@@ -0,0 +1,31 @@
package lime;
import lime.utils.Assets;
class AssetData {
private static var initialized:Bool = false;
public static var library = new #if haxe3 Map <String, #else Hash <#end LibraryType> ();
public static var path = new #if haxe3 Map <String, #else Hash <#end String> ();
public static var type = new #if haxe3 Map <String, #else Hash <#end AssetType> ();
public static function initialize():Void {
if (!initialized) {
::if (assets != null)::::foreach assets::path.set ("::id::", "::resourceName::");
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

View File

@@ -0,0 +1,115 @@
import nme.display.Sprite;
import nme.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 nme.Lib.current.stage.stageHeight;
}
}
public function getWidth():Float
{
var width = ::WIN_WIDTH::;
if (width > 0) {
return width;
} else {
return nme.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;
}
}