add imgui clipboard

This commit is contained in:
John Alanbrook 2024-09-30 19:00:09 -05:00
parent 6456590492
commit 93cda3848b
3 changed files with 15 additions and 5 deletions

View file

@ -47,11 +47,17 @@ globalThis.rmactor = function (e) {
actor.__stats = function () { actor.__stats = function () {
var total = 0; var total = 0;
var stats = {}; var stats = {};
for (var i in actor_spawns) { game.all_objects(obj => {
if (!actor_spawns[obj._file]) return;
stats[obj._file] ??= 0;
stats[obj._file]++;
total++;
});
/* for (var i in actor_spawns) {
stats[i] = actor_spawns[i].length; stats[i] = actor_spawns[i].length;
total += stats[i]; total += stats[i];
} }*/
stats.total = total; // stats.total = total;
return stats; return stats;
}; };

View file

@ -72,9 +72,8 @@ var entity = {
}, },
clear() { clear() {
for (var k in this.objects) { for (var k in this.objects)
this.objects[k].kill(); this.objects[k].kill();
}
this.objects = {}; this.objects = {};
}, },

View file

@ -851,6 +851,10 @@ JSC_CCALL(imgui_setupaxis,
ImPlot::SetupAxis(num_to_yaxis(js2number(argv[0]))); ImPlot::SetupAxis(num_to_yaxis(js2number(argv[0])));
) )
JSC_SCALL(imgui_setclipboard,
ImGui::SetClipboardText(str);
)
static const JSCFunctionListEntry js_imgui_funcs[] = { static const JSCFunctionListEntry js_imgui_funcs[] = {
MIST_FUNC_DEF(imgui, windowpos, 0), MIST_FUNC_DEF(imgui, windowpos, 0),
MIST_FUNC_DEF(imgui, plot2pixels, 1), MIST_FUNC_DEF(imgui, plot2pixels, 1),
@ -945,6 +949,7 @@ static const JSCFunctionListEntry js_imgui_funcs[] = {
MIST_FUNC_DEF(imgui, dummy, 1), MIST_FUNC_DEF(imgui, dummy, 1),
MIST_FUNC_DEF(imgui, invisiblebutton, 2), MIST_FUNC_DEF(imgui, invisiblebutton, 2),
MIST_FUNC_DEF(imgui, width, 1), MIST_FUNC_DEF(imgui, width, 1),
MIST_FUNC_DEF(imgui, setclipboard, 1),
}; };
static int started = 0; static int started = 0;