Skip to content

Instantly share code, notes, and snippets.

@tmskst
tmskst / 0.md
Last active August 29, 2015 14:07
HaxeでAlternativa3Dを使う

Alternativa3Dをクローンしておく。

最初にcompcでSWCを生成する。コマンドは次の通り。

compc ^
	-swf-version 23 ^
	-source-path src ^
	-include-sources src ^
	--external-library-path+=libs\A3DModelsBase-2.5.2.swc ^
@tmskst
tmskst / 0.md
Created August 2, 2014 09:51
HaxeでStarlingとFeathersを使う

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

build.batの使い方

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

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

$ dir
@tmskst
tmskst / gist:302e20c437cebe789316
Created June 17, 2014 18:08
MUnitのテスト結果をNanoTestでIDEに出力

MUnitのTestMain.hxを書き換える。 addResultClientPrintClientBaseを与える。

// TestMain.hx#new
var runner:TestRunner = new TestRunner(client); 
runner.addResultClient(new HTTPClient(new PrintClientBase()));

すると例えばターゲットがAS3ならば、report/test/simple/as3/output.txtが出力されるので

(function () { "use strict";
var Main = function() { };
Main.main = function() {
var vTimes = 2;
var timeline = jsfl.Lib.fl.getDocumentDOM().getTimeline();
var _g1 = 0;
var _g = timeline.layerCount;
while(_g1 < _g) {
var layerIndex = _g1++;
var layer = timeline.layers[layerIndex];
@tmskst
tmskst / gist:19e22745459fc757fa81
Last active August 29, 2015 14:02
FlashCCが生成するスプライトシートのSubTexture.@nameをSymbolItem.nameに書き換える

例えばデータ形式をStarlingに設定したときの話。

C:\Program Files\Adobe\Adobe Flash CC\Common\Configuration\Sprite Sheet Plugins にある Starling.plugin.jsflframeExportメソッドを書き換える。

function frameExport(frame) {
	var frameId = frame.id;
	if (frame.symbol != null && frame.frameSource instanceof SymbolItem) {
		frameId = frame.frameSource.name;
		var frameNumber = ('0000' + frame.frameNumber).slice(-4);
@tmskst
tmskst / MeasureCyclomaticComplexity.hx
Created May 25, 2014 17:30
CyclomaticComplexity の計測
package ;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Expr.Field;
import haxe.macro.Expr.FieldType;
import haxe.macro.Expr.Function;
import haxe.macro.ExprTools;
using Lambda;
@tmskst
tmskst / compile.hxml
Last active August 10, 2016 07:13
HaxeでStarlingを使う
-swf-lib ./lib/starling.swc
--macro patchTypes('starling.patch')
@tmskst
tmskst / gist:9803433
Created March 27, 2014 09:07
hxcppのコンパイルにTDM-GCCを使う

hxcppがインストールされていればホームディレクトリに「.hxcpp_config.xml」というファイルがあるのでこれを編集する。

varsセクション以下に 「toolchain」に「mingw」を、「MINGW_ROOT」に「TDM-GCCをインストールしたパス」を設定する。

<section id="vars">
	<!-- ... -->
	<set name="toolchain" value="mingw" />
	
@tmskst
tmskst / gist:9767462
Last active August 29, 2015 13:57
FlashDevelopからmunitを実行する

Project Properties -> Build Tab -> Pre-Build Command Line に記述。
Output Tab -> Platform -> Compilation を Custom Buildに設定するのを忘れずに。

  $(CompilerPath)\haxelib.exe run munit test -as3 -js
  $(CompilerPath)\haxe.exe $(ProjectDir)\compile.hxml