Skip to content

Commit 40893fb

Browse files
committed
Some updates
1 parent 5a0767a commit 40893fb

4 files changed

Lines changed: 103 additions & 10 deletions

File tree

.github/workflows/build_workflow.yml

Lines changed: 82 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
# macOS build
2121
- os: macos-latest
2222
build_type: Release
23-
cmake_args: -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE=Release
23+
cmake_args: -DCMAKE_BUILD_TYPE=Release
2424
# Windows build with Visual Studio
2525
- os: windows-latest
2626
build_type: Release
@@ -100,15 +100,25 @@ jobs:
100100
run: cmake --build build --parallel
101101

102102
# Package release for macOS: create a zip archive with the executable and assets
103-
- name: Package release (macOS)
103+
# Generate a macOS .app bundle using the provided generator script and package it
104+
- name: Package .app (macOS)
104105
if: runner.os == 'macOS'
105106
run: |
106-
mkdir -p packaged
107-
cp build/mw_recreation packaged/
108-
cp -r assets packaged/assets
109-
zip -r macos-latest.zip packaged
110-
111-
# Upload packaged release for macOS
107+
set -e
108+
# Ensure the generator script is executable
109+
chmod +x tools/macos_app_generator.sh
110+
# Run the script with the built binary and assets as arguments. This script
111+
# should create a .app bundle in the current directory or in a known location.
112+
tools/macos_app_generator.sh build/mw_recreation assets
113+
# Find the generated .app bundle (assumes only one .app is generated)
114+
APP_PATH=$(find . -name '*.app' -type d -print -quit)
115+
if [ -z "$APP_PATH" ]; then
116+
echo "No .app bundle found after running macos_app_generator.sh" && exit 1
117+
fi
118+
# Compress the .app bundle into a zip for distribution
119+
zip -r macos-latest.zip "$APP_PATH"
120+
121+
# Upload packaged .app for macOS
112122
- name: Upload release (macOS)
113123
if: runner.os == 'macOS'
114124
uses: actions/upload-artifact@v4
@@ -133,6 +143,69 @@ jobs:
133143
name: linux-latest
134144
path: linux-latest.tar.gz
135145

146+
# Build and package additional Linux distributions: AppImage and .deb
147+
- name: Package Linux AppImage
148+
if: runner.os == 'Linux'
149+
run: |
150+
set -e
151+
# Prepare AppDir structure for linuxdeploy
152+
mkdir -p appimage-build/AppDir/usr/bin
153+
cp build/mw_recreation appimage-build/AppDir/usr/bin/mw_recreation
154+
cp -r assets appimage-build/AppDir/usr/bin/assets
155+
# Create desktop entry for the AppImage
156+
mkdir -p appimage-build/AppDir/usr/share/applications
157+
cat > appimage-build/AppDir/usr/share/applications/mw_recreation.desktop <<'EOF'
158+
[Desktop Entry]
159+
Name=Music World Recreation
160+
Exec=mw_recreation
161+
Icon=mw_recreation
162+
Type=Application
163+
Categories=Game;
164+
EOF
165+
# Download linuxdeploy to bundle the AppImage
166+
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O linuxdeploy.AppImage
167+
chmod +x linuxdeploy.AppImage
168+
# Build the AppImage; this produces a file ending in .AppImage
169+
./linuxdeploy.AppImage --appdir appimage-build/AppDir --output appimage
170+
# Rename the generated file to a predictable name
171+
mv *.AppImage mw_recreation.AppImage
172+
173+
- name: Package Linux .deb
174+
if: runner.os == 'Linux'
175+
run: |
176+
set -e
177+
# Prepare debian package directory structure
178+
mkdir -p debpkg/usr/bin
179+
cp build/mw_recreation debpkg/usr/bin/
180+
mkdir -p debpkg/usr/share/mw_recreation
181+
cp -r assets debpkg/usr/share/mw_recreation/
182+
mkdir -p debpkg/DEBIAN
183+
cat > debpkg/DEBIAN/control <<'EOF'
184+
Package: mw-recreation
185+
Version: 1.0.0
186+
Section: games
187+
Priority: optional
188+
Architecture: amd64
189+
Maintainer: Unknown
190+
Description: Music World Recreation game built with raylib
191+
EOF
192+
# Build the Debian package
193+
dpkg-deb --build debpkg mw_recreation.deb
194+
195+
- name: Upload Linux AppImage
196+
if: runner.os == 'Linux'
197+
uses: actions/upload-artifact@v4
198+
with:
199+
name: linux-appimage
200+
path: mw_recreation.AppImage
201+
202+
- name: Upload Linux deb
203+
if: runner.os == 'Linux'
204+
uses: actions/upload-artifact@v4
205+
with:
206+
name: linux-deb
207+
path: mw_recreation.deb
208+
136209
# Upload build artifacts. Separate steps are used for Windows and
137210
# non‑Windows because the executable is generated into different
138211
# directories on Visual Studio.
@@ -148,4 +221,4 @@ jobs:
148221
uses: actions/upload-artifact@v4
149222
with:
150223
name: mw_recreation-${{ matrix.os }}
151-
path: build/mw_recreation
224+
path: build/mw_recreation

assets.zip

-61.8 MB
Binary file not shown.

mw_recreation

-3.36 MB
Binary file not shown.

src/screens/menu/settings/SettingsScreen.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
#include "screens/menu/MenuBg.h"
77
#include "screens/menu/SpritePath.h"
88
#include <algorithm>
9+
#include <cctype>
910
#include <cmath>
1011
#include <string>
12+
#include <string_view>
1113

1214
namespace {
1315
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(__EMSCRIPTEN__)
@@ -101,6 +103,23 @@ static void drawRoundedRectPx(Rectangle r, float radiusPx, Color color) {
101103
float roundness = (minSide > 0.0f) ? std::min(1.0f, (radiusPx * 2.0f) / minSide) : 0.0f;
102104
DrawRectangleRounded(r, roundness, 8, color);
103105
}
106+
107+
static bool ShouldAppendAlphaSuffix(std::string_view version) {
108+
size_t i = 0;
109+
while (i < version.size() && std::isspace((unsigned char)version[i])) ++i;
110+
if (i < version.size() && (version[i] == 'v' || version[i] == 'V')) ++i;
111+
112+
bool hasMajor = false;
113+
int major = 0;
114+
while (i < version.size() && std::isdigit((unsigned char)version[i])) {
115+
hasMajor = true;
116+
major = major * 10 + (version[i] - '0');
117+
++i;
118+
}
119+
120+
if (!hasMajor) return false;
121+
return major < 1;
122+
}
104123
}
105124

106125
float SettingsScreen::calcMaxScroll(int viewportHeight) const {
@@ -580,7 +599,8 @@ void SettingsScreen::draw(const DrawContext& ctx) {
580599

581600
back_.draw(*ctx.assets);
582601

583-
const std::string versionText = std::string("v") + buildinfo::kVersion;
602+
std::string versionText = std::string("v") + buildinfo::kVersion;
603+
if (ShouldAppendAlphaSuffix(buildinfo::kVersion)) versionText += " alpha";
584604
const int versionFontSize = 12;
585605
const int versionY = vh - 8 - versionFontSize;
586606
const int versionX = (vw - MeasureText(versionText.c_str(), versionFontSize)) / 2;

0 commit comments

Comments
 (0)