9 total_tiles_(config_.total_tiles),
10 widget_id_(std::move(widget_id)) {}
14 total_tiles_(config.total_tiles),
15 widget_id_(std::move(widget_id)) {}
42 const int tile_display_size =
48 const ImVec2 content_size(
54 ImGui::SetCursorPos(ImVec2(0, 0));
55 ImGui::Dummy(content_size);
56 ImGui::SetCursorPos(ImVec2(0, 0));
64 const ImVec2 window_size = ImGui::GetWindowSize();
66 target.x - (window_size.x / 2.0f) + (tile_display_size / 2.0f);
68 target.y - (window_size.y / 2.0f) + (tile_display_size / 2.0f);
69 scroll_x = std::max(0.0f, scroll_x);
70 scroll_y = std::max(0.0f, scroll_y);
71 ImGui::SetScrollX(scroll_x);
72 ImGui::SetScrollY(scroll_y);
102 int tile_display_size) {
105 if (!ImGui::IsItemHovered()) {
109 const bool clicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
110 const bool double_clicked =
111 ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left);
113 if (clicked || double_clicked) {
134 const ImVec2 screen_pos = ImGui::GetIO().MousePos;
143 if (local.x < 0.0f || local.y < 0.0f) {
147 const int column =
static_cast<int>(local.x / tile_display_size);
148 const int row =
static_cast<int>(local.y / tile_display_size);
165 tile_display_size, tile_display_size,
186 return ImVec2(-1, -1);
188 const int tile_display_size =
Represents a bitmap image optimized for SNES ROM hacking.
Modern, robust canvas for drawing and manipulating graphics.
void DrawBitmap(Bitmap &bitmap, int border_offset, float scale)
void DrawOutlineWithColor(int x, int y, int w, int h, ImVec4 color)
void DrawBackground(ImVec2 canvas_size=ImVec2(0, 0))
void DrawGrid(float grid_step=64.0f, int tile_id_offset=8)
Graphical User Interface (GUI) components for the application.