1#ifndef YAZE_GUI_CANVAS_H
2#define YAZE_GUI_CANVAS_H
8#include "imgui/imgui.h"
19using app::gfx::Bitmap;
74 const std::function<
void()> &event,
int tile_size,
77 void UpdateInfoGrid(ImVec2 bg_size,
int tile_size,
float scale = 1.0f,
78 float grid_size = 64.0f,
int label_id = 0);
110 float scale = 1.0f,
int alpha = 255);
114 std::vector<gfx::Bitmap> &tile16_individual_,
115 int tile_size,
float scale = 1.0f);
121 void DrawRect(
int x,
int y,
int w,
int h, ImVec4 color);
123 void DrawText(std::string text,
int x,
int y);
125 void DrawGrid(
float grid_step = 64.0f,
int tile_id_offset = 8);
128 void DrawInfoGrid(
float grid_step = 64.0f,
int tile_id_offset = 8,
139 if (tile_id >= num_columns * num_rows) {
171 labels_.push_back(ImVector<std::string>());
179 labels_.push_back(ImVector<std::string>());
182 labels_.push_back(ImVector<std::string>());
239 int num_sheets_to_load,
int canvas_id,
243 int width,
int height,
int tile_size,
bool is_loaded,
244 bool scrollbar,
int canvas_id);
A class to hold a shared pointer to a Rom object.
Represents a bitmap image.
Represents a canvas for drawing and manipulating graphics.
bool DrawTileSelector(int size)
void SetCanvasSize(ImVec2 canvas_size)
void DrawOutline(int x, int y, int w, int h)
void DrawBackground(ImVec2 canvas_size=ImVec2(0, 0), bool drag=false)
void DrawCustomHighlight(float grid_step)
void DrawRect(int x, int y, int w, int h, ImVec4 color)
Canvas(const std::string &id, ImVec2 canvas_size, CanvasGridSize grid_size)
void UpdateInfoGrid(ImVec2 bg_size, int tile_size, float scale=1.0f, float grid_size=64.0f, int label_id=0)
ImVec2 selected_tile_pos_
auto push_back(ImVec2 pos)
int GetTileIdFromMousePos()
void DrawInfoGrid(float grid_step=64.0f, int tile_id_offset=8, int label_id=0)
void DrawGrid(float grid_step=64.0f, int tile_id_offset=8)
void DrawBitmapGroup(std::vector< int > &group, std::vector< gfx::Bitmap > &tile16_individual_, int tile_size, float scale=1.0f)
Canvas(const std::string &id)
void DrawText(std::string text, int x, int y)
auto hover_mouse_pos() const
bool DrawSolidTilePainter(const ImVec4 &color, int size)
void DrawTileOnBitmap(int tile_size, gfx::Bitmap *bitmap, ImVec4 color)
void DrawBitmap(const Bitmap &bitmap, int border_offset=0, bool ready=true)
auto set_draggable(bool value)
Canvas(const std::string &id, ImVec2 canvas_size)
auto selected_tile_pos() const
auto selected_points() const
uint64_t edit_palette_sub_index_
bool enable_context_menu_
auto mutable_labels(int i)
void DrawSelectRect(int current_map, int tile_size=0x10, float scale=1.0f)
void DrawOutlineWithColor(int x, int y, int w, int h, ImVec4 color)
auto drawn_tile_position() const
auto set_selected_tile_pos(ImVec2 pos)
uint16_t edit_palette_index_
auto global_scale() const
std::vector< ImVec2 > selected_tiles_
bool enable_custom_labels_
void DrawBitmapTable(const BitmapTable &gfx_bin)
ImVector< ImVec2 > points_
bool DrawTilePainter(const Bitmap &bitmap, int size, float scale=1.0f)
auto selected_tiles() const
bool select_rect_active() const
Canvas(const std::string &id, ImVec2 canvas_size, CanvasGridSize grid_size, float global_scale)
void UpdateColorPainter(gfx::Bitmap &bitmap, const ImVec4 &color, const std::function< void()> &event, int tile_size, float scale=1.0f)
void DrawLayeredElements()
uint64_t edit_palette_group_name_index_
ImVec2 mouse_pos_in_canvas_
bool enable_hex_tile_labels_
void SetCanvasGridSize(CanvasGridSize grid_size)
auto set_current_labels(int i)
void DrawContextMenu(gfx::Bitmap *bitmap=nullptr)
auto set_highlight_tile_id(int i)
auto mutable_selected_tiles()
ImVector< ImVec2 > selected_points_
auto custom_labels_enabled()
bool IsMouseHovering() const
ImVector< ImVector< std::string > > labels_
void set_global_scale(float scale)
void DrawGridLines(float grid_step)
std::unordered_map< int, gfx::Bitmap > BitmapTable
void BitmapCanvasPipeline(gui::Canvas &canvas, const gfx::Bitmap &bitmap, int width, int height, int tile_size, bool is_loaded, bool scrollbar, int canvas_id)
void GraphicsBinCanvasPipeline(int width, int height, int tile_size, int num_sheets_to_load, int canvas_id, bool is_loaded, gfx::BitmapTable &graphics_bin)