This commit is contained in:
Bernardo Magri
2025-10-16 19:32:21 +01:00
parent fe0b39a49d
commit 05bc82a5c1
2 changed files with 69 additions and 17 deletions

View File

@@ -10,31 +10,83 @@
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
# Robust fallbacks across channels
wrapGApps = pkgs.wrapGAppsHook4 or pkgs.wrapGAppsHook;
adwaitaTheme = pkgs.gnome.adwaita-icon-theme or pkgs.adwaita-icon-theme;
in
{
# Main package
packages.default = pkgs.stdenv.mkDerivation rec {
pname = "minesweeper";
version = "0.1";
src = self;
nativeBuildInputs = [ pkgs.meson pkgs.ninja pkgs.pkg-config ];
buildInputs = [ pkgs.gtkmm4 pkgs.libsigcxx30 pkgs.glibmm ];
strictDeps = true;
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
gobject-introspection
wrapGApps
];
buildInputs = with pkgs; [
gtk4
gtkmm4
glibmm
libsigcxx30
gdk-pixbuf
librsvg # SVG loader
gvfs # GIO modules
gsettings-desktop-schemas
hicolor-icon-theme
adwaitaTheme
];
# Ensure we use Nix-provided GIO modules, not host ones
preFixup = ''
gappsWrapperArgs+=(
--set GIO_EXTRA_MODULES ${pkgs.gvfs}/lib/gio/modules
)
'';
meta = with pkgs.lib; {
description = "A simple GTKmm4 Minesweeper game";
homepage = "https://example.org/minesweeper";
license = licenses.gpl3Plus;
platforms = platforms.linux;
mainProgram = "minesweeper";
};
};
# nix run support
apps.${system}.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/minesweeper";
};
# Dev shell for hacking
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ pkgs.meson pkgs.ninja pkgs.pkg-config ];
buildInputs = [ pkgs.gtkmm4 pkgs.libsigcxx30 pkgs.glibmm ];
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
gobject-introspection
];
buildInputs = with pkgs; [
gtk4
gtkmm4
glibmm
libsigcxx30
gdk-pixbuf
librsvg
gvfs
gsettings-desktop-schemas
hicolor-icon-theme
adwaitaTheme
];
};
});
}

View File

@@ -43,7 +43,7 @@ void MainWindow::setupUI()
{
// Configure main window
set_title("MineSweeper");
set_default_size(400, 400);
set_default_size(650, 650);
set_resizable(true);
// Configure main layout
@@ -249,14 +249,14 @@ void MainWindow::setupCSSProviders()
css_provider->load_from_data(
"button.cell-button { border-radius: 0; margin: 1px; padding: 0; }"
".cell-button:checked { background-color: #e0e0e0; }"
".label-1 { font-weight: bold; font-size: 1.2em; color: blue; }"
".label-2 { font-weight: bold; font-size: 1.2em; color: green; }"
".label-3 { font-weight: bold; font-size: 1.2em; color: darkorange; }"
".label-4 { font-weight: bold; font-size: 1.2em; color: purple; }"
".label-5 { font-weight: bold; font-size: 1.2em; color: red; }"
".label-6 { font-weight: bold; font-size: 1.2em; color: salmon; }"
".label-7 { font-weight: bold; font-size: 1.2em; color: turquoise; }"
".label-8 { font-weight: bold; font-size: 1.2em; color: magenta; }"
".label-1 { font-weight: bold; font-size: 1.1em; color: blue; }"
".label-2 { font-weight: bold; font-size: 1.1em; color: green; }"
".label-3 { font-weight: bold; font-size: 1.1em; color: darkorange; }"
".label-4 { font-weight: bold; font-size: 1.1em; color: purple; }"
".label-5 { font-weight: bold; font-size: 1.1em; color: red; }"
".label-6 { font-weight: bold; font-size: 1.1em; color: salmon; }"
".label-7 { font-weight: bold; font-size: 1.1em; color: turquoise; }"
".label-8 { font-weight: bold; font-size: 1.1em; color: magenta; }"
".confetti { opacity: 0.8; }"
);
@@ -1061,7 +1061,7 @@ void MainWindow::showNameInputDialog(int time)
showLeaderboard();
}
dialog->close();
//dialog->close();
// Ask if player wants to play again
auto newGameDialog = Gtk::make_managed<Gtk::MessageDialog>(