- 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
25 lines
664 B
C++
25 lines
664 B
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
// Persistent best times, stored as a GKeyFile under the user config dir:
|
|
// ~/.config/minesweeper/leaderboard.ini (gitignored)
|
|
class Leaderboard {
|
|
public:
|
|
// Records a finished game. Returns true when it is a new best time
|
|
// for the difficulty; the file is saved immediately.
|
|
bool record(const std::string& difficulty, int seconds);
|
|
|
|
// Best time in seconds for the difficulty, if one exists.
|
|
std::optional<int> best_time(const std::string& difficulty) const;
|
|
|
|
private:
|
|
void load();
|
|
void save();
|
|
|
|
std::map<std::string, int> times_;
|
|
bool loaded_ = false;
|
|
};
|