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
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
explicit
CharacterScreen
(
ItemTable
items) : items_(std::move(items)) {}
21
22
CharacterScreen
(
const
CharacterScreen
&) =
delete
;
23
CharacterScreen
&
operator=
(
const
CharacterScreen
&) =
delete
;
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_
animator.h
nanommo::CharacterScreen::mutable_visible
bool * mutable_visible()
Definition
character_screen.h:25
nanommo::CharacterScreen::Build
std::optional< protocol::ItemAction > Build(const std::vector< Figure > &figures, const protocol::World &world, const protocol::Inventory &bag)
Definition
character_screen.cc:73
nanommo::CharacterScreen::Toggle
void Toggle()
Definition
character_screen.h:26
nanommo::CharacterScreen::CharacterScreen
CharacterScreen(ItemTable items)
Definition
character_screen.h:20
nanommo::CharacterScreen::operator=
CharacterScreen & operator=(const CharacterScreen &)=delete
nanommo::CharacterScreen::CharacterScreen
CharacterScreen(const CharacterScreen &)=delete
nanommo::CharacterScreen::Render
void Render(const Renderer &renderer)
Definition
character_screen.cc:54
nanommo::Offscreen
Definition
offscreen.h:24
nanommo::Renderer
Definition
renderer.h:35
items.h
nanommo
Definition
chat.cc:9
offscreen.h
renderer.h
nanommo::ItemTable
The items in the items file, by id.
Definition
items.h:18
client
character_screen.h
Generated by
1.15.0