nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
menu.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_MENU_H_
2#define NANOMMO_CLIENT_MENU_H_
3
4#include "client/settings.h"
5
6namespace nanommo {
7
8/// The keys, and what each does, as a table, for the settings' keys and the
9/// help.
10void BuildKeys();
11
12/// The game's menu, which Escape opens over the world when nothing else is
13/// open, and the settings it leads to, which O opens too: the interface,
14/// sound, graphics, and the keys. The sky is the server's, so there's nothing
15/// of it to set, except to turn the weather, or the day and the night, off.
16class Menu {
17 public:
18 bool open() const { return open_; }
19 void Toggle() { open_ = !open_; }
20 void Close() { open_ = false; }
21
22 bool settings_open() const { return settings_; }
23 void OpenSettings() { settings_ = true; }
24 void CloseSettings() { settings_ = false; }
25
26 enum class Choice { kNothing, kLogOut, kQuit };
27
28 /// Returns what the player picked, to log out or quit, if either. The
29 /// settings window edits the player's settings; reset_hotbar is set when
30 /// they ask for the hotbar's own order back.
31 Choice Build(Settings& settings, bool* reset_hotbar);
32
33 /// The row of round buttons in the bottom right, for the windows the keys
34 /// open, with their keys in their tooltips, and this menu's.
35 void BuildButtons(bool* character, bool* bag, bool* quests, bool* guild,
36 bool* map, bool* help);
37
38 private:
39 enum class Page { kInterface, kSound, kGraphics, kKeys };
40
41 void BuildSettings(Settings& settings, bool* reset_hotbar);
42
43 bool open_ = false;
44 bool settings_ = false;
45 Page page_ = Page::kInterface;
46 // The interface's scale while its slider's held, which takes effect once
47 // it's let go, as the slider itself would grow and shrink under the mouse.
48 float scale_ = 0.0f;
49};
50
51} // namespace nanommo
52
53#endif // NANOMMO_CLIENT_MENU_H_
void Close()
Definition menu.h:20
void OpenSettings()
Definition menu.h:23
bool open() const
Definition menu.h:18
void Toggle()
Definition menu.h:19
void CloseSettings()
Definition menu.h:24
Choice Build(Settings &settings, bool *reset_hotbar)
Definition menu.cc:98
void BuildButtons(bool *character, bool *bag, bool *quests, bool *guild, bool *map, bool *help)
Definition menu.cc:263
bool settings_open() const
Definition menu.h:22
Definition chat.cc:9
void BuildKeys()
Definition menu.cc:82
What the player sets, which the client keeps between runs.
Definition settings.h:54