Skip to content

Commit

Permalink
gui ed url
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Apr 25, 2024
1 parent 30acf31 commit 50c0504
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
11 changes: 11 additions & 0 deletions data/gui/Game_Help.layout
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@
<Property key="Colour" value="0.9 0.7 1.0"/>
</Widget>

<Widget type="EditBox" skin="EditBox" position="32 350 660 24" name="OpenUrl">
<Property key="ReadOnly" value="true"/>
<Property key="MultiLine" value="false"/>
<Property key="WordWrap" value="false"/>
<Property key="VisibleHScroll" value="false"/>
<Property key="VisibleVScroll" value="true"/>
<Property key="MaxTextLength" value="260"/>
<Property key="TextColour" value="0.86 0.84 1"/>
<Property key="Colour" value="0.5 0.5 0.7"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 406 660 24">
<Property key="Caption" value="#{UserDir}"/>
<Property key="TextColour" value="0.7 0.85 1"/>
Expand Down
5 changes: 4 additions & 1 deletion src/game/CGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,10 @@ class CGui : public BGui
// fonts
SV svFntWnd, svFntGui, svFntHud, svFntTimes;

// 🔗 open urls
// 🔗 open urls ----
Ed edOpenUrl =0;
void Url(const std::string& url);

void btnTrackEditor(WP); // start ed exe
void btnWelcome(WP), btnWebsite(WP), btnWiki(WP), btnWikiInput(WP);
void btnForum(WP), btnSources(WP), btnEdTut(WP), btnTransl(WP), btnDonations(WP);
Expand Down
12 changes: 7 additions & 5 deletions src/game/Gui_Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,6 @@ void CGui::InitGui()
Edt(edNetLocalPort, "edNetLocalPort", evEdNetLocalPort); edNetLocalPort->setCaption( toStr(pSet->local_port));


// user dir
Ed edUserDir = fEd("EdUserDir");
edUserDir->setCaption(PATHS::UserConfigDir());


/// 🕹️ Input tab -------
InitInputGui();

Expand Down Expand Up @@ -557,6 +552,13 @@ void CGui::InitGui()
sv= &svFntTimes; sv->Init("FntTimes", &pSet->font_times, 0.6f, 1.5f); sv->DefaultF(1.f);


// user dir
Ed edUserDir = fEd("EdUserDir");
edUserDir->setCaption(PATHS::UserConfigDir());

edOpenUrl = fEd("OpenUrl");
edOpenUrl->setCaption("https://stuntrally.tuxfamily.org/");

// 🔗 open url btns -------------
Btn("BtnTrackEditor", btnTrackEditor);
Btn("OpenWelcome", btnWelcome); Btn("OpenWebsite", btnWebsite); Btn("OpenSources", btnSources);
Expand Down
22 changes: 14 additions & 8 deletions src/game/Gui_Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,38 +369,44 @@ void CGui::btnWelcome(WP)
{
app->mWndWelcome->setVisible(true);
}

void CGui::Url(const string& url)
{
edOpenUrl->setCaption(url);
PATHS::OpenUrl(url);
}
void CGui::btnWebsite(WP)
{
PATHS::OpenUrl("https://stuntrally.tuxfamily.org/");
Url("https://stuntrally.tuxfamily.org/");
}
void CGui::btnWiki(WP)
{
PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/_menu.md");
Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/_menu.md");
}
void CGui::btnWikiInput(WP)
{
PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/Running.md#controllers");
Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/Running.md#controllers");
}

void CGui::btnForum(WP)
{
PATHS::OpenUrl("https://groups.f-hub.org/stunt-rally/");
Url("https://groups.f-hub.org/stunt-rally/");
}
void CGui::btnSources(WP)
{
PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3");
Url("https://github.com/stuntrally/stuntrally3");
}
void CGui::btnEdTut(WP)
{
PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/Editor.md");
Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/Editor.md");
}
void CGui::btnTransl(WP)
{
PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/Localization.md");
Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/Localization.md");
}
void CGui::btnDonations(WP)
{
PATHS::OpenUrl("https://cryham.tuxfamily.org/donate/");
Url("https://cryham.tuxfamily.org/donate/");
}


Expand Down

0 comments on commit 50c0504

Please sign in to comment.