Genome2D是一個高效的2D引擎,現在支援Flash(stage3d)和HTML5,因為只有作者一個人在維護,就沒開原始碼。
最近和作者溝通了下,已經開源啦。
作者劃分了幾個模組,編譯起來不是特別方便,這裡就簡單介紹下Flash的編譯方法。
因為作者把程式碼轉換到haxe上,所以要安裝haxe,現在Genome2D的版本是1.0.277,haxe版本3.1.3。
怎麼安裝haxe和git就不用講了吧?一下是本地資料夾和git的對應關係:
genome2d
core git@github.com:pshtif/Genome2D-Core.git
context
flash git@github.com:pshtif/Genome2D-ContextFlash.git
common git@github.com:pshtif/Genome2D-ContextCommon.git
out
其中out是輸出目錄,按照上面的對應關係clone好後,在genome2d目錄下,命令列執行haxe core\build\swc.hxml就生成swc,
不要以為到這裡就完成了,因為haxe在連結時,不會連結lib的catalog,所以要用winrar之類的開啟swc新增AGAL的catalog,不然會編譯報錯。
<script name="com/adobe/utils/extended/AGALMiniAssembler" mod="1407288430000"> <def id="com.adobe.utils.extended:AGALMiniAssembler"/> <dep id="Array" type="e"/> <dep id="Boolean" type="s"/> <dep id="Number" type="e"/> <dep id="Object" type="i"/> <dep id="RegExp" type="s"/> <dep id="String" type="s"/> <dep id="flash.display3D:Context3D" type="s"/> <dep id="flash.display3D:Program3D" type="e"/> <dep id="flash.utils:ByteArray" type="s"/> <dep id="flash.utils:Dictionary" type="e"/> <dep id="flash.utils:Endian" type="e"/> <dep id="flash.utils:getTimer" type="e"/> <dep id="int" type="s"/> <dep id="trace" type="e"/> <dep id="uint" type="s"/> </script> <script name="fl
如果你要編譯HTML5版本的,可自己研究下,比Flash版本的容易。
最後放上作者的github地址:https://github.com/pshtif,感興趣的同學可以自己去研究下。