yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
message_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MESSAGE_EDITOR_H
2#define YAZE_APP_EDITOR_MESSAGE_EDITOR_H
3
4#include <array>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "app/editor/editor.h"
13#include "app/gfx/bitmap.h"
14#include "app/gui/canvas.h"
15#include "app/gui/style.h"
16#include "app/rom.h"
17
18namespace yaze {
19namespace editor {
20
21constexpr int kGfxFont = 0x70000; // 2bpp format
22constexpr int kCharactersWidth = 0x74ADF;
23constexpr int kNumMessages = 396;
24constexpr int kFontGfxMessageSize = 128;
25constexpr int kFontGfxMessageDepth = 64;
26constexpr int kFontGfx16Size = 172 * 4096;
27
28constexpr uint8_t kBlockTerminator = 0x80;
29constexpr uint8_t kMessageBankChangeId = 0x80;
30
31class MessageEditor : public Editor {
32 public:
33 explicit MessageEditor(Rom* rom = nullptr) : rom_(rom) {
35 }
36
37 void Initialize() override;
38 absl::Status Load() override;
39 absl::Status Update() override;
40
41 void DrawMessageList();
42 void DrawCurrentMessage();
43 void DrawFontAtlas();
44 void DrawTextCommands();
47 void DrawDictionary();
48 void DrawMessagePreview();
49
50 absl::Status Save() override;
51 absl::Status SaveExpandedMessages();
52
53 absl::Status Cut() override;
54 absl::Status Copy() override;
55 absl::Status Paste() override;
56 absl::Status Undo() override;
57 absl::Status Redo() override;
58 absl::Status Find() override;
59 void Delete();
60 void SelectAll();
61
62 void set_rom(Rom* rom) { rom_ = rom; }
63 Rom* rom() const { return rom_; }
64
65 private:
66 bool case_sensitive_ = false;
67 bool match_whole_word_ = false;
68 std::string search_text_ = "";
69
70 std::array<uint8_t, 0x4000> raw_font_gfx_data_;
71 std::vector<std::string> parsed_messages_;
72 std::vector<MessageData> list_of_texts_;
73 std::vector<MessageData> expanded_messages_;
74
77
81
82 gui::Canvas font_gfx_canvas_{"##FontGfxCanvas", ImVec2(256, 256)};
84 ImVec2(172 * 2, 4096)};
88
89 // Card visibility states
90 bool show_message_list_ = false;
92 bool show_font_atlas_ = false;
93 bool show_dictionary_ = false;
94};
95
96} // namespace editor
97} // namespace yaze
98
99#endif // YAZE_APP_EDITOR_MESSAGE_EDITOR_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
Interface for editor classes.
Definition editor.h:82
EditorType type_
Definition editor.h:123
std::vector< std::string > parsed_messages_
absl::Status Copy() override
std::vector< MessageData > expanded_messages_
absl::Status Find() override
absl::Status Update() override
absl::Status Paste() override
absl::Status Undo() override
absl::Status Load() override
std::array< uint8_t, 0x4000 > raw_font_gfx_data_
MessageEditor(Rom *rom=nullptr)
absl::Status Cut() override
std::vector< MessageData > list_of_texts_
gfx::SnesPalette font_preview_colors_
absl::Status Redo() override
absl::Status Save() override
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:66
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:54
constexpr int kCharactersWidth
constexpr int kFontGfx16Size
constexpr uint8_t kBlockTerminator
constexpr int kGfxFont
constexpr int kFontGfxMessageSize
constexpr int kFontGfxMessageDepth
constexpr uint8_t kMessageBankChangeId
constexpr int kNumMessages
Main namespace for the application.