Skip to content

Instantly share code, notes, and snippets.

@savage69kr
Forked from tmskst/0.md
Last active August 29, 2015 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savage69kr/797e10e72808c80feab1 to your computer and use it in GitHub Desktop.
Save savage69kr/797e10e72808c80feab1 to your computer and use it in GitHub Desktop.
HaxeでStarlingとFeathersを使う

手順が複雑なのでバッチファイルを作った(build.bat)。

build.batの使い方

適当な新規ディレクトリを作成してbuild.batを保存。 同じ階層にplayerglobal14_0.swcを保存する。バッチファイルからplayerglobal14_0.swcを呼び出すのでリネームしないように。

要するに次のようになっていれば動くはず。

$ dir
2014/08/02  18:44    <DIR>          .
2014/08/02  18:44    <DIR>          ..
2014/08/02  18:25             2,967 build.bat
2014/08/02  17:13           384,758 playerglobal14_0.swc

準備ができたらバッチファイルを実行する。

バッチファイルを動かすとlibができるので、プロジェクトにこのディレクトリをコピーする。

あとは、hxmlファイルに-swf-libを追加すれば終わり。

### Starling
-swf-lib lib/starling/starling.swc
--macro patchTypes('lib/starling/starling.patch')

### Feathers
-swf-lib lib/feathers/feathers.swc
-swf-lib lib/feathers/MetalWorksDesktopTheme.swc

-swf-lib-extern lib/playerglobal14_0.swc

バッチでは、StarlingとFeathersのextern定義も生成しているのでlib/hxclassesにクラスパスを通せば補完が有効になる。


補足

  • http://feathersui.com/で配布されてるバイナリを-swf-libしても上手く動作しなかった。
  • StarlingについてはHaxeでStarlingを使うに書いてある通り。
  • バッチファイルはgitcompcを呼び出す。
@echo off
mkdir lib\starling
mkdir lib\feathers
if not exist starling (
git clone https://github.com/Gamua/Starling-Framework.git starling
)
cd lib\starling
echo -starling.core.RenderSupport.clear >> starling.patch
echo -starling.core.Starling.contentScaleFactor >> starling.patch
echo -starling.core.Starling.context >> starling.patch
echo -starling.core.Starling.juggler >> starling.patch
cd ..
cd ..
compc ^
-swf-version 23 ^
-source-path starling\starling\src ^
-include-sources starling\starling\src ^
-output lib\starling\starling.swc
if not exist feathers (
git clone https://github.com/joshtynjala/feathers feathers
)
compc ^
-swf-version 23 ^
-source-path feathers\source ^
-include-sources feathers\source ^
--external-library-path+=lib\starling\starling.swc ^
--external-library-path+=playerglobal14_0.swc ^
-output lib\feathers\feathers.swc
compc ^
-swf-version 23 ^
-source-path feathers\themes/AeonDesktopTheme/source ^
-include-sources feathers\themes/AeonDesktopTheme/source ^
--external-library-path+=lib\starling\starling.swc ^
--external-library-path+=lib\feathers\feathers.swc ^
-output lib\feathers\AeonDesktopTheme.swc
compc ^
-swf-version 23 ^
-source-path feathers\themes/MetalWorksDesktopTheme/source ^
-include-sources feathers\themes/MetalWorksDesktopTheme/source ^
--external-library-path+=lib\starling\starling.swc ^
--external-library-path+=lib\feathers\feathers.swc ^
-output lib\feathers\MetalWorksDesktopTheme.swc
compc ^
-swf-version 23 ^
-source-path feathers\themes/MetalWorksMobileTheme/source ^
-include-sources feathers\themes/MetalWorksMobileTheme/source ^
--external-library-path+=lib\starling\starling.swc ^
--external-library-path+=lib\feathers\feathers.swc ^
-output lib\feathers\MetalWorksMobileTheme.swc
rem compc ^
rem -swf-version 23 ^
rem -source-path feathers\themes/MinimalDesktopTheme/source ^
rem -include-sources feathers\themes/MinimalDesktopTheme/source ^
rem --external-library-path+=lib\starling\starling.swc ^
rem --external-library-path+=lib\feathers\feathers.swc ^
rem -output lib\feathers\MinimalDesktopTheme.swc
compc ^
-swf-version 23 ^
-source-path feathers\themes/MinimalMobileTheme/source ^
-include-sources feathers\themes/MinimalMobileTheme/source ^
--external-library-path+=lib\starling\starling.swc ^
--external-library-path+=lib\feathers\feathers.swc ^
-output lib\feathers\MinimalMobileTheme.swc
cd lib
haxe ^
-swf nothing.swf ^
--no-output ^
--gen-hx-classes ^
-swf-lib starling/starling.swc ^
--macro patchTypes('starling/starling.patch') ^
-swf-lib feathers/feathers.swc ^
-swf-lib-extern ../playerglobal14_0.swc
rename hxclasses tmp
mkdir hxclasses
move tmp\com hxclasses\com
move tmp\feathers hxclasses\feathers
move tmp\starling hxclasses\starling
rd /s /q tmp
cd ..
copy playerglobal14_0.swc lib\playerglobal14_0.swc
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment