nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
settings.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_SETTINGS_H_
2#define NANOMMO_CLIENT_SETTINGS_H_
3
4#include <cstdint>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "absl/status/statusor.h"
10#include "client/graphics.h"
11#include "client/sound.h"
12
13namespace nanommo {
14
15/// The names over heads, which show while the pointer's on someone, or they're
16/// picked, and always for those the player says, with what the player says.
18 /// Whose show always.
19 bool monsters = false;
20 bool players = false;
21 bool npcs = false;
22 bool yours = false;
23 /// What shows with a name: a health bar under it, the level before it, and
24 /// a player's guild.
25 bool health = true;
26 bool levels = true;
27 bool guilds = true;
28
29 bool operator==(const NameplateSettings&) const = default;
30};
31
32/// How the interface looks, as the player sets it.
34 /// How much bigger or smaller than its size for the screen the interface
35 /// is drawn, from half to twice.
36 float scale = 1.0f;
37 /// Whether the minimap's in the top right, and whether it turns with the
38 /// camera, so that what's ahead is up, rather than north. The map's on M
39 /// either way.
40 bool minimap = true;
41 bool minimap_turns = false;
42 /// The hotbar's skills after the swing, by their ids, in the order the
43 /// player dragged them into: none, for the order of their levels.
44 std::vector<uint32_t> hotbar;
46 /// The language the interface is in, by its code, as translations.h's
47 /// kLanguages has it: none for English.
48 std::string language;
49
50 bool operator==(const InterfaceSettings&) const = default;
51};
52
53/// What the player sets, which the client keeps between runs.
61
62/// Where the player's settings go: in Application Support on macOS, and in
63/// the XDG config folder elsewhere, which is ~/.config unless set.
64std::string SettingsPath();
65
66/// The settings in the file, with the defaults for what it doesn't have. With
67/// no file, as on a first run, they're all the defaults.
68absl::StatusOr<Settings> LoadSettings(const std::string& path);
69
70/// Writes the settings next to the path, and renames them over it, as a
71/// rename replaces a file in one step: a crash halfway through leaves the old
72/// file whole.
73absl::Status SaveSettings(const std::string& path, const Settings& player);
74
75} // namespace nanommo
76
77#endif // NANOMMO_CLIENT_SETTINGS_H_
Definition chat.cc:9
absl::StatusOr< Settings > LoadSettings(const std::string &path)
Definition settings.cc:44
absl::Status SaveSettings(const std::string &path, const Settings &player)
Definition settings.cc:118
std::string SettingsPath()
Definition settings.cc:34
How the interface looks, as the player sets it.
Definition settings.h:33
std::vector< uint32_t > hotbar
Definition settings.h:44
NameplateSettings nameplates
Definition settings.h:45
bool operator==(const InterfaceSettings &) const =default
bool monsters
Whose show always.
Definition settings.h:19
bool operator==(const NameplateSettings &) const =default
What the player sets, which the client keeps between runs.
Definition settings.h:54
InterfaceSettings ui
Definition settings.h:57
SoundSettings sound
Definition settings.h:55
GraphicsSettings graphics
Definition settings.h:56
bool operator==(const Settings &) const =default
How loud the game is, as the player sets it in the settings window.
Definition sound.h:7