yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
tile16_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_TILE16EDITOR_H
2#define YAZE_APP_EDITOR_TILE16EDITOR_H
3
4#include <array>
5#include <vector>
6
7#include "absl/status/status.h"
9#include "app/gfx/bitmap.h"
11#include "app/gfx/snes_tile.h"
12#include "app/gui/canvas.h"
13#include "app/rom.h"
15#include "imgui/imgui.h"
16#include "util/notify.h"
17
18namespace yaze {
19namespace editor {
20
24class Tile16Editor : public gfx::GfxContext, public SharedRom {
25 public:
27 std::array<gfx::Bitmap, zelda3::kNumTile16Individual> &tile16_individual)
28 : tile16_individual_(tile16_individual) {}
29 absl::Status InitBlockset(const gfx::Bitmap &tile16_blockset_bmp,
30 const gfx::Bitmap &current_gfx_bmp,
31 std::array<uint8_t, 0x200> &all_tiles_types);
32
33 absl::Status Update();
34 absl::Status DrawMenu();
35
36 void DrawTile16Editor();
37 absl::Status UpdateTile16Transfer();
38 absl::Status UpdateBlockset();
39
40 absl::Status DrawToCurrentTile16(ImVec2 pos);
41
42 absl::Status UpdateTile16Edit();
43
44 absl::Status DrawTileEditControls();
45
46 absl::Status UpdateTransferTileCanvas();
47
48 absl::Status LoadTile8();
49
50 absl::Status SetCurrentTile(int id);
51
52 private:
54 bool transfer_started_ = false;
56 bool x_flip = false;
57 bool y_flip = false;
58 bool priority_tile = false;
59
63 uint8_t current_palette_ = 0;
64
67
68 std::array<uint8_t, 0x200> all_tiles_types_;
69
70 // Tile16 blockset for selecting the tile to edit
71 gui::Canvas blockset_canvas_{"blocksetCanvas", ImVec2(0x100, 0x4000),
74
75 // Canvas for editing the selected tile
76 gui::Canvas tile16_edit_canvas_{"Tile16EditCanvas", ImVec2(0x40, 0x40),
79
80 // Tile8 canvas to get the tile to drawing in the tile16_edit_canvas_
86
89
90 std::array<gfx::Bitmap, zelda3::kNumTile16Individual> &tile16_individual_;
91 std::vector<gfx::Bitmap> current_gfx_individual_;
92
95
96 absl::Status status_;
97
100 std::array<gfx::Bitmap, kNumGfxSheets> transfer_gfx_;
101 absl::Status transfer_status_;
102};
103
104} // namespace editor
105} // namespace yaze
106
107#endif // YAZE_APP_EDITOR_TILE16EDITOR_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:59
SharedRom()=default
Allows the user to view and edit in game palettes.
util::NotifyValue< uint32_t > notify_tile16
absl::Status UpdateTransferTileCanvas()
std::array< uint8_t, 0x200 > all_tiles_types_
gfx::SnesPalette palette_
absl::Status UpdateTile16Transfer()
absl::Status SetCurrentTile(int id)
Tile16Editor(std::array< gfx::Bitmap, zelda3::kNumTile16Individual > &tile16_individual)
absl::Status DrawToCurrentTile16(ImVec2 pos)
zelda3::Overworld transfer_overworld_
std::vector< gfx::Bitmap > current_gfx_individual_
std::array< gfx::Bitmap, kNumGfxSheets > transfer_gfx_
absl::Status DrawTileEditControls()
std::array< gfx::Bitmap, zelda3::kNumTile16Individual > & tile16_individual_
absl::Status InitBlockset(const gfx::Bitmap &tile16_blockset_bmp, const gfx::Bitmap &current_gfx_bmp, std::array< uint8_t, 0x200 > &all_tiles_types)
util::NotifyValue< uint8_t > notify_palette
Represents a bitmap image.
Definition bitmap.h:66
Shared graphical context across editors.
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Represents a canvas for drawing and manipulating graphics.
Definition canvas.h:34
A class to manage a value that can be modified and notify when it changes.
Definition notify.h:13
Represents the full Overworld data, light and dark world.
Definition overworld.h:111
Editors are the view controllers for the application.
constexpr int kTilesheetHeight
Definition snes_tile.h:16
constexpr int kTilesheetWidth
Definition snes_tile.h:15
Main namespace for the application.
Definition controller.cc:18