diff --git a/Emu.yyp b/Emu.yyp index 0eaebf3..f9b3517 100644 --- a/Emu.yyp +++ b/Emu.yyp @@ -64,7 +64,7 @@ {"id":{"name":"scribble_add_autotype_character_delay","path":"scripts/scribble_add_autotype_character_delay/scribble_add_autotype_character_delay.yy",},"order":0,}, {"id":{"name":"EmuCheckbox","path":"scripts/EmuCheckbox/EmuCheckbox.yy",},"order":6,}, {"id":{"name":"scribble_set_blend","path":"scripts/scribble_set_blend/scribble_set_blend.yy",},"order":2,}, - {"id":{"name":"EmuTextbox_H","path":"scripts/EmuTextbox_H/EmuTextbox_H.yy",},"order":17,}, + {"id":{"name":"EmuTextbox","path":"scripts/EmuTextbox/EmuTextbox.yy",},"order":17,}, {"id":{"name":"scribble_bake_outline","path":"scripts/scribble_bake_outline/scribble_bake_outline.yy",},"order":3,}, {"id":{"name":"scribble_autotype_fade_out","path":"scripts/scribble_autotype_fade_out/scribble_autotype_fade_out.yy",},"order":2,}, {"id":{"name":"spr_emu_nineslice","path":"sprites/spr_emu_nineslice/spr_emu_nineslice.yy",},"order":0,}, @@ -268,6 +268,58 @@ {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree2.d3d","resourceType":"GMIncludedFile",}, {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"skybox.png","resourceType":"GMIncludedFile",}, {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree3.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"birb.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"campfire.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"fnt_emu_default.yy","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"floor.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"logstack.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant0.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"logstackbig.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant2.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant1.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant3.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant4.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant5.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant6.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant7.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock0.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock1.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock2.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock3.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"skybox.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"skybox.png","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tent.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree0.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree1.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree2.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree3.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree4.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"birb.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"campfire.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"floor.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"fnt_emu_default.yy","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"logstack.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"logstackbig.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant0.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant1.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant2.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant3.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant4.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant5.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant6.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"plant7.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock0.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock1.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock2.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"rock3.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"skybox.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"skybox.png","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tent.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree0.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree1.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree2.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree3.d3d","resourceType":"GMIncludedFile",}, + {"CopyToMask":-1,"filePath":"datafiles/emu","resourceVersion":"1.0","name":"tree4.d3d","resourceType":"GMIncludedFile",}, ], "MetaData": { "IDEVersion": "2.3.0.529", diff --git a/objects/obj_emu_demo/Create_0.gml b/objects/obj_emu_demo/Create_0.gml index 883577c..11c3d9c 100644 --- a/objects/obj_emu_demo/Create_0.gml +++ b/objects/obj_emu_demo/Create_0.gml @@ -47,10 +47,10 @@ container.AddContent(tab_group); #region bio tab_bio.AddContent([ new EmuText(32, EMU_AUTO, 512, 32, "[c_blue]Character Bio[/c]"), - new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Name:", data.name, "enter a name", 32, E_InputTypes.STRING, function() { + new EmuTextbox(32, EMU_AUTO, 512, 32, "Name:", data.name, "enter a name", 32, E_InputTypes.STRING, function() { obj_emu_demo.data.name = value; }), - new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Nickname:", data.nickname, "enter a nickname", 32, E_InputTypes.STRING, function() { + new EmuTextbox(32, EMU_AUTO, 512, 32, "Nickname:", data.nickname, "enter a nickname", 32, E_InputTypes.STRING, function() { obj_emu_demo.data.nickname = value; }), ]); @@ -119,31 +119,31 @@ tab_look.AddContent([ #region stats -var input_str = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Strength:", string(data.str), "-5 to +5", 2, E_InputTypes.INT, function() { +var input_str = new EmuTextbox(32, EMU_AUTO, 512, 32, "Strength:", string(data.str), "-5 to +5", 2, E_InputTypes.INT, function() { obj_emu_demo.data.str = real(value); }); input_str.SetRealNumberBounds(-5, 5); -var input_dex = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Dexterity:", string(data.dex), "-5 to +5", 2, E_InputTypes.INT, function() { +var input_dex = new EmuTextbox(32, EMU_AUTO, 512, 32, "Dexterity:", string(data.dex), "-5 to +5", 2, E_InputTypes.INT, function() { obj_emu_demo.data.str = real(value); }); input_dex.SetRealNumberBounds(-5, 5); -var input_con = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Constitution:", string(data.con), "-5 to +5", 2, E_InputTypes.INT, function() { +var input_con = new EmuTextbox(32, EMU_AUTO, 512, 32, "Constitution:", string(data.con), "-5 to +5", 2, E_InputTypes.INT, function() { obj_emu_demo.data.con = real(value); }); input_con.SetRealNumberBounds(-5, 5); -var input_int = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Intelligence:", string(data.int), "-5 to +5", 2, E_InputTypes.INT, function() { +var input_int = new EmuTextbox(32, EMU_AUTO, 512, 32, "Intelligence:", string(data.int), "-5 to +5", 2, E_InputTypes.INT, function() { obj_emu_demo.data.int = real(value); }); input_int.SetRealNumberBounds(-5, 5); -var input_wis = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Wisdom:", string(data.wis), "-5 to +5", 2, E_InputTypes.INT, function() { +var input_wis = new EmuTextbox(32, EMU_AUTO, 512, 32, "Wisdom:", string(data.wis), "-5 to +5", 2, E_InputTypes.INT, function() { obj_emu_demo.data.wis = real(value); }); input_wis.SetRealNumberBounds(-5, 5); -var input_cha = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "Charisma:", string(data.cha), "-5 to +5", 2, E_InputTypes.INT, function() { +var input_cha = new EmuTextbox(32, EMU_AUTO, 512, 32, "Charisma:", string(data.cha), "-5 to +5", 2, E_InputTypes.INT, function() { obj_emu_demo.data.cha = real(value); }); input_cha.SetRealNumberBounds(-5, 5); -var input_level = new EmuTextbox_H(32, EMU_AUTO, 512, 32, "[#006600]Level:[/c]", string(data.level), "1 to 10", 2, E_InputTypes.INT, function() { +var input_level = new EmuTextbox(32, EMU_AUTO, 512, 32, "[#006600]Level:[/c]", string(data.level), "1 to 10", 2, E_InputTypes.INT, function() { obj_emu_demo.data.level = real(value); }); input_level.SetRealNumberBounds(1, 10); @@ -186,7 +186,7 @@ tab_skills.AddContent([ new EmuText(320, EMU_AUTO, 256, 32, "Skill Name:"), ]); -var input_skill_name = new EmuTextbox_H(320, EMU_AUTO, 256, 32, "", "", "skill name", 32, E_InputTypes.STRING, function() { +var input_skill_name = new EmuTextbox(320, EMU_AUTO, 256, 32, "", "", "skill name", 32, E_InputTypes.STRING, function() { var selection = list.GetSelection(); if (selection > -1) { obj_emu_demo.data.skills[| selection] = value; @@ -204,7 +204,7 @@ button_remove.list = list_your_skills; #endregion #region summary -var input_summary = new EmuTextbox_H(32, EMU_AUTO, 512, 256, "Summary:", data.summary, "up to 500 characters", 500, E_InputTypes.STRING, function() { +var input_summary = new EmuTextbox(32, EMU_AUTO, 512, 256, "Summary:", data.summary, "up to 500 characters", 500, E_InputTypes.STRING, function() { obj_emu_demo.data.summary = value; }); input_summary.SetMultiLine(true); diff --git a/scripts/EmuButton/EmuButton.gml b/scripts/EmuButton/EmuButton.gml index e163f9a..0e72ef1 100644 --- a/scripts/EmuButton/EmuButton.gml +++ b/scripts/EmuButton/EmuButton.gml @@ -4,7 +4,9 @@ function EmuButton(_x, _y, _w, _h, _text, _callback) : EmuCallback(_x, _y, _w, _ text = _text; alignment = fa_center; valignment = fa_middle; - + _textify = function(name) { + return _emu_string_concat("var ", name, " = new EmuButton(", x, ", ", y, ", ", width, ", ", height, ", ", _emu_string_escape(text), ", function() {/* IMPLEMENT BUTTON CALLBACK HERE */});\n"); + } Render = function(base_x, base_y) { processAdvancement(); diff --git a/scripts/EmuButton_Image/EmuButton_Image.gml b/scripts/EmuButton_Image/EmuButton_Image.gml index 4af759b..f0da83a 100644 --- a/scripts/EmuButton_Image/EmuButton_Image.gml +++ b/scripts/EmuButton_Image/EmuButton_Image.gml @@ -13,6 +13,10 @@ function EmuButtonImage(_x, _y, _w, _h, _sprite, _index, _blend, _alpha, _scale_ surface = noone; + _textify = function(name) { + return _emu_string_concat("var ", name, " = new EmuButtonImage(", x, ", ", y, ", ", width, ", ", height, ", ", sprite_get_name(sprite), ", ", index, ", ", blend, ", ", alpha, ", ", fill, ", function() {/* IMPLEMENT BUTTON CALLBACK HERE */});\n"); + } + Render = function(base_x, base_y) { processAdvancement(); diff --git a/scripts/EmuTab/EmuTab.gml b/scripts/EmuTab/EmuTab.gml index 334c9b7..ede67aa 100644 --- a/scripts/EmuTab/EmuTab.gml +++ b/scripts/EmuTab/EmuTab.gml @@ -11,7 +11,11 @@ function EmuTab(_name) : EmuCore(0, 0, 0, 0) constructor { header_y = 0; header_width = 0; header_height = 0; - + _textify = function(name) { + var s = _emu_string_concat("var ", name, " = new EmuTab(", _emu_string_escape(text), ");\n"); + s += _textify_recurse_contents(name); + return s; + } Render = function(base_x, base_y) { processAdvancement(); diff --git a/scripts/EmuTabGroup/EmuTabGroup.gml b/scripts/EmuTabGroup/EmuTabGroup.gml index 5c714f5..edbbb10 100644 --- a/scripts/EmuTabGroup/EmuTabGroup.gml +++ b/scripts/EmuTabGroup/EmuTabGroup.gml @@ -11,7 +11,30 @@ function EmuTabGroup(_x, _y, _w, _h, _rows, _row_height) : EmuCore(_x, _y, _w, _ active_tab = noone; active_tab_request = noone; - + _textify = function(name) { + var s = _emu_string_concat("var ", name, " = new EmuTabGroup(", x, ", ", y, ", ", width, ", ", height, ", ", rows, ", ", row_height, ");") + "\n"; + if (rows > 0) { + for (var i = 0; i < rows; i++) { + var tab_row = contents[| i]; + for (var z = 0; z < ds_list_size(tab_row.contents); z++) { + var tab = tab_row.contents[| z]; + s += tab.Textify(name + "_" + string(z) + "x" + string(i)); + } + } + for (var i = 0; i < rows; i++) { + s += name + ".AddTabs(" + string(i) + ", ["; + var tab_row = contents[| i]; + for (var z = 0; z < ds_list_size(tab_row.contents); z++) { + var tab = tab_row.contents[| z]; + s += name + "_" + string(z) + "x" + string(i); + if (z < ds_list_size(tab_row.contents) - 1) + s += ", "; + } + s += "]);\n"; + } + } + return s; + } AddTabs = function(row, tabs) { processAdvancement(); diff --git a/scripts/EmuText/EmuText.gml b/scripts/EmuText/EmuText.gml index b4e8c1b..e35c2c5 100644 --- a/scripts/EmuText/EmuText.gml +++ b/scripts/EmuText/EmuText.gml @@ -2,7 +2,9 @@ // See the Github wiki for documentation: https://github.com/DragoniteSpam/Emu/wiki function EmuText(_x, _y, _w, _h, _text) : EmuCore(_x, _y, _w, _h) constructor { text = _text; - + _textify = function(name) { + return _emu_string_concat("var ", name, " = new EmuText(", x, ", ", y, ", ", width, ", ", height, ", ", _emu_string_escape(text), ");\n"); + } Render = function(base_x, base_y) { processAdvancement(); diff --git a/scripts/EmuTextbox_H/EmuTextbox_H.gml b/scripts/EmuTextbox/EmuTextbox.gml similarity index 96% rename from scripts/EmuTextbox_H/EmuTextbox_H.gml rename to scripts/EmuTextbox/EmuTextbox.gml index 8925754..17a0603 100644 --- a/scripts/EmuTextbox_H/EmuTextbox_H.gml +++ b/scripts/EmuTextbox/EmuTextbox.gml @@ -1,6 +1,6 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -function EmuTextbox_H(_x, _y, _w, _h, _text, _value, _help_text, _character_limit, _input_type, _callback) : EmuCallback(_x, _y, _w, _h, _value, _callback) constructor { +function EmuTextbox(_x, _y, _w, _h, _text, _value, _help_text, _character_limit, _input_type, _callback) : EmuCallback(_x, _y, _w, _h, _value, _callback) constructor { text = _text; help_text = _help_text; character_limit = clamp(_character_limit, 1, 1000); @@ -19,7 +19,9 @@ function EmuTextbox_H(_x, _y, _w, _h, _text, _value, _help_text, _character_limi sprite_ring = spr_emu_ring sprite_enter = spr_emu_enter; - + _textify = function(name) { + return _emu_string_concat("var ", name, " = new EmuTextbox(", x, ", ", y, ", ", width, ", ", height, ", ", _emu_string_escape(text), ", ", _emu_string_escape(value), ", ", _emu_string_escape(help_text), ", ", character_limit, ", ", value_type, ", function() {/* IMPLEMENT TEXTBOX CALLBACK HERE */});\n"); + } surface = surface_create(value_x2 - value_x1, value_y2 - value_y1); working_value = ""; diff --git a/scripts/EmuTextbox_H/EmuTextbox_H.yy b/scripts/EmuTextbox/EmuTextbox.yy similarity index 88% rename from scripts/EmuTextbox_H/EmuTextbox_H.yy rename to scripts/EmuTextbox/EmuTextbox.yy index 9ad442a..9598fd6 100644 --- a/scripts/EmuTextbox_H/EmuTextbox_H.yy +++ b/scripts/EmuTextbox/EmuTextbox.yy @@ -6,7 +6,7 @@ "path": "folders/Emu/Core.yy", }, "resourceVersion": "1.0", - "name": "EmuTextbox_H", + "name": "EmuTextbox", "tags": [], "resourceType": "GMScript", } \ No newline at end of file diff --git a/scripts/Emu_Core/Emu_Core.gml b/scripts/Emu_Core/Emu_Core.gml index 85b49a9..3c2d8a7 100644 --- a/scripts/Emu_Core/Emu_Core.gml +++ b/scripts/Emu_Core/Emu_Core.gml @@ -1,5 +1,6 @@ // Emu (c) 2020 @dragonitespam // See the Github wiki for documentation: https://github.com/DragoniteSpam/Emu/wiki + function EmuCore(_x, _y, _w, _h) constructor { x = _x; y = _y; @@ -30,7 +31,35 @@ function EmuCore(_x, _y, _w, _h) constructor { sprite_nineslice = spr_emu_nineslice; element_spacing_y = 16; sprite_checkers = spr_emu_checker; - + _textify_recurse_contents = function(name) { + var s = ""; + if (ds_list_size(contents) > 0) { + // control initialization + for (var i = 0; i < ds_list_size(contents); i++) { + var control = contents[| i]; + s += control.Textify(name + "_" + string(i)); + } + + // adding controls to base control + s += name + ".AddContents(["; + for (var i = 0; i < ds_list_size(contents); i++) { + s += name + "_" + string(i); + if (i < ds_list_size(contents) - 1) + s += ", "; + } + s += "]);\n" + } + return s; + } + _textify = function(name) { + var s = _emu_string_concat("var ", name, " = new EmuCore(", x, ", ", y, ", ", width, ", ", height, ");") + "\n"; + s += _textify_recurse_contents(name); + return s; + } + Textify = function(base_name) { + return _textify(base_name); + } + AddContent = function(elements) { if (!is_array(elements)) { elements = [elements]; diff --git a/scripts/emu_init/emu_init.gml b/scripts/emu_init/emu_init.gml index aec7377..91155ef 100644 --- a/scripts/emu_init/emu_init.gml +++ b/scripts/emu_init/emu_init.gml @@ -45,4 +45,31 @@ function _emu_active_element() { } return _active; } +function _emu_string_escape(str) { + var s = "\""; + for (var i = 0; i < string_length(str); i++) { + var c = string_char_at(str, i + 1); + /// TODO: add support for unicode, non-ascii bytes and figure out a better way of doing this + // Best case scenario, gms2 has a function that does this by itself. + if (c == "\"") s += "\\\"" + else if (c == "\\") s += "\\\\" + else if (c == "\n") s += "\\n" + else if (c == "\r") s += "\\r" + else if (c == "\b") s += "\\b" + else if (c == "\f") s += "\\f" + else if (c == "\t") s += "\\t" + else if (c == "\v") s += "\\v" + else s += c; + } + s += "\""; + return s; +} +function _emu_string_concat() { + var s = ""; + for (var i = 0; i < argument_count; i++) { + var arg = argument[i]; + s += string(arg); + } + return s; +} #endregion \ No newline at end of file