This commit is contained in:
John Alanbrook 2024-07-01 13:05:26 -05:00
parent f7fdae024d
commit b25cd85071
3 changed files with 12 additions and 4 deletions

View file

@ -422,8 +422,8 @@ game.doc.pause = "Pause game simulation.";
game.doc.play = "Resume or start game simulation."; game.doc.play = "Resume or start game simulation.";
game.doc.camera = "Current camera."; game.doc.camera = "Current camera.";
game.texture = function (path) { game.texture = function (path, force = false) {
if (game.texture.cache[path]) return game.texture.cache[path]; if (force && game.texture.cache[path]) return game.texture.cache[path];
if (!io.exists(path)) { if (!io.exists(path)) {
console.warn(`Missing texture: ${path}`); console.warn(`Missing texture: ${path}`);

View file

@ -518,7 +518,7 @@ render.text = function(str, pos, size = 1, color = Color.white, wrap = -1, ancho
render.image = function(tex, pos, scale = 1, rotation = 0, color = Color.white, dimensions = [tex.width, tex.height]) { render.image = function(tex, pos, scale = 1, rotation = 0, color = Color.white, dimensions = [tex.width, tex.height]) {
var t = os.make_transform(); var t = os.make_transform();
t.pos = pos; t.pos = pos;
t.scale = [scale,scale]; t.scale = [scale,scale,scale];
render.setpipeline(render.spriteshader.pipe); render.setpipeline(render.spriteshader.pipe);
render.setunim4(0, render.spriteshader.vs.unimap.model.slot, t); render.setunim4(0, render.spriteshader.vs.unimap.model.slot, t);
render.shader_apply_material(render.spriteshader, { render.shader_apply_material(render.spriteshader, {

View file

@ -40,13 +40,21 @@ JSC_CCALL(imgui_menuitem,
JSC_CCALL(imgui_beginmenubar, ImGui::BeginMenuBar()) JSC_CCALL(imgui_beginmenubar, ImGui::BeginMenuBar())
JSC_CCALL(imgui_endmenubar, ImGui::EndMenuBar()) JSC_CCALL(imgui_endmenubar, ImGui::EndMenuBar())
JSC_SSCALL(imgui_textinput,
char buffer[512];
strncpy(buffer, str2, 512);
ImGui::InputText(str, buffer, sizeof(buffer));
ret = str2js(buffer);
)
static const JSCFunctionListEntry js_imgui_funcs[] = { static const JSCFunctionListEntry js_imgui_funcs[] = {
MIST_FUNC_DEF(imgui, begin, 1), MIST_FUNC_DEF(imgui, begin, 1),
MIST_FUNC_DEF(imgui, end,0), MIST_FUNC_DEF(imgui, end,0),
MIST_FUNC_DEF(imgui, beginmenu, 1), MIST_FUNC_DEF(imgui, beginmenu, 1),
MIST_FUNC_DEF(imgui, menuitem, 3), MIST_FUNC_DEF(imgui, menuitem, 3),
MIST_FUNC_DEF(imgui, beginmenubar, 0), MIST_FUNC_DEF(imgui, beginmenubar, 0),
MIST_FUNC_DEF(imgui, endmenubar, 0) MIST_FUNC_DEF(imgui, endmenubar, 0),
MIST_FUNC_DEF(imgui, textinput, 2),
}; };
static int started = 0; static int started = 0;