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:
parent
6c4a110679
commit
24cc33e704
17 changed files with 530 additions and 37 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue