Skip to content

Commit d4732be

Browse files
authored
Update graphical interface with new branding (#766)
This incorporates the new Gambit logo/branding in the graphical interface: * Modernise splash screen behaviour * Modernise about dialog implementation and design
1 parent 9524392 commit d4732be

7 files changed

Lines changed: 1309 additions & 498 deletions

File tree

build_support/osx/Info.plist.in

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
3-
<plist version="0.9">
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
44
<dict>
55
<key>CFBundleInfoDictionaryVersion</key>
66
<string>6.0</string>
77
<key>CFBundleIdentifier</key>
88
<string>org.gambit-project.gambit</string>
99
<key>CFBundleDevelopmentRegion</key>
10-
<string>English</string>
10+
<string>en</string>
1111
<key>CFBundleExecutable</key>
1212
<string>gambit</string>
1313
<key>CFBundleIconFile</key>
1414
<string>gambit</string>
1515
<key>CFBundleName</key>
1616
<string>Gambit</string>
17+
<key>CFBundleDisplayName</key>
18+
<string>Gambit</string>
1719
<key>CFBundlePackageType</key>
1820
<string>APPL</string>
19-
<key>CFBundleSignature</key>
20-
<string>????</string>
2121
<key>CFBundleVersion</key>
2222
<string>@GAMBIT_VERSION@</string>
2323
<key>CFBundleShortVersionString</key>
2424
<string>@GAMBIT_VERSION@</string>
2525
<key>CFBundleGetInfoString</key>
26-
<string>Gambit version @GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project</string>
27-
<key>CFBundleLongVersionString</key>
28-
<string>@GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project</string>
26+
<string>Gambit version @GAMBIT_VERSION@, (c) 1994-2026 The Gambit Project</string>
2927
<key>NSHumanReadableCopyright</key>
30-
<string>Copyright 1994-2025 The Gambit Project</string>
31-
<key>LSRequiresCarbon</key>
32-
<true/>
33-
<key>CSResourcesFileMapped</key>
34-
<true/>
28+
<string>Copyright 1994-2026 The Gambit Project</string>
3529
<key>CFBundleDocumentTypes</key>
3630
<array>
3731
<dict>

build_support/osx/gambit.icns

137 KB
Binary file not shown.

src/gui/app.cc

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,55 @@
2626
#ifndef WX_PRECOMP
2727
#include <wx/wx.h>
2828
#endif // WX_PRECOMP
29+
#include <wx/display.h>
2930
#include <wx/image.h>
30-
#include <wx/splash.h>
3131

3232
#include "gambit.h"
3333

3434
#include "app.h"
3535
#include "gameframe.h"
3636

37+
#include "bitmaps/gambitbig.xpm"
38+
3739
namespace Gambit::GUI {
3840

39-
bool Application::OnInit()
41+
static wxBitmap MakeScaledSplashBitmap(const wxBitmap &srcBmp, double fracOfShortSide)
4042
{
41-
#include "bitmaps/gambitbig.xpm"
43+
const wxPoint mouse = wxGetMousePosition();
44+
const int dispIdx = wxDisplay::GetFromPoint(mouse);
45+
wxDisplay disp(dispIdx == wxNOT_FOUND ? 0 : dispIdx);
46+
47+
wxRect geom = disp.GetGeometry(); // pixels in that display
48+
const int shortSide = std::min(geom.width, geom.height);
49+
const int targetMax = std::max(200, int(shortSide * fracOfShortSide));
50+
51+
const int w = srcBmp.GetWidth();
52+
const int h = srcBmp.GetHeight();
53+
const double s = double(targetMax) / double(std::max(w, h));
54+
55+
const int newW = std::max(1, int(std::lround(w * s)));
56+
const int newH = std::max(1, int(std::lround(h * s)));
57+
58+
wxImage img = srcBmp.ConvertToImage();
59+
img.Rescale(newW, newH, wxIMAGE_QUALITY_HIGH);
60+
61+
return wxBitmap(img);
62+
}
63+
64+
wxBEGIN_EVENT_TABLE(Application, wxApp) EVT_TIMER(wxID_ANY, Application::OnSplashDismissTimer)
65+
wxEND_EVENT_TABLE()
66+
67+
bool Application::OnInit()
68+
{
69+
wxApp::OnInit();
70+
71+
const wxBitmap bitmap(gambitbig_xpm);
72+
m_splashTimer.Start();
73+
m_splash = new wxSplashScreen(MakeScaledSplashBitmap(bitmap, 0.45),
74+
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, nullptr,
75+
wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE);
76+
m_splash->Show();
77+
m_splash->Update();
4278
wxConfigBase::Set(new wxConfig(_T("Gambit"), _T("Gambit")));
4379
m_fileHistory.Load(*wxConfigBase::Get());
4480
// Immediately saving this back forces the entries to be created at
@@ -47,12 +83,6 @@ bool Application::OnInit()
4783
// m_fileHistory.Save(config);
4884
wxConfigBase::Get()->Read(_T("/General/CurrentDirectory"), &m_currentDir, _T(""));
4985

50-
const wxBitmap bitmap(gambitbig_xpm);
51-
/*wxSplashScreen *splash =*/
52-
new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 2000, nullptr, -1,
53-
wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER | wxSTAY_ON_TOP);
54-
wxYield();
55-
5686
// Process command line arguments, if any.
5787
for (int i = 1; i < wxApp::argc; i++) {
5888
const AppLoadResult result = LoadFile(wxApp::argv[i]);
@@ -86,9 +116,30 @@ bool Application::OnInit()
86116
// Set up the help system.
87117
wxInitAllImageHandlers();
88118

119+
this->CallAfter(&Application::DismissSplash);
120+
89121
return true;
90122
}
91123

124+
void Application::DismissSplash()
125+
{
126+
if (!m_splash) {
127+
return;
128+
}
129+
130+
const long minDisplay = 1000;
131+
const long elapsed = m_splashTimer.Time();
132+
133+
if (elapsed < minDisplay) {
134+
m_splashDismissTimer.SetOwner(this);
135+
m_splashDismissTimer.StartOnce(minDisplay - elapsed);
136+
return;
137+
}
138+
139+
m_splash->Destroy();
140+
m_splash = nullptr;
141+
}
142+
92143
AppLoadResult Application::LoadFile(const wxString &p_filename)
93144
{
94145
std::ifstream infile((const char *)p_filename.mb_str());

src/gui/app.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <wx/wx.h>
2727
#include <wx/config.h> // for wxConfig
2828
#include <wx/docview.h> // for wxFileHistory
29+
#include <wx/splash.h>
2930

3031
namespace Gambit::GUI {
3132

@@ -37,8 +38,15 @@ class Application final : public wxApp {
3738
wxString m_currentDir; /* Current position in directory tree. */
3839
wxFileHistory m_fileHistory{10};
3940
std::list<GameDocument *> m_documents;
41+
wxSplashScreen *m_splash{nullptr};
42+
wxStopWatch m_splashTimer;
43+
wxTimer m_splashDismissTimer;
4044

4145
bool OnInit() override;
46+
void DismissSplash();
47+
void OnSplashDismissTimer(wxTimerEvent &) { DismissSplash(); }
48+
49+
wxDECLARE_EVENT_TABLE();
4250

4351
public:
4452
Application() = default;

0 commit comments

Comments
 (0)