nanoMMO 0.97.8Test coverage / Every file / client/character_screen.h

Created: 2026-11-26 01:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/client/character_screen.h
Line
Count
Source
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
14
namespace 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.
18
class CharacterScreen {
19
 public:
20
0
  explicit CharacterScreen(ItemTable items) : items_(std::move(items)) {}
21
22
  CharacterScreen(const CharacterScreen&) = delete;
23
  CharacterScreen& operator=(const CharacterScreen&) = delete;
24
25
0
  bool* mutable_visible() { return &visible_; }
26
0
  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_