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 convert_to_array_map(_map) { | |
static __buff = buffer_create(0, buffer_grow, 1); | |
var root = array_create(256, undefined); // Root node | |
var _names = struct_get_names(_map); | |
var _length = array_length(_names); | |
for (var _i = 0; _i < _length; _i++) { | |
var _find = _names[_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
#macro pprint repeat (__pprint_pre(_GMFILE_, _GMFUNCTION_, string(_GMLINE_))) __pprint | |
/// @param ...args | |
function __pprint() { | |
var _str = $"PRINTER :: { | |
string_replace(string_replace(__pprint.__file, "gml_Object_", ""), "gml_GlobalScript_", "") | |
}/{ | |
string_replace(string_replace(__pprint.__func, "gml_Object_", ""), "gml_Script_", "") | |
}:{__pprint.__line}:\n" | |
var _i=0; repeat(argument_count) { |
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 os | |
from itertools import product | |
script_dir = os.path.dirname(os.path.abspath(__file__)) | |
# Operand types with example values | |
operands = { | |
"0b": "0b1011", # 11 | |
"0x": "0xA7", # 167 | |
"Unsigned-real": "167", # 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
function CacheSystem() constructor { | |
data = {}; | |
static __string_hash = {} //explicetly used to improve the speed at which we hash strings | |
static save = function(_value) { | |
var _data = data; | |
var _cache_ref_key_count = argument_count; | |
var _last_index = _cache_ref_key_count-1; | |
for(var _i=1; _i<_cache_ref_key_count; _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
function string_format_human_readable(_num) { | |
if (_num == 0) return "zero"; | |
static __ones = [ | |
"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", | |
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", | |
"seventeen", "eighteen", "nineteen" | |
]; | |
static __tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]; |
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
{ | |
"people":[ | |
{"names":["grinning","grinning_face"],"surrogates":"\uD83D\uDE00","unicodeVersion":6.1}, | |
{"names":["smiley"],"surrogates":"\uD83D\uDE03","unicodeVersion":6}, | |
{"names":["smile"],"surrogates":"\uD83D\uDE04","unicodeVersion":6}, | |
{"names":["grin"],"surrogates":"\uD83D\uDE01","unicodeVersion":6}, | |
{"names":["laughing","satisfied"],"surrogates":"\uD83D\uDE06","unicodeVersion":6}, | |
{"names":["face_holding_back_tears"],"surrogates":"\uD83E\uDD79","unicodeVersion":14}, | |
{"names":["sweat_smile"],"surrogates":"\uD83D\uDE05","unicodeVersion":6}, | |
{"names":["joy"],"surrogates":"\uD83D\uDE02","unicodeVersion":6}, |
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
#region jsDoc | |
/// @func buffer_create_from_surface | |
/// @desc Creates a fixed-size buffer containing the pixel data from the given surface. The buffer size is determined | |
/// by the surface's dimensions and format. The buffer is populated with the surface's pixel data starting at byte offset 0. | |
/// @param {Id.Surface} _surf - The source surface from which to read pixel data. | |
/// @returns {Id.Buffer} A buffer containing the surface's pixel data. | |
#endregion | |
function buffer_create_from_surface(_surf) { | |
// Get surface properties | |
var _width = surface_get_width(_surf); |
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
Benchmarks = [ | |
new Benchmark("2D Data foreach (full)", [ | |
new TestCase("Array", function(iterations) { | |
var _i=0; repeat(iterations){ | |
arr.foreach(function(_cell, _x, _y){}, false) | |
_i++} | |
}, | |
function(){ | |
width = 32; |
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
new Benchmark("array_contains_not", [ | |
new TestCase("manually checked for()", function(iterations) { | |
repeat (iterations) { | |
var result = func(testArray, default_value); | |
} | |
}, | |
function(){ | |
//initiallizer (is not accounted for in the benchmark test) | |
default_value = undefined; | |
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 constructor_call(ind) { | |
static __arr = []; | |
var _i=1; repeat(argument_count-1) { | |
__arr = argument[_i]; | |
_i++} | |
var _struct = constructor_call_ext(ind, __arr); | |
array_resize(__arr, 0) | |
NewerOlder