add more imgui functions

This commit is contained in:
John Alanbrook 2024-08-25 00:18:30 -05:00
parent 9fd958f414
commit 05aeb62242
5 changed files with 20 additions and 4 deletions

View file

@ -78,7 +78,7 @@ debug.inputs.f4 = function() {
}; };
debug.inputs.f4.doc = "Toggle drawing gizmos and names of objects."; debug.inputs.f4.doc = "Toggle drawing gizmos and names of objects.";
debug.gif = { var gif = {
w: 640, /* Max width */ w: 640, /* Max width */
h: 480, /* Max height */ h: 480, /* Max height */
stretch: false, /* True if you want to stretch */ stretch: false, /* True if you want to stretch */
@ -213,8 +213,6 @@ debug.api.print_doc = function(name)
return mdoc; return mdoc;
} }
debug.frozen = false;
return { return {
debug, debug,
Gizmos, Gizmos,

View file

@ -277,6 +277,7 @@ prosperon.quit = function () {
profile.print_cache_report(); profile.print_cache_report();
profile.stop_frame_avg() profile.stop_frame_avg()
profile.stop_cpu_instr(); profile.stop_cpu_instr();
prosperon.quit_hook?.();
}; };
window.size = [640, 480]; window.size = [640, 480];

View file

@ -113,6 +113,16 @@ Object.mixin(audio.bus.master.__proto__, {
set volume(x) { this.gain = x; }, set volume(x) { this.gain = x; },
}); });
audio.bus.master.__proto__.toJSON = function()
{
return {
volume: this.volume,
off: this.off,
pan: this.pan,
pass: this.pass
};
}
/*Object.mixin(audio.dsp.source().__proto__, { /*Object.mixin(audio.dsp.source().__proto__, {
length() { return this.frames()/audio.samplerate(); }, length() { return this.frames()/audio.samplerate(); },
time() { return this.frame/sound.samplerate(); }, time() { return this.frame/sound.samplerate(); },

View file

@ -109,6 +109,12 @@ JSC_SCALL(imgui_slider,
ret = number2js(val); ret = number2js(val);
) )
JSC_SCALL(imgui_checkbox,
bool val = js2boolean(argv[1]);
ImGui::Checkbox(str, &val);
ret = boolean2js(val);
)
static const JSCFunctionListEntry js_imgui_funcs[] = { static const JSCFunctionListEntry js_imgui_funcs[] = {
MIST_FUNC_DEF(imgui, window, 2), MIST_FUNC_DEF(imgui, window, 2),
MIST_FUNC_DEF(imgui, menu, 2), MIST_FUNC_DEF(imgui, menu, 2),
@ -118,6 +124,7 @@ static const JSCFunctionListEntry js_imgui_funcs[] = {
MIST_FUNC_DEF(imgui, menuitem, 3), MIST_FUNC_DEF(imgui, menuitem, 3),
MIST_FUNC_DEF(imgui, textinput, 2), MIST_FUNC_DEF(imgui, textinput, 2),
MIST_FUNC_DEF(imgui, button, 2), MIST_FUNC_DEF(imgui, button, 2),
MIST_FUNC_DEF(imgui, checkbox, 2),
MIST_FUNC_DEF(imgui, text, 1), MIST_FUNC_DEF(imgui, text, 1),
MIST_FUNC_DEF(imgui, plot,1), MIST_FUNC_DEF(imgui, plot,1),
MIST_FUNC_DEF(imgui,lineplot,2), MIST_FUNC_DEF(imgui,lineplot,2),

View file

@ -2037,7 +2037,7 @@ JSC_GETSET(window, sample_count, number)
static const JSCFunctionListEntry js_window_funcs[] = { static const JSCFunctionListEntry js_window_funcs[] = {
CGETSET_ADD(window, fullscreen), CGETSET_ADD(window, fullscreen),
CGETSET_ADD(window, title), CGETSET_ADD(window, title,)
CGETSET_ADD(window, vsync), CGETSET_ADD(window, vsync),
CGETSET_ADD(window, enable_clipboard), CGETSET_ADD(window, enable_clipboard),
CGETSET_ADD(window, enable_dragndrop), CGETSET_ADD(window, enable_dragndrop),