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 Ext { | |
/// C-style for-loop. Uses @pleclech's idea but on macros level. | |
public static macro function cf(init, cond, post, expr) { | |
#if !display | |
var func = null; | |
func = function(expr:haxe.macro.Expr) { | |
return switch (expr) { | |
case macro continue: macro { $post; $expr; } | |
default: haxe.macro.ExprTools.map(expr, func); | |
} |
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
<script type="text/javascript"> | |
var imagePath = "test.png"; // file to reload. | |
var reloadInterval = 0.5; // how often to reload, in seconds. | |
</script> | |
<img id="image" /> | |
<canvas id="canvas"></canvas> | |
<style type="text/css"> | |
#image { | |
visibility: hidden; | |
} |
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
/// buffer_hex(buffer, ?length) : Returns buffer contents as a hexadecimal string. | |
var o = argument[0], q = buffer_tell(o), d, v, n; | |
if (argument_count > 1) { | |
n = argument[1] | |
} else n = buffer_get_size(o) - q | |
var sb = buffer_create(n * 3 + 1, buffer_fixed, 1); | |
repeat (n) { | |
v = buffer_read(o, buffer_u8) | |
d = v >> 4 | |
if (d < 10) { |
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
if (wasAlive && life <= 0 && isRealLevel() && type != "") { | |
if (type == "Bat") global.enemyDeaths[0] += 1; | |
else if (type == "Snake") global.enemyDeaths[1] += 1; | |
else if (type == "Spider") global.enemyDeaths[2] += 1; | |
else if (type == "Giant Spider") global.enemyDeaths[3] += 1; | |
else if (type == "Caveman") global.enemyDeaths[4] += 1; | |
else if (type == "Skeleton") global.enemyDeaths[5] += 1; | |
else if (type == "Zombie") global.enemyDeaths[6] += 1; | |
else if (type == "Vampire") global.enemyDeaths[7] += 1; | |
else if (type == "Frog") global.enemyDeaths[8] += 1; |
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
var HxOverrides = function() { }; | |
HxOverrides.cca = function(s,index) { | |
var x = s.charCodeAt(index); | |
if(x != x) return undefined; | |
return x; | |
}; | |
var Main = function() { }; | |
Main.utf2ints = function(v,r) { | |
if(r == null) r = []; else r.splice(0,r.length); | |
var i = -1; |
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
/// ds_list_string(id) | |
var l = argument0; | |
var r = "list#" + string(l); | |
var n = ds_list_size(l); | |
r += "[" + string(n) + "]{ "; | |
for (var i = 0; i < n; i++) { | |
if (i > 0) r += ", " | |
r += string(l[|i]) | |
} | |
r += " }" |
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
:: replace {} with paths appropriate | |
@{RESHACK}\ResHacker.exe -script {ICONSPATH}\syncIcons.txt |
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
var times, grid, array; | |
times = 1000 * 1000 | |
grid = ds_grid_create(100, 100) | |
for (var i = 0; i < 100; i++) array[i, 99] = 0 | |
// | |
time = get_timer() | |
repeat (times) val = ds_grid_get(grid, 42, 42) | |
show_debug_message("ds_grid_get: " + string(get_timer() - time)) | |
// | |
time = get_timer() |
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
// macros: | |
macro public static function forc(init, condition, post, block) { | |
return macro { | |
$init; | |
while ($condition) { | |
var __forc = 0; | |
do { | |
$block; | |
} while (++__forc == 0); | |
$post; |
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 Main { | |
macro public static function forc(init, condition, post, block) { | |
return macro untyped __js__("for ({0}; {1}; {2}) {3}", $init, $condition, $post, $block); | |
} | |
static function main() { | |
forc(var i = 0, i < 5, i++, { | |
trace(i); | |
trace("..!!"); | |
}); | |
} |