This file contains hidden or 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 Test { | |
| static function fib(x) { | |
| if( x <= 0 ) return 1; | |
| return fib(x-1) + fib(x-2); | |
| } | |
| static function writeFile() { | |
| var b = haxe.io.Bytes.alloc(65000); | |
| for( i in 0...2 ) { |
This file contains hidden or 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
| enum Error<T> { | |
| Code( i : Int ) : Error<Int>; | |
| Message( s : String ) : Error<String>; | |
| } | |
| function getError<T>( e : Error<T> ) : T { | |
| switch( e ) { | |
| case Code(c): return c; | |
| case Message(s): return s; | |
| } |
This file contains hidden or 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 haxe; | |
| class MainEvent { | |
| var f : Void -> Void; | |
| var prev : MainEvent; | |
| var next : MainEvent; | |
| public var priority(default,null) : Int; | |
| public function new(f,p) { |
This file contains hidden or 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 haxe; | |
| class MainEvent { | |
| var f : Void -> Void; | |
| var prev : MainEvent; | |
| var next : MainEvent; | |
| public var nextRun(default,null) : Float; | |
| public var priority(default,null) : Int; | |
This file contains hidden or 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 haxe; | |
| /** | |
| If haxe.MainLoop is kept from DCE, then we will insert an haxe.EntryPoint.run() call just at then end of main(). | |
| This class can be redefined by custom frameworks so they can handle their own main loop logic. | |
| **/ | |
| class EntryPoint { | |
| /** | |
| Wakeup a sleeping run() |
This file contains hidden or 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 NormalShader2D extends hxsl.Shader { | |
| static var SRC = { | |
| @:import h3d.shader.Base2d; | |
| @param var normalMap : Sampler2d; | |
| function fragment() { | |
| var n = unpackNormal(normalMap.get(calculatedUV)); | |
| var light = vec3(1,2,3).normalize(); | |
| var lum = light.dot(n).saturate(); | |
| pixelColor.rgb *= lum; | |
| } |
This file contains hidden or 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
| # go to Northgard install dir | |
| cd "~/Library/Application Support/Steam/SteamApps/common/Northgard/osx" | |
| # fallback fo newest dir | |
| cd "~/Library/Application Support/Steam/steamapps/common/Northgard/osx" | |
| # remove shipped libraries which requires AVX CPU support | |
| rm -rf libmbed* libogg* libvorbis* libopenal* libpng* libSDL* libturbojpeg* | |
| # download and install homebrew | |
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| # install required libraries | |
| brew install libpng jpeg-turbo libvorbis sdl2 mbedtls openal-soft libuv |
This file contains hidden or 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 domkit; | |
| using StringTools; | |
| enum abstract MToken(Int) { | |
| var IGNORE_SPACES; | |
| var BEGIN; | |
| var BEGIN_NODE; | |
| var BEGIN_CODE; | |
| var CODE_IDENT; |
This file contains hidden or 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
| abstract MyArray<T>(#if java java.NativeArray<T> #else Array<T> #end) { | |
| public inline function new(size:Int) { | |
| #if java | |
| this = new java.NativeArray(size); | |
| #else | |
| this = new Array(); | |
| if( size > 0 ) this[size-1] = cast null; | |
| #end | |
| } |
This file contains hidden or 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
| abstract MyArray<T>(#if java java.NativeArray<T> #else Array<T> #end) { | |
| public inline function new(size:Int) { | |
| #if java | |
| this = new java.NativeArray(size); | |
| #else | |
| this = new Array(); | |
| if( size > 0 ) this[size-1] = cast null; | |
| #end | |
| } |
OlderNewer