small fix

This commit is contained in:
MihailRis 2024-01-20 23:44:35 +03:00
parent 1cc26a6b10
commit fe5cab0db0
3 changed files with 11 additions and 11 deletions

View File

@ -40,7 +40,6 @@ PagesControl* GUI::getMenu() {
} }
void GUI::actMouse(float delta) { void GUI::actMouse(float delta) {
auto hover = container->getAt(Events::cursor, nullptr); auto hover = container->getAt(Events::cursor, nullptr);
if (this->hover && this->hover != hover) { if (this->hover && this->hover != hover) {
this->hover->hover(false); this->hover->hover(false);
@ -53,7 +52,7 @@ void GUI::actMouse(float delta) {
} }
this->hover = hover; this->hover = hover;
if (Events::jclicked(0)) { if (Events::jclicked(mousecode::BUTTON_1)) {
if (pressed == nullptr && this->hover) { if (pressed == nullptr && this->hover) {
pressed = hover; pressed = hover;
pressed->click(this, Events::cursor.x, Events::cursor.y); pressed->click(this, Events::cursor.x, Events::cursor.y);
@ -73,6 +72,14 @@ void GUI::actMouse(float delta) {
pressed->mouseRelease(this, Events::cursor.x, Events::cursor.y); pressed->mouseRelease(this, Events::cursor.x, Events::cursor.y);
pressed = nullptr; pressed = nullptr;
} }
if (hover) {
for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) {
if (Events::jclicked(i)) {
hover->clicked(this, i);
}
}
}
} }
void GUI::act(float delta) { void GUI::act(float delta) {
@ -100,13 +107,6 @@ void GUI::act(float delta) {
if (Events::clicked(mousecode::BUTTON_1)) { if (Events::clicked(mousecode::BUTTON_1)) {
focus->mouseMove(this, Events::cursor.x, Events::cursor.y); focus->mouseMove(this, Events::cursor.x, Events::cursor.y);
} }
if (prevfocus == focus){
for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) {
if (Events::jclicked(i)) {
focus->clicked(this, i);
}
}
}
} }
} }
} }

View File

@ -278,4 +278,4 @@ void PagesControl::reset() {
Container::remove(current_.panel); Container::remove(current_.panel);
current_ = Page{nullptr}; current_ = Page{nullptr};
} }
} }

View File

@ -74,8 +74,8 @@ bool ChunksController::loadVisible(){
if (surrounding == MIN_SURROUNDING && !chunk->isLighted()) { if (surrounding == MIN_SURROUNDING && !chunk->isLighted()) {
if (!chunk->isLoadedLights()) { if (!chunk->isLoadedLights()) {
lighting->buildSkyLight(chunk->x, chunk->z); lighting->buildSkyLight(chunk->x, chunk->z);
lighting->onChunkLoaded(chunk->x, chunk->z);
} }
lighting->onChunkLoaded(chunk->x, chunk->z);
chunk->setLighted(true); chunk->setLighted(true);
return true; return true;
} }