This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dungeons.utils; | |
/* | |
A simple time scheduling system based on energy. Can be used for player, monsters, hp regenerators, effect counters, | |
basically everything. | |
Loosely based on python example from this article: | |
http://roguebasin.roguelikedevelopment.org/index.php?title=An_elegant_time-management_system_for_roguelikes | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main | |
{ | |
private static function main() | |
{ | |
function newEmptyHandler():Void->Void | |
{ | |
return function():Void {}; | |
} | |
var a:Void->Void = newEmptyHandler(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern class Globals | |
{ | |
public static var context(get, never):Context; | |
inline static function get_context():Context return untyped __js__("context"); | |
} | |
extern class Context | |
{ | |
public function doStuff():Void; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
class Main | |
{ | |
public function new(root) | |
{ | |
root.addEventListener(flash.events.Event.ENTER_FRAME, onEnterFrame); | |
} | |
function onEnterFrame(_) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestUtils | |
{ | |
/** | |
* Макро-функция для удобного тестирования эксепшенов. | |
* | |
* Использовать так: | |
* assertExprRaises({ throw "OMG"; }); | |
* или так: | |
* assertExprRaises({ throw "OMG"; }, { assertThat(e, equalTo("OMG")) }); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if macro | |
import haxe.macro.Context; | |
import haxe.macro.Expr; | |
class SchemaTypeBuilder | |
{ | |
public static function build(ref:String):haxe.macro.Type | |
{ | |
var schema = haxe.Json.parse(sys.io.File.getContent(ref)); | |
var type:ComplexType = parseType(schema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IntRange | |
{ | |
var index:Int; | |
var end:Int; | |
var step:Int; | |
inline function new(start, end, step) | |
{ | |
this.index = start; | |
this.end = end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private typedef TileRule = | |
{ | |
var tileIndex:Int; | |
var map:{nw:String, n:String, ne:String, w:String, e:String, sw:String, s:String, se:String}; | |
} | |
private typedef TileType = | |
{ | |
var typeStr:String; | |
var defaultTileIndex:Int; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using StringTools; | |
/** | |
* Супер-принтер для JSON. | |
* | |
* От не-супер принтера его отличают две вещи: | |
* 1. Он делает оступы | |
* 2. Он сортирует поля объектов при сериализации | |
* | |
* Он был написан для того чтобы собирать дефы под разными платформами |
OlderNewer