PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
text_events.h
1#pragma once
2
3#include "pixelbullet/core/event.h"
4
5#include <cstdint>
6#include <sstream>
7#include <string>
8
9namespace pixelbullet::input
10{
11class TextInputEvent : public core::Event
12{
13public:
14 explicit TextInputEvent(char32_t codepoint)
15 : codepoint_(codepoint)
16 {
17 }
18
19 [[nodiscard]] char32_t codepoint() const noexcept
20 {
21 return codepoint_;
22 }
23
24 [[nodiscard]] std::string to_string() const override
25 {
26 std::stringstream ss;
27 ss << "TextInputEvent: " << static_cast<std::uint32_t>(codepoint_);
28 return ss.str();
29 }
30
31 PB_EVENT_TYPE(TextInput)
32 PB_EVENT_CATEGORIES(core::EventCategory::Input | core::EventCategory::Keyboard)
33
34private:
35 char32_t codepoint_ = U'\0';
36};
37} // namespace pixelbullet::input
Definition event.h:108