Skip to content

Instantly share code, notes, and snippets.

View louisbl's full-sized avatar

Louis Beltramo louisbl

  • Annecy
View GitHub Profile
@louisbl
louisbl / pixelRound.jsfl
Created January 6, 2012 09:15
JSFL round to pixel every items in library
var curr_doc = fl.getDocumentDOM();
fl.getDocumentDOM().library.selectAll();
for(i=0 ; i<curr_doc.selection.length ; i++ ) {
curr_doc.selection[i].x = Math.round(curr_doc.selection[i].x);
curr_doc.selection[i].y = Math.round(curr_doc.selection[i].y);
}
@louisbl
louisbl / zeroPad.as3
Created January 12, 2012 11:38
Zero pad for as"
public function zeroPad(number:int, width:int):String {
var ret:String = ""+number;
while( ret.length < width )
ret="0" + ret;
return ret;
}
@louisbl
louisbl / BasicScoreModule.as
Created June 6, 2012 07:05
Nested dataprovider - binding
public class BasicScoreModule implements IScoreModule
{
[Bindable]
public var score : int;
private var _nom : String;
private var _viewClass : Class;
public function BasicScoreModule()
{
_nom = 'basic score';
@louisbl
louisbl / HaXe.tmLanguage
Created September 24, 2012 17:37
Change color of trace in Haxe2 for sublime text
<dict>
<key>begin</key>
<string>\btrace\s*\(</string>
<key>end</key>
<string>\s*\)</string>
<key>name</key>
<string>keyword.other.trace.haxe.2</string>
</dict>
@louisbl
louisbl / gist:3832164
Created October 4, 2012 08:17 — forked from tynril/gist:3276916
Patch for HXCPP (r559) to disable buffering on standard out (fixes the issue regarding traces displayed at process exit)
Index: include/hx/StdLibs.h
===================================================================
--- include/hx/StdLibs.h (revision 559)
+++ include/hx/StdLibs.h (working copy)
@@ -32,6 +32,7 @@
void __hxcpp_print(Dynamic &inV);
void __hxcpp_println(Dynamic &inV);
void __trace(Dynamic inPtr, Dynamic inData);
+void __hxcpp_stdlibs_boot();
@louisbl
louisbl / android-toolchain.xml
Created October 18, 2012 13:13
hxcpp Android toolchain for NDK 8b
<xml>
<!-- Android TOOLS -------------------------------------->
<include name="gcc-toolchain.xml"/>
<path name="${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4.6/prebuilt/${ANDROID_HOST}/bin"/>
<set name="ARCH" value ="-7" if="HXCPP_ARMV7" />
@louisbl
louisbl / Thread.cpp
Created October 18, 2012 15:32
hxcpp Set stack size of thread
pthread_attr_t attr;
pthread_attr_t *attrp;
pthread_t result;
int stack_size;
void *sp;
stack_size = 0x32000000;
attrp = &attr;
pthread_attr_init(&attr);
@louisbl
louisbl / robot.js
Created December 6, 2012 16:11 — forked from f6p/robot.js
DumberZero
// helpers
function areEnemies(robot, sighted) {
var sightedIsChild = (robot.id == sighted.parentId);
var sightedIsParent = (robot.parentId == sighted.id);
return !(sightedIsChild || sightedIsParent);
};
function baseStep(robot) {
@louisbl
louisbl / robot.js
Created December 6, 2012 16:14
DumberOne
var Robot = function(robot) {
robot.ahead(100);
robot.clone();
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(50);
robot.rotateCannon(45);
};
@louisbl
louisbl / Stats.hx
Last active December 14, 2015 04:39 — forked from profelis/Stats.hx
H3D engine Stats
/**
* stats.hx
* http://github.com/mrdoob/stats.as
*
* Released under MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* How to use:
*
* addChild( new Stats(engine) );