Skip to content

Instantly share code, notes, and snippets.

View AxGord's full-sized avatar
🦄
Pony

Alexander Gordeyko AxGord

🦄
Pony
View GitHub Profile
class Test {
static function main() {
var a = new SmartArray([1, 2, 3]);
for (e in a) {
trace(e);
if (e == 2) a.remove(1);
}
}
}
class Test {
static function main() {
var a = new Priority();
a.add(3, 2);
a.add(1, 1);
trace(a.a);
}
}
var w = Config.width;
var h = Config.height;
var space:NapeSpaceView = new NapeSpaceView(new Point<Float>(0, 600));
space.debugLines = {size: 3, color: 0xFFFFFF};
c.addChild(space);
space.createStaticRect(new Rect<Float>(50, h - 50, w - 100, 1));
space.createStaticRect(new Rect<Float>(w - 50, 50, 1, h - 100));
@AxGord
AxGord / GenericBuildMacro.hx
Created June 9, 2018 15:35
Generic macro abstract function!
import haxe.macro.TypeTools;
import haxe.macro.Expr;
import haxe.macro.Context;
import haxe.macro.Type;
class GenericBuildMacro {
static public function build():ComplexType {
@AxGord
AxGord / ParentClass.hx
Created February 24, 2016 11:10
Asset managet example
/**
* ParentClass
* @author AxGord <axgord@gmail.com>
*/
@:assets_path('assets')
class ParentClass implements HasAsset {
@:asset public static var MY_ASSET = 'myasset3.png';
static function main() {
import pony.time.Tween;
class TweenExample {
static function main() {
var obj = new Sprite();
new Tween(20...100, '3s').onUpdate << function(v:Float) obj.y = v;
}
}
class LinkDemo implements pony.magic.HasLink {
static var index:Int = 5;
static var visualIndex(link, never):String = Std.string(index + 1);
static function main() {
trace(visualIndex);//=>6
index = 10;
trace(visualIndex);//=>11
}
@AxGord
AxGord / Container.hx
Last active January 19, 2016 17:19
Pony + pixijs
import pixi.core.graphics.Graphics;
import pixi.core.sprites.Sprite;
import pixi.core.textures.Texture;
import pony.time.DeltaTime;
class Container extends Sprite {
private var _bunny:Sprite;
public function new(width:Float, height:Float) {
@AxGord
AxGord / config.xml
Last active December 30, 2015 22:09
CircleTimer config example
<?xml version="1.0" encoding="utf-8"?>
<config invertbar="true" mouseFilterWait="1000" mouseFilterCount="9">
<work repeat="5000" sound="start.mp3">1</work>
<relax sound="start.mp3">1</relax>
<idle>10</idle>
</config>
package ;
import neko.Lib;
using Main;
/**
* ...
* @author AxGord <axgord@gmail.com>
*/
class Main {