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
for (i in 0 ... 5) { | |
switch (i) { | |
case 3: switch (i) { | |
case 3: break; | |
case 4: | |
} | |
} | |
} | |
var j:Int = 0; | |
while (++j < 5) switch (j) { |
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
public static function run() { | |
for (i in 0 ... 5) { | |
switch (i) { | |
case 3: switch (i) { | |
case 3: break; | |
} | |
} | |
trace(i); | |
} | |
} |
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
_____________________ | |
/ Spelunky SD | |
A Spelunky Classic mod | |
by YellowAfterlife | |
This is a modification and expansion of "Spelunky Classic" by Derek Yu. | |
It changes and improves a number of things in the game, most notably adding | |
2-player cooperative online multi-player support. | |
Useful links: |
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 openfl.state; | |
import openfl.events.Event; | |
import openfl.events.KeyboardEvent; | |
import openfl.Lib; | |
/** | |
* Provides a simple interface to get keyboard state. | |
* @author YellowAfterlife | |
*/ | |
class Keyboard { |
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
// Experimenting with custom JSON serialization. | |
// Things that annoy me in existing implementation are: | |
// * Ordering: Since haxe.Json takes dynamic objects, field order cannot be warranted. | |
// If resulting JSON has to be viewed/edited manually, uncertain order is no help. | |
// * Readability: You have no control over how contents are written. Prettyprint gets bulky fast. | |
// * Typing: JSON nodes are, by definition, dynamic objects, which means that you'll most | |
// likely have to implement an extra I/O layer with "data from class N" typedefs. | |
// * Efficiency: Dynamic objects and arrays are read only to (most often) be thrown again later. | |
// | |
// So here I'm working on a library that solves a fair of these problems by providing |
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
import java.lang.Object; | |
import java.lang.String; | |
public class JavaClass implements HaxeInterface { | |
// ... | |
// Dummy IHxObject implementation: | |
public boolean __hx_deleteField(String f) { return false; } | |
public Object __hx_lookupField(String f, boolean e, boolean c) { return null; } | |
public double __hx_lookupField_f(String f, boolean e) { return 0.0; } | |
public Object __hx_lookupSetField(String f, Object v) { return null; } |
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
/// Create: | |
globalvar mouse_x0, mouse_y0, mouse_x1, mouse_y1, mouse_dx, mouse_dy; | |
mouse_x1 = mouse_x | |
mouse_y1 = mouse_y | |
mouse_dx = 0 | |
mouse_dy = 0 | |
/// Step: | |
mouse_x0 = mouse_x1; mouse_x1 = mouse_x | |
mouse_y0 = mouse_y1; mouse_y1 = mouse_y |
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
function set_field(t, f, v) | |
t[f] = v | |
return v | |
end | |
local n = 10000000 | |
local t = { } | |
local q | |
local p | |
-- Direct: | |
q = os.clock() |
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
function printTry(e1:haxe.macro.TypedExpr, catches: Array<{ v : haxe.macro.TVar, expr : haxe.macro.TypedExpr }>) | |
{ | |
// TODO catch other types of exceptions | |
// getting last (e:Dynamic) catch: | |
var _dynCatch = catches.pop(), _tabs; | |
// try-block: | |
var s = 'local try, catch = pcall(function ()'; | |
_tabs = tabs; tabs += tabString; | |
var tryBlock = printExpr(e1); |
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
function Main_Main.tryNormal() | |
local r | |
local try, catch = pcall(function () | |
r = "normal" | |
end); | |
if (try == false) then | |
local _ = catch; | |
r = nil | |
end | |
return r |