yaze 0.2.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"
12#include "app/gfx/bitmap.h"
13#include "app/gui/canvas.h"
14#include "app/gui/style.h"
15#include "app/rom.h"
16
17namespace yaze {
18namespace editor {
19
20constexpr int kGfxFont = 0x70000; // 2bpp format
21constexpr int kCharactersWidth = 0x74ADF;
22constexpr int kNumMessages = 396;
23constexpr int kFontGfxMessageSize = 128;
24constexpr int kFontGfxMessageDepth = 64;
25constexpr int kFontGfx16Size = 172 * 4096;
26
27constexpr uint8_t kBlockTerminator = 0x80;
28constexpr uint8_t kMessageBankChangeId = 0x80;
29
30class MessageEditor : public Editor {
31 public:
32 explicit MessageEditor(Rom* rom = nullptr) : rom_(rom) {
34 }
35
36 void Initialize() override;
37 absl::Status Load() override;
38 absl::Status Update() override;
39
40 void DrawMessageList();
41 void DrawCurrentMessage();
42 void DrawFontAtlas();
43 void DrawTextCommands();
46 void DrawDictionary();
47 void DrawMessagePreview();
48
49 absl::Status Save() override;
50 absl::Status SaveExpandedMessages();
51
52 absl::Status Cut() override;
53 absl::Status Copy() override;
54 absl::Status Paste() override;
55 absl::Status Undo() override;
56 absl::Status Redo() override;
57 absl::Status Find() override;
58 void Delete();
59 void SelectAll();
60
61 void set_rom(Rom* rom) { rom_ = rom; }
62 Rom* rom() const { return rom_; }
63
64 private:
65 bool case_sensitive_ = false;
66 bool match_whole_word_ = false;
67 std::string search_text_ = "";
68
69 std::array<uint8_t, 0x4000> raw_font_gfx_data_;
70 std::vector<std::string> parsed_messages_;
71 std::vector<MessageData> list_of_texts_;
72 std::vector<MessageData> expanded_messages_;
73
76
80
81 gui::Canvas font_gfx_canvas_{"##FontGfxCanvas", ImVec2(256, 256)};
83 ImVec2(172 * 2, 4096)};
87};
88
89} // namespace editor
90} // namespace yaze
91
92#endif // YAZE_APP_EDITOR_MESSAGE_EDITOR_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:58
EditorType type_
Definition editor.h:90
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.
Definition bitmap.h:59
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Represents a canvas for drawing and manipulating graphics.
Definition canvas.h:37
Editors are the view controllers for the application.
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.
Definition controller.cc:18