Files
nomines/src/window.hpp
T
bernardo 2dbf64a2e8 Release 1.0.0: rename to NoMines, add leaderboard, theme support and release metadata
- Rename app/binary/app-id to nomines (io.github.bemagri.nomines), config dir
  moves to ~/.config/nomines with legacy path fallback
- Add persistent best-time leaderboard (Glib::KeyFile)
- Theme-aware board following system light/dark preference
- Beveled 3D cells, confetti win animation, keyboard shortcuts,
  right-click chording, per-difficulty window sizing
- Add AppStream metainfo, validate desktop file and metainfo via meson tests
- Fix license metadata to GPL-3.0-or-later and real homepage
2026-08-01 14:06:43 +01:00

54 lines
1.4 KiB
C++

#pragma once
#include <gtkmm.h>
#include <memory>
#include <utility>
#include <vector>
#include "minefield.hpp"
#include "board_widget.hpp"
#include "leaderboard.hpp"
class MainWindow : public Gtk::ApplicationWindow {
public:
MainWindow();
~MainWindow() override;
private:
// UI Setup
void setup_header_bar();
void setup_board();
void refresh_leaderboard();
// Actions
void start_new_game(const GameDifficulty& difficulty);
void on_game_state_changed();
bool on_timer_tick();
void show_game_over_dialog(bool won, bool new_best, int seconds);
// Widgets
Gtk::HeaderBar header_bar_;
Gtk::Button btn_new_game_;
Gtk::MenuButton btn_difficulty_;
Gtk::Popover menu_difficulty_;
Gtk::Box box_difficulty_; // Content for popover
std::vector<std::pair<GameDifficulty, Gtk::CheckButton*>> difficulty_buttons_;
Gtk::MenuButton btn_leaderboard_;
Gtk::Popover menu_leaderboard_;
Gtk::Box box_leaderboard_; // Content for popover
Gtk::Label lbl_time_;
Gtk::Label lbl_flags_;
BoardWidget board_widget_;
Leaderboard leaderboard_;
// Game State
std::shared_ptr<Minefield> minefield_;
sigc::connection timer_conn_;
sigc::connection dialog_timeout_conn_;
GameDifficulty current_difficulty_ = Minefield::DifficultyEasy;
Gtk::MessageDialog* game_over_dialog_ = nullptr;
};