nanoMMO
0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
talk_window.h
Go to the documentation of this file.
1
#ifndef NANOMMO_CLIENT_TALK_WINDOW_H_
2
#define NANOMMO_CLIENT_TALK_WINDOW_H_
3
4
#include <array>
5
#include <cstdint>
6
#include <optional>
7
#include <string>
8
9
#include "
protocol/chat.h
"
10
#include "protocol/nanommo.pb.h"
11
12
namespace
nanommo
{
13
14
/// A window to talk to an NPC, such as the storyteller, which opens when the
15
/// player clicks it.
16
class
TalkWindow
{
17
public
:
18
void
Open
(uint32_t npc, std::string name);
19
20
bool
open
()
const
{
return
npc_.has_value(); }
21
void
Close
() { npc_.reset(); }
22
23
/// Draws the window, while it's open. Returns what the player says to the
24
/// NPC, once they ask, and closes.
25
std::optional<protocol::Talk>
Build
();
26
27
private
:
28
std::optional<uint32_t> npc_;
29
std::string name_;
30
bool
focus_ =
false
;
31
// One more for the zero at the end.
32
std::array<char, kMaxChatLength + 1> words_{};
33
};
34
35
}
// namespace nanommo
36
37
#endif
// NANOMMO_CLIENT_TALK_WINDOW_H_
chat.h
nanommo::TalkWindow
Definition
talk_window.h:16
nanommo::TalkWindow::open
bool open() const
Definition
talk_window.h:20
nanommo::TalkWindow::Open
void Open(uint32_t npc, std::string name)
Definition
talk_window.cc:15
nanommo::TalkWindow::Close
void Close()
Definition
talk_window.h:21
nanommo::TalkWindow::Build
std::optional< protocol::Talk > Build()
Definition
talk_window.cc:21
nanommo
Definition
chat.cc:9
client
talk_window.h
Generated by
1.15.0