Merge branch 'dev' into upgrade-vca

This commit is contained in:
MihailRis 2026-10-09 00:10:24 +03:00
commit 371b8baed1
9 changed files with 39 additions and 13 deletions

View file

@ -41,8 +41,14 @@ skeleton:is_visible([optional] index: int) -> bool
skeleton:set_visible([optional] index: int, status: bool)
-- Returns the color of the entity
skeleton:get_color() -> vec3
skeleton:get_color() -> vec4
-- Returns the color of the bone
skeleton:get_color(index: int) -> vec4
-- Sets the color of the entity
skeleton:set_color(color: vec3)
skeleton:set_color(color: vec4)
-- Sets the color of the bone
skeleton:set_color(color: vec4, bone: int)
```

View file

@ -42,8 +42,14 @@ skeleton:is_visible([опционально] index: int) -> boolean
skeleton:set_visible([опционально] index: int, status: boolean)
-- Возвращает цвет сущности
skeleton:get_color() -> vec3
skeleton:get_color() -> vec4
-- Возвращает цвет кости
skeleton:get_color(index: int) -> vec4
-- Устанавливает цвет сущности
skeleton:set_color(color: vec3)
```
skeleton:set_color(color: vec4)
-- Устанавливает цвет кости
skeleton:set_color(color: vec4, index: int)
```

View file

@ -8,7 +8,7 @@ using runnable = std::function<void()>;
template<class T> using supplier = std::function<T()>;
template<class T> using consumer = std::function<void(T)>;
using KeyCallback = std::function<bool()>;
using InputCallback = std::function<bool()>;
// data sources
using wstringsupplier = std::function<std::wstring()>;

View file

@ -28,7 +28,10 @@ MenuScreen::~MenuScreen() = default;
void MenuScreen::onOpen() {
engine.getContentControl().resetContent({});
auto menu = engine.getGUI().getMenu();
auto& gui = engine.getGUI();
gui.setActiveFrame(gui::GUI::CORE_MAIN);
auto menu = gui.getMenu();
menu->reset();
}

View file

@ -44,10 +44,13 @@ static int l_add_callback(lua::State* L) {
auto& input = engine->getInput();
if (pos != std::string::npos) {
std::string prefix = bindname.substr(0, pos);
auto prefix = std::string_view(bindname).substr(0, pos);
if (prefix == "key") {
auto key = input_util::keycode_from(bindname.substr(pos + 1));
handler = input.addKeyCallback(key, actual_callback);
} else if (prefix == "mouse") {
auto mouse = input_util::mousecode_from(bindname.substr(pos + 1));
handler = input.addMouseCallback(mouse, actual_callback);
}
}

View file

@ -263,7 +263,7 @@ runnable lua::create_runnable(State* L) {
};
}
KeyCallback lua::create_simple_handler(State* L) {
InputCallback lua::create_simple_handler(State* L) {
auto funcptr = create_lambda_handler(L);
return [=]() -> bool {
if (!get_from_registry(L, LAMBDAS_TABLE, *funcptr, false)) {

View file

@ -665,7 +665,7 @@ namespace lua {
}
runnable create_runnable(lua::State*);
KeyCallback create_simple_handler(lua::State*);
InputCallback create_simple_handler(lua::State*);
scripting::common_func create_lambda(lua::State*);
scripting::common_func create_lambda_nothrow(lua::State*);

View file

@ -216,10 +216,17 @@ public:
return bindings;
}
ObserverHandler addKeyCallback(Keycode key, KeyCallback callback) override {
ObserverHandler addKeyCallback(Keycode key, InputCallback callback) override {
return keyCallbacks[key].add(std::move(callback));
}
ObserverHandler addMouseCallback(Mousecode button, InputCallback callback) override {
return addKeyCallback(
static_cast<Keycode>(MOUSE_KEYS_OFFSET + static_cast<int>(button)),
std::move(callback)
);
}
const std::vector<Keycode>& getPressedKeys() const override {
return pressedKeys;
}

View file

@ -288,12 +288,13 @@ public:
virtual const Bindings& getBindings() const = 0;
virtual ObserverHandler addKeyCallback(Keycode key, KeyCallback callback) = 0;
virtual ObserverHandler addKeyCallback(Keycode key, InputCallback callback) = 0;
virtual ObserverHandler addMouseCallback(Mousecode button, InputCallback callback) = 0;
virtual const std::vector<Keycode>& getPressedKeys() const = 0;
virtual const std::vector<uint>& getCodepoints() const = 0;
ObserverHandler addCallback(const std::string& name, KeyCallback callback) {
ObserverHandler addCallback(const std::string& name, InputCallback callback) {
return getBindings().require(name).onactived.add(callback);
}
};