Remove older OpenFL compatibility guards

This commit is contained in:
Joshua Granick
2015-03-26 11:26:50 -07:00
parent e37cfa9961
commit b43d2738ee
4 changed files with 8 additions and 68 deletions

View File

@@ -17,8 +17,8 @@ import lime.utils.ByteArray;
* embedded images, fonts, sounds and other resource files.</p> * embedded images, fonts, sounds and other resource files.</p>
* *
* <p>The contents are populated automatically when an application * <p>The contents are populated automatically when an application
* is compiled using the OpenFL command-line tools, based on the * is compiled using the Lime command-line tools, based on the
* contents of the *.nmml project file.</p> * contents of the *.xml project file.</p>
* *
* <p>For most platforms, the assets are included in the same directory * <p>For most platforms, the assets are included in the same directory
* or package as the application, and the paths are handled * 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 * @param id The ID or asset path for the font
* @return A new Font object * @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 (); 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; 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)); handler (getFont (id));
@@ -1397,7 +1397,7 @@ class Assets {
if (path != null && path != "") { if (path != null && path != "") {
#if html5 #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"; path += ".hash";
#end #end

View File

@@ -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

View File

@@ -725,13 +725,6 @@ class HXProject {
project.haxelibs = []; project.haxelibs = [];
for (haxelib in haxelibs) { for (haxelib in haxelibs) {
/*if (haxelib.name == "nme" && userDefines.exists ("openfl")) {
haxelib.name = "openfl-nme-compatibility";
haxelib.version = "";
}*/
project.haxelibs.push (haxelib); project.haxelibs.push (haxelib);

View File

@@ -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 #if flash
var src = Type.createInstance (className.get (id), []); var src = Type.createInstance (className.get (id), []);
#if (openfl < "3.0.0")
return src;
#else
var font = new Font (src.fontName); var font = new Font (src.fontName);
font.src = src; font.src = src;
return font; return font;
#end
#elseif html5 #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); return cast (Type.createInstance (className.get (id), []), Font);
#end
#else #else