console layout WIP
This commit is contained in:
parent
7ade504ec0
commit
f4e98b2091
3
res/layouts/console.xml
Normal file
3
res/layouts/console.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<container size='400' color='#00000080' size-func="unpack(gui.get_viewport())">
|
||||
<textbox id='prompt' margin='0' gravity='bottom-left' size-func="gui.get_viewport()[1],40"></textbox>
|
||||
</container>
|
||||
3
res/layouts/console.xml.lua
Normal file
3
res/layouts/console.xml.lua
Normal file
@ -0,0 +1,3 @@
|
||||
function on_open()
|
||||
document.prompt.focused = true
|
||||
end
|
||||
@ -56,7 +56,7 @@ std::unique_ptr<UiDocument> UiDocument::read(scriptenv penv, std::string name, f
|
||||
auto xmldoc = xml::parse(file.u8string(), text);
|
||||
|
||||
auto env = penv == nullptr
|
||||
? scripting::get_root_environment()
|
||||
? scripting::create_doc_environment(scripting::get_root_environment(), name)
|
||||
: scripting::create_doc_environment(penv, name);
|
||||
|
||||
gui::UiXmlReader reader(env);
|
||||
|
||||
@ -501,7 +501,7 @@ void Hud::updateElementsPosition(const Viewport& viewport) {
|
||||
));
|
||||
}
|
||||
secondUI->setPos(glm::vec2(
|
||||
glm::min(width/2-invwidth/2, width-caWidth-10-invwidth),
|
||||
glm::min(width/2-invwidth/2, width-caWidth-(inventoryView ? 10 : 0)-invwidth),
|
||||
height/2-totalHeight/2
|
||||
));
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ void menus::create_version_label(Engine* engine) {
|
||||
auto gui = engine->getGUI();
|
||||
auto text = ENGINE_VERSION_STRING+" debug build";
|
||||
gui->add(guiutil::create(
|
||||
"<label z-index='1000' color='#FFFFFF80' gravity='bottom-left' margin='4'>"
|
||||
"<label z-index='1000' color='#FFFFFF80' gravity='top-right' margin='4'>"
|
||||
+text+
|
||||
"</label>"
|
||||
));
|
||||
|
||||
@ -170,7 +170,7 @@ int lua::LuaState::callNoThrow(int argc) {
|
||||
}
|
||||
|
||||
int lua::LuaState::eval(int env, const std::string& src, const std::string& file) {
|
||||
auto srcText = "return ("+src+")";
|
||||
auto srcText = "return "+src;
|
||||
loadbuffer(env, srcText, file);
|
||||
return call(0);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user