add console switcher

This commit is contained in:
John Alanbrook 2024-08-25 15:29:35 -05:00
parent 94d4d86944
commit 88de7fb547
3 changed files with 16 additions and 0 deletions

View file

@ -2,6 +2,7 @@ debug.build = function(fn) { if (!debug.show) return; fn(); }
debug.show = true;
debug.urnames = false;
debug.termout = true;
debug.console = false;
debug.fn_break = function(fn,obj = globalThis) {
if (typeof fn !== 'function') return;

View file

@ -122,6 +122,17 @@ JSC_CCALL(imgui_pushid,
JSC_CCALL(imgui_popid, ImGui::PopID(); )
JSC_CCALL(imgui_image,
texture *tex = js2texture(argv[0]);
simgui_image_t simgui_img = simgui_make_image(&(simgui_image_desc_t){
.image = tex->id,
.sampler = std_sampler
});
ImTextureID tex_id = simgui_imtextureid(simgui_img);
ImGui::Image(tex_id, ImVec2(tex->width, tex->height));
simgui_destroy_image(simgui_img);
)
static const JSCFunctionListEntry js_imgui_funcs[] = {
MIST_FUNC_DEF(imgui, window, 2),
MIST_FUNC_DEF(imgui, menu, 2),
@ -131,6 +142,7 @@ static const JSCFunctionListEntry js_imgui_funcs[] = {
MIST_FUNC_DEF(imgui, menubar, 1),
MIST_FUNC_DEF(imgui, mainmenubar, 1),
MIST_FUNC_DEF(imgui, menuitem, 3),
MIST_FUNC_DEF(imgui, image, 1),
MIST_FUNC_DEF(imgui, textinput, 2),
MIST_FUNC_DEF(imgui, button, 2),
MIST_FUNC_DEF(imgui, checkbox, 2),

View file

@ -157,6 +157,9 @@ uint64_t js2uint64(JSValue v);
JSValue str2js(const char *c, ...);
struct texture;
struct texture *js2texture(JSValue v);
void nota_int(char *blob);
JSValue js_getpropidx(JSValue v, uint32_t i);