nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
character_screen.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_CHARACTER_SCREEN_H_
2#define NANOMMO_CLIENT_CHARACTER_SCREEN_H_
3
4#include <optional>
5#include <utility>
6#include <vector>
7
8#include "client/animator.h"
9#include "client/offscreen.h"
10#include "client/renderer.h"
11#include "content/items.h"
12#include "protocol/nanommo.pb.h"
13
14namespace nanommo {
15
16/// You, as others see you, on C: standing on a lit stage, with a slot round
17/// you for each thing you wear, and your health and experience under it.
19 public:
20 explicit CharacterScreen(ItemTable items) : items_(std::move(items)) {}
21
24
25 bool* mutable_visible() { return &visible_; }
26 void Toggle() { visible_ = !visible_; }
27
28 void Render(const Renderer& renderer);
29
30 /// Draws the window, while it's open, with what the player wears, and
31 /// returns what they do with it, as the bag's window does.
32 std::optional<protocol::ItemAction> Build(const std::vector<Figure>& figures,
33 const protocol::World& world,
34 const protocol::Inventory& bag);
35
36 private:
37 static constexpr int kPreviewWidth = 360;
38 static constexpr int kPreviewHeight = 472;
39
40 ItemTable items_;
41 bool visible_ = false;
42 Offscreen preview_{kPreviewWidth, kPreviewHeight};
43};
44
45} // namespace nanommo
46
47#endif // NANOMMO_CLIENT_CHARACTER_SCREEN_H_
std::optional< protocol::ItemAction > Build(const std::vector< Figure > &figures, const protocol::World &world, const protocol::Inventory &bag)
CharacterScreen(ItemTable items)
CharacterScreen & operator=(const CharacterScreen &)=delete
CharacterScreen(const CharacterScreen &)=delete
void Render(const Renderer &renderer)
Definition chat.cc:9
The items in the items file, by id.
Definition items.h:18