Move flags/timer out of the header bar into a status bar above the grid

Header bar now holds only Difficulty + Leaderboard. A status bar above the
board shows the flag counter (left), the New Game button (center) and the
timer (right) as LCD-style panels styled with theme-aware CSS.
This commit is contained in:
2026-08-01 16:30:46 +01:00
parent 08ae7cd1ef
commit 9a9d9f3fea
3 changed files with 52 additions and 33 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ meson compile -C build
- `src/minefield.*` — pure game logic, no GTK: `Minefield` (board state, flag counting, chording), `Cell` bitfield, `GameDifficulty` presets, `GameState` enum.
- `src/board_widget.*``Gtk::DrawingArea`; all rendering is hand-drawn Cairo primitives (draw_cell/draw_digit/draw_flag/draw_bomb), input via `Gtk::GestureClick` + `EventControllerMotion`, confetti particle animation on win (frame-rate independent via `Gdk::FrameClock`).
- `src/window.*``Gtk::ApplicationWindow` with HeaderBar, difficulty popover (radio-style `CheckButton`s), leaderboard popover, timer; owns the `shared_ptr<Minefield>` and swaps it on new game. Keyboard shortcuts via `Gtk::EventControllerKey` (R/Ctrl+N new game, 1-4 difficulties, L leaderboard).
- `src/window.*``Gtk::ApplicationWindow` with HeaderBar (difficulty + leaderboard popovers, radio-style `CheckButton`s) and a status bar above the grid (LCD-style flags/timer panels via the `status-panel` CSS class, New Game button centered); owns the `shared_ptr<Minefield>` and swaps it on new game. Keyboard shortcuts via `Gtk::EventControllerKey` (R/Ctrl+N new game, 1-4 difficulties, L leaderboard). App-wide CSS (popover backgrounds, status bar) lives in a `Gtk::CssProvider` in the constructor.
- `src/leaderboard.*` — persistent best times per difficulty via `Glib::KeyFile` at `~/.config/nomines/leaderboard.ini` (recorded on win, shown in a header-bar popover; falls back to the pre-1.0 `~/.config/minesweeper/` path for migration). NOTE: uses the glibmm 2.80 refcounted `KeyFile::create()` API and gtkmm 4.14 `CheckButton` (a `Widget`+`Actionable`, not a `Button` — use `signal_toggled()` + `get_active()`, and `set_group(CheckButton&)`).
- glibmm 2.80 quirk: `SignalProxy<R(T...)>::connect()` (non-void return signals like `signal_key_pressed`) requires the `after` bool explicitly — `connect(slot, false)`. Void signals default it to true.
- `src/main.cpp` — single `Gtk::Application` (`io.github.bemagri.nomines`); `make_window_and_run<MainWindow>`.