mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
commit
57d62980a9
6 changed files with 26 additions and 13 deletions
|
|
@ -7,7 +7,7 @@ function on_menu_clear()
|
|||
end
|
||||
end
|
||||
|
||||
function on_menu_setup()
|
||||
local function setup_backround()
|
||||
local controller = {}
|
||||
function controller.resize_menu_bg()
|
||||
local w, h = unpack(gui.get_viewport())
|
||||
|
|
@ -17,11 +17,16 @@ function on_menu_setup()
|
|||
end
|
||||
return w, h
|
||||
end
|
||||
gui.root.root:add(
|
||||
"<image id='menubg' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
|
||||
"z-index='-1' interactive='true'/>", controller)
|
||||
menubg = gui.root.menubg
|
||||
local bgid = random.uuid()
|
||||
gui.root.root:add(string.format(
|
||||
"<image id='%s' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
|
||||
"z-index='-1' interactive='true'/>", bgid), controller)
|
||||
menubg = gui.root[bgid]
|
||||
controller.resize_menu_bg()
|
||||
end
|
||||
|
||||
function on_menu_setup()
|
||||
setup_backround()
|
||||
menu.page = "main"
|
||||
menu.visible = true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ local _ffi = ffi
|
|||
function __vc_Canvas_set_data(self, data)
|
||||
if type(data) == "cdata" then
|
||||
self:_set_data(tostring(_ffi.cast("uintptr_t", data.bytes)), data.size)
|
||||
return
|
||||
end
|
||||
local width = self.width
|
||||
local height = self.height
|
||||
|
|
@ -60,7 +61,7 @@ function __vc_Canvas_set_data(self, data)
|
|||
for i=0, size - 1 do
|
||||
canvas_ffi_buffer[i] = data[i + 1]
|
||||
end
|
||||
self:_set_data(tostring(_ffi.cast("uintptr_t", canvas_ffi_buffer)), data.size)
|
||||
self:_set_data(tostring(_ffi.cast("uintptr_t", canvas_ffi_buffer)), size)
|
||||
end
|
||||
|
||||
local ipairs_mt_supported = false
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ void ContentLoader::loadContent(const dv::value& root) {
|
|||
item.icon = def.name;
|
||||
item.placingBlock = def.name;
|
||||
item.tags = def.tags;
|
||||
item.scriptFile = def.name + BLOCK_ITEM_SUFFIX + ".lua";
|
||||
|
||||
for (uint j = 0; j < 4; j++) {
|
||||
item.emission[j] = def.emission[j];
|
||||
|
|
|
|||
|
|
@ -390,9 +390,14 @@ void UINode::getIndices(
|
|||
const std::string& id = node->getId();
|
||||
if (!id.empty()) {
|
||||
const auto& found = map.find(id);
|
||||
if (found == map.end() || found->second.expired()) {
|
||||
map[id] = node;
|
||||
|
||||
if (found != map.end()) {
|
||||
auto prev = found->second.lock();
|
||||
if (prev && prev->getParent()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
map[id] = node;
|
||||
}
|
||||
auto container = std::dynamic_pointer_cast<gui::Container>(node);
|
||||
if (container) {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
#include "util/stringutil.hpp"
|
||||
|
||||
ItemDef::ItemDef(const std::string& name) : name(name) {
|
||||
caption = util::id_to_caption(name);
|
||||
description = "";
|
||||
ItemDef::ItemDef(const std::string& name)
|
||||
: name(name),
|
||||
caption(util::id_to_caption(name)),
|
||||
scriptName(name.substr(name.find(':') + 1)) {
|
||||
}
|
||||
void ItemDef::cloneTo(ItemDef& dst) {
|
||||
dst.caption = caption;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct ItemDef {
|
|||
std::string caption;
|
||||
|
||||
/// @brief Item description will shown in inventory
|
||||
std::string description;
|
||||
std::string description = "";
|
||||
|
||||
dv::value properties = nullptr;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ struct ItemDef {
|
|||
std::string icon = "blocks:notfound";
|
||||
|
||||
std::string placingBlock = "core:air";
|
||||
std::string scriptName = name.substr(name.find(':') + 1);
|
||||
std::string scriptName;
|
||||
|
||||
std::string modelName = name + ".model";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue