added multi_menu
This commit is contained in:
1 parent
84006380db
commit
cb2e8318e7
12 files changed
+174
-89
No files matched your search
@@ -109,7 +109,6 @@ namespace ZL
|
||||
spaceGameStarted = 1;
|
||||
};
|
||||
|
||||
|
||||
menuManager.onMultiplayerPressed = [this]() {
|
||||
#ifdef NETWORK
|
||||
#ifdef EMSCRIPTEN
|
||||
|
||||
+12
-6
@@ -906,22 +906,28 @@ namespace ZL {
|
||||
}
|
||||
|
||||
void UiManager::onMouseUp(int x, int y) {
|
||||
std::vector<std::shared_ptr<UiButton>> clicked;
|
||||
|
||||
for (auto& b : buttons) {
|
||||
if (!b) continue;
|
||||
bool contains = b->rect.contains((float)x, (float)y);
|
||||
|
||||
if (b->state == ButtonState::Pressed) {
|
||||
if (contains && pressedButton == b) {
|
||||
if (b->onClick) {
|
||||
b->onClick(b->name);
|
||||
}
|
||||
clicked.push_back(b);
|
||||
}
|
||||
b->state = contains ? ButtonState::Hover : ButtonState::Normal;
|
||||
}
|
||||
}
|
||||
pressedButton.reset();
|
||||
|
||||
if (pressedSlider) {
|
||||
pressedSlider.reset();
|
||||
for (auto& b : clicked) {
|
||||
if (b->onClick) {
|
||||
b->onClick(b->name);
|
||||
}
|
||||
}
|
||||
|
||||
pressedButton.reset();
|
||||
if (pressedSlider) pressedSlider.reset();
|
||||
}
|
||||
|
||||
void UiManager::onKeyPress(unsigned char key) {
|
||||
|
||||
Reference in new issue
Block a user