-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some placeholders for html5 platform
- Loading branch information
Showing
8 changed files
with
142 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import sys.FileSystem; | ||
using StringTools; | ||
|
||
class Lyre | ||
{ | ||
|
||
public static function runRecurse(srcDir:String, destDir:String, copyDir:String, srcPack:String, destPack:String) | ||
{ | ||
try | ||
{ | ||
if (!FileSystem.exists(destDir)) | ||
FileSystem.createDirectory(destDir); | ||
if (!FileSystem.exists(copyDir)) | ||
FileSystem.createDirectory(copyDir); | ||
for(file in FileSystem.readDirectory(srcDir)) | ||
{ | ||
if (file=="_legacy") | ||
continue; | ||
|
||
var srcPath = srcDir +"/" + file; | ||
var destPath = destDir +"/" + file; | ||
var copyPath = copyDir +"/" + file; | ||
|
||
if (FileSystem.isDirectory(srcPath)) | ||
runRecurse(srcPath, destPath, copyPath, srcPack+"."+file, destPack+"."+file); | ||
else if (file.endsWith(".hx")) | ||
{ | ||
Sys.println("Writing " + destPath); | ||
var clazz = file.substr(0, file.length-3); | ||
var content = [ | ||
'package $destPack;', | ||
'typedef $clazz=$srcPack.$clazz;', | ||
].join("\n"); | ||
sys.io.File.saveContent(destPath,content); | ||
|
||
Sys.println("Copy " + copyPath); | ||
sys.io.File.copy(srcPath, copyPath); | ||
} | ||
} | ||
} | ||
catch(e:Dynamic) | ||
{ | ||
trace("Error " + e); | ||
} | ||
} | ||
|
||
public static function main() | ||
{ | ||
var args = Sys.args(); | ||
var srcDir = args[0]; | ||
var destDir = args[1]; | ||
var packName = args[2]; | ||
|
||
if (packName==null || !FileSystem.isDirectory(srcDir) || !FileSystem.isDirectory(destDir)) | ||
{ | ||
Sys.println("Usage : lyre srcDir destDir packageName"); | ||
Sys.exit(0); | ||
} | ||
runRecurse(srcDir + "/" + packName, destDir + "/nme", destDir+"/"+packName, packName, "nme" ); | ||
} | ||
} |
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,3 @@ | ||
-main Lyre | ||
-neko lyre.n | ||
-debug |
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,60 @@ | ||
package platforms; | ||
|
||
import haxe.io.Path; | ||
import haxe.Template; | ||
import sys.io.File; | ||
import sys.FileSystem; | ||
|
||
|
||
class Html5Platform extends Platform | ||
{ | ||
private var applicationDirectory:String; | ||
|
||
public function new(inProject:NMEProject) | ||
{ | ||
inProject.openflCompat = false; | ||
super(inProject); | ||
|
||
applicationDirectory = getOutputDir(); | ||
|
||
project.haxeflags.push('-js $haxeDir/ApplicationMain.js'); | ||
} | ||
|
||
override public function getPlatformDir() : String { return "html5"; } | ||
override public function getBinName() : String { return null; } | ||
override public function getNativeDllExt() { return null; } | ||
override public function getLibExt() { return null; } | ||
override public function getHaxeTemplateDir() { return "haxe"; } | ||
override public function getAssetDir() { return getOutputDir()+"/assets"; } | ||
|
||
|
||
override public function copyBinary():Void | ||
{ | ||
FileHelper.copyFile('$haxeDir/ApplicationMain.js', | ||
'$applicationDirectory/ApplicationMain.js', addOutput); | ||
} | ||
|
||
override public function updateOutputDir():Void | ||
{ | ||
super.updateOutputDir(); | ||
|
||
var destination = getOutputDir(); | ||
var icon = IconHelper.getSvgIcon(project.icons); | ||
if (icon!=null) | ||
{ | ||
FileHelper.copyFile(icon, destination + "/icon.svg", addOutput); | ||
} | ||
else | ||
IconHelper.createIcon(project.icons, 128, 128, destination + "/icon.png", addOutput); | ||
} | ||
|
||
|
||
override public function run(arguments:Array<String>):Void | ||
{ | ||
var fullPath = FileSystem.fullPath('$applicationDirectory/ApplicationMain.js'); | ||
trace("TODO " + fullPath); | ||
} | ||
} | ||
|
||
|
||
|
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