1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add button_url[] and hypertext element to allow mods to open web pages (#13825)

Fixes #12500
This commit is contained in:
rubenwardy 2024-03-24 17:19:23 +00:00 committed by GitHub
parent 6c4a110679
commit 24cc33e704
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 530 additions and 37 deletions

View file

@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "inventory.h"
#include "util/string.h"
#include "irrlicht_changes/CGUITTFont.h"
#include "mainmenumanager.h"
#include "porting.h"
using namespace irr::gui;
@ -1106,6 +1108,18 @@ bool GUIHyperText::OnEvent(const SEvent &event)
newEvent.GUIEvent.EventType = EGET_BUTTON_CLICKED;
Parent->OnEvent(newEvent);
}
auto url_it = tag->attrs.find("url");
if (url_it != tag->attrs.end()) {
if (g_gamecallback) {
// in game
g_gamecallback->showOpenURLDialog(url_it->second);
} else {
// main menu
porting::open_url(url_it->second);
}
}
break;
}
}