Remove older OpenFL compatibility guards
This commit is contained in:
@@ -17,8 +17,8 @@ import lime.utils.ByteArray;
|
||||
* embedded images, fonts, sounds and other resource files.</p>
|
||||
*
|
||||
* <p>The contents are populated automatically when an application
|
||||
* is compiled using the OpenFL command-line tools, based on the
|
||||
* contents of the *.nmml project file.</p>
|
||||
* is compiled using the Lime command-line tools, based on the
|
||||
* contents of the *.xml project file.</p>
|
||||
*
|
||||
* <p>For most platforms, the assets are included in the same directory
|
||||
* or package as the application, and the paths are handled
|
||||
@@ -190,7 +190,7 @@ class Assets {
|
||||
* @param id The ID or asset path for the font
|
||||
* @return A new Font object
|
||||
*/
|
||||
public static function getFont (id:String, useCache:Bool = true):#if (openfl < "3.0.0") Dynamic #else Font #end {
|
||||
public static function getFont (id:String, useCache:Bool = true):Font {
|
||||
|
||||
initialize ();
|
||||
|
||||
@@ -1002,7 +1002,7 @@ class AssetLibrary {
|
||||
}
|
||||
|
||||
|
||||
public function getFont (id:String):#if (openfl < "3.0.0") Dynamic #else Font #end {
|
||||
public function getFont (id:String):Font {
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1090,7 +1090,7 @@ class AssetLibrary {
|
||||
}
|
||||
|
||||
|
||||
public function loadFont (id:String, handler:#if (openfl < "3.0.0") Dynamic #else Font #end -> Void):Void {
|
||||
public function loadFont (id:String, handler:Font -> Void):Void {
|
||||
|
||||
handler (getFont (id));
|
||||
|
||||
@@ -1397,7 +1397,7 @@ class Assets {
|
||||
if (path != null && path != "") {
|
||||
|
||||
#if html5
|
||||
Sys.command ("haxelib", [ "run", "openfl", "generate", "-font-hash", sys.FileSystem.fullPath(path) ]);
|
||||
Sys.command ("haxelib", [ "run", "lime", "generate", "-font-hash", sys.FileSystem.fullPath(path) ]);
|
||||
path += ".hash";
|
||||
#end
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package lime.graphics;
|
||||
|
||||
|
||||
#if (openfl < "3.0.0")
|
||||
|
||||
|
||||
class Font extends lime.text.Font {
|
||||
|
||||
|
||||
public var fontName (get, set):String;
|
||||
|
||||
|
||||
public function new (fontName:String = null) {
|
||||
|
||||
super (fontName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Get & Set Methods
|
||||
|
||||
|
||||
|
||||
|
||||
private function get_fontName ():String {
|
||||
|
||||
return name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function set_fontName (value:String):String {
|
||||
|
||||
return name = value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#end
|
||||
@@ -725,13 +725,6 @@ class HXProject {
|
||||
project.haxelibs = [];
|
||||
|
||||
for (haxelib in haxelibs) {
|
||||
|
||||
/*if (haxelib.name == "nme" && userDefines.exists ("openfl")) {
|
||||
|
||||
haxelib.name = "openfl-nme-compatibility";
|
||||
haxelib.version = "";
|
||||
|
||||
}*/
|
||||
|
||||
project.haxelibs.push (haxelib);
|
||||
|
||||
|
||||
@@ -256,27 +256,19 @@ class DefaultAssetLibrary extends AssetLibrary {
|
||||
}
|
||||
|
||||
|
||||
public override function getFont (id:String):#if (openfl < "3.0.0") Dynamic #else Font #end {
|
||||
public override function getFont (id:String):Font {
|
||||
|
||||
#if flash
|
||||
|
||||
var src = Type.createInstance (className.get (id), []);
|
||||
#if (openfl < "3.0.0")
|
||||
return src;
|
||||
#else
|
||||
|
||||
var font = new Font (src.fontName);
|
||||
font.src = src;
|
||||
return font;
|
||||
#end
|
||||
|
||||
#elseif html5
|
||||
|
||||
#if (openfl < "3.0.0")
|
||||
var limeFont:Font = cast (Type.createInstance (className.get (id), []), Font);
|
||||
return new openfl.text.Font (limeFont.name);
|
||||
#else
|
||||
return cast (Type.createInstance (className.get (id), []), Font);
|
||||
#end
|
||||
|
||||
#else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user