refactor: replace references to Events with Input
This commit is contained in:
@@ -178,10 +178,10 @@ void GUI::actFocused() {
|
||||
focus = nullptr;
|
||||
return;
|
||||
}
|
||||
for (auto codepoint : Events::codepoints) {
|
||||
for (auto codepoint : input.getCodepoints()) {
|
||||
focus->typed(codepoint);
|
||||
}
|
||||
for (auto key : Events::pressedKeys) {
|
||||
for (auto key : input.getPressedKeys()) {
|
||||
focus->keyPressed(key);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ void GUI::act(float delta, const Viewport& vp) {
|
||||
updateTooltip(delta);
|
||||
|
||||
const auto& cursor = input.getCursor();
|
||||
if (!Events::isCursorLocked()) {
|
||||
if (!cursor.locked) {
|
||||
actMouse(delta, cursor);
|
||||
} else {
|
||||
if (hover) {
|
||||
@@ -357,3 +357,7 @@ void GUI::toggleDebug() {
|
||||
const Input& GUI::getInput() const {
|
||||
return engine.getInput();
|
||||
}
|
||||
|
||||
Input& GUI::getInput() {
|
||||
return engine.getInput();
|
||||
}
|
||||
|
||||
@@ -157,5 +157,6 @@ namespace gui {
|
||||
|
||||
void toggleDebug();
|
||||
const Input& getInput() const;
|
||||
Input& getInput();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -281,7 +281,8 @@ bool SlotView::isHighlighted() const {
|
||||
}
|
||||
|
||||
void SlotView::performLeftClick(ItemStack& stack, ItemStack& grabbed) {
|
||||
if (layout.taking && Events::pressed(keycode::LEFT_SHIFT)) {
|
||||
const auto& input = gui.getInput();
|
||||
if (layout.taking && input.pressed(keycode::LEFT_SHIFT)) {
|
||||
if (layout.shareFunc) {
|
||||
layout.shareFunc(layout.index, stack);
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ static std::shared_ptr<UINode> read_input_bind_box(
|
||||
UiXmlReader& reader, const xml::xmlelement& element
|
||||
) {
|
||||
auto bindname = element.attr("binding").getText();
|
||||
auto& found = Events::requireBinding(bindname);
|
||||
auto& found = reader.getGUI().getInput().getBindings().require(bindname);
|
||||
glm::vec4 padding = element.attr("padding", "6").asVec4();
|
||||
auto bindbox =
|
||||
std::make_shared<InputBindBox>(reader.getGUI(), found, padding);
|
||||
|
||||
Reference in New Issue
Block a user