yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gui Namespace Reference

Graphical User Interface (GUI) components for the application. More...

Namespaces

namespace  anonymous_namespace{canvas.cc}
 
namespace  anonymous_namespace{style.cc}
 
namespace  zeml
 Zelda Editor Markup Language Functions.
 

Classes

struct  AssetObject
 
class  Bitmap
 Represents a bitmap image. More...
 
struct  Button
 
class  Canvas
 Represents a canvas for drawing and manipulating graphics. More...
 
struct  Color
 
struct  DungeonAsset
 
struct  ExampleSelectionWithDeletion
 
struct  GfxSheetAssetBrowser
 
struct  Layout
 
struct  MenuItem
 
class  MultiSelect
 
struct  OverworldAsset
 
class  Renderer
 The Renderer class represents the renderer for the Yaze application. More...
 
struct  SpriteAsset
 
struct  Table
 
struct  Text
 
struct  TextBox
 
struct  Theme
 
struct  UnsortedAsset
 

Typedefs

using ItemLabelFlags
 
using GuiElement = std::variant<std::function<void()>, std::string>
 
using Menu = std::vector<MenuItem>
 
using BitmapTable
 

Enumerations

enum class  CanvasType { kTile , kBlock , kMap }
 
enum class  CanvasMode { kPaint , kSelect }
 
enum class  CanvasGridSize { k8x8 , k16x16 , k32x32 , k64x64 }
 

Functions

void GraphicsBinCanvasPipeline (int width, int height, int tile_size, int num_sheets_to_load, int canvas_id, bool is_loaded, gfx::BitmapTable &graphics_bin)
 
void BitmapCanvasPipeline (gui::Canvas &canvas, gfx::Bitmap &bitmap, int width, int height, int tile_size, bool is_loaded, bool scrollbar, int canvas_id)
 
ImVec4 ConvertSnesColorToImVec4 (const gfx::SnesColor &color)
 
gfx::SnesColor ConvertImVec4ToSnesColor (const ImVec4 &color)
 
IMGUI_API bool SnesColorButton (absl::string_view id, gfx::SnesColor &color, ImGuiColorEditFlags flags, const ImVec2 &size_arg)
 
IMGUI_API bool SnesColorEdit4 (absl::string_view label, gfx::SnesColor *color, ImGuiColorEditFlags flags)
 
absl::Status DisplayPalette (gfx::SnesPalette &palette, bool loaded)
 
void SelectablePalettePipeline (uint64_t &palette_id, bool &refresh_graphics, gfx::SnesPalette &palette)
 
absl::Status DisplayEditablePalette (gfx::SnesPalette &palette, const std::string &title, bool show_color_picker, int colors_per_row, ImGuiColorEditFlags flags)
 
ImVec4 ConvertColorToImVec4 (const Color &color)
 
std::string ColorToHexString (const Color &color)
 
bool InputHex (const char *label, uint64_t *data)
 
bool InputHex (const char *label, int *data, int num_digits, float input_width)
 
bool InputHexShort (const char *label, uint32_t *data)
 
bool InputHexWord (const char *label, uint16_t *data, float input_width, bool no_step)
 
bool InputHexWord (const char *label, int16_t *data, float input_width, bool no_step)
 
bool InputHexByte (const char *label, uint8_t *data, float input_width, bool no_step)
 
bool InputHexByte (const char *label, uint8_t *data, uint8_t max_value, float input_width, bool no_step)
 
void Paragraph (const std::string &text)
 
bool ClickableText (const std::string &text)
 
void ItemLabel (absl::string_view title, ItemLabelFlags flags)
 
bool ListBox (const char *label, int *current_item, const std::vector< std::string > &items, int height_in_items)
 
bool InputTileInfo (const char *label, gfx::TileInfo *tile_info)
 
ImGuiID GetID (const std::string &id)
 
ImGuiKey MapKeyToImGuiKey (char key)
 
void AddTableColumn (Table &table, const std::string &label, GuiElement element)
 
void DrawTable (Table &params)
 
void DrawMenu (Menu &menu)
 
bool OpenUrl (const std::string &url)
 
void RenderLayout (const Layout &layout)
 
absl::StatusOr< ThemeLoadTheme (const std::string &filename)
 
absl::Status SaveTheme (const Theme &theme)
 
void ApplyTheme (const Theme &theme)
 
void ColorsYaze ()
 
void DrawBitmapViewer (const std::vector< gfx::Bitmap > &bitmaps, float scale, int &current_bitmap_id)
 
TextEditor::LanguageDefinition GetAssemblyLanguageDef ()
 
void BeginWindowWithDisplaySettings (const char *id, bool *active, const ImVec2 &size, ImGuiWindowFlags flags)
 
void EndWindowWithDisplaySettings ()
 
void BeginPadding (int i)
 
void EndPadding ()
 
void BeginNoPadding ()
 
void EndNoPadding ()
 
void BeginChildWithScrollbar (const char *str_id)
 
void BeginChildBothScrollbars (int id)
 
void DrawDisplaySettings (ImGuiStyle *ref)
 
void TextWithSeparators (const absl::string_view &text)
 
void DrawFontManager ()
 

Variables

constexpr uint32_t kBlackColor = IM_COL32(0, 0, 0, 255)
 
constexpr uint32_t kRectangleColor = IM_COL32(32, 32, 32, 255)
 
constexpr uint32_t kWhiteColor = IM_COL32(255, 255, 255, 255)
 
constexpr uint32_t kOutlineRect = IM_COL32(255, 255, 255, 200)
 
constexpr ImGuiButtonFlags kMouseFlags
 
const int kStepOneHex = 0x01
 
const int kStepFastHex = 0x0F
 
constexpr ImVec2 kDefaultModalSize = ImVec2(200, 0)
 
constexpr ImVec2 kZeroPos = ImVec2(0, 0)
 
constexpr std::string kSeparator = "-"
 

Detailed Description

Graphical User Interface (GUI) components for the application.

Typedef Documentation

◆ ItemLabelFlags

Initial value:
enum ItemLabelFlag {
Left = 1u << 0u,
Right = 1u << 1u,
Default = Left,
}

Definition at line 49 of file input.h.

◆ GuiElement

using yaze::gui::GuiElement = std::variant<std::function<void()>, std::string>

Definition at line 61 of file input.h.

◆ Menu

using yaze::gui::Menu = std::vector<MenuItem>

Definition at line 85 of file input.h.

◆ BitmapTable

Definition at line 254 of file bitmap.h.

Enumeration Type Documentation

◆ CanvasType

enum class yaze::gui::CanvasType
strong
Enumerator
kTile 
kBlock 
kMap 

Definition at line 24 of file canvas.h.

◆ CanvasMode

enum class yaze::gui::CanvasMode
strong
Enumerator
kPaint 
kSelect 

Definition at line 25 of file canvas.h.

◆ CanvasGridSize

enum class yaze::gui::CanvasGridSize
strong
Enumerator
k8x8 
k16x16 
k32x32 
k64x64 

Definition at line 26 of file canvas.h.

Function Documentation

◆ GraphicsBinCanvasPipeline()

void yaze::gui::GraphicsBinCanvasPipeline ( int width,
int height,
int tile_size,
int num_sheets_to_load,
int canvas_id,
bool is_loaded,
gfx::BitmapTable & graphics_bin )

◆ BitmapCanvasPipeline()

◆ ConvertSnesColorToImVec4()

ImVec4 yaze::gui::ConvertSnesColorToImVec4 ( const gfx::SnesColor & color)

Definition at line 10 of file color.cc.

References yaze::gfx::SnesColor::rgb().

Referenced by DisplayEditablePalette(), SnesColorButton(), and SnesColorEdit4().

Here is the call graph for this function:

◆ ConvertImVec4ToSnesColor()

gfx::SnesColor yaze::gui::ConvertImVec4ToSnesColor ( const ImVec4 & color)

Definition at line 19 of file color.cc.

Referenced by DisplayEditablePalette().

◆ SnesColorButton()

IMGUI_API bool yaze::gui::SnesColorButton ( absl::string_view id,
gfx::SnesColor & color,
ImGuiColorEditFlags flags,
const ImVec2 & size_arg )

◆ SnesColorEdit4()

IMGUI_API bool yaze::gui::SnesColorEdit4 ( absl::string_view label,
gfx::SnesColor * color,
ImGuiColorEditFlags flags )

◆ DisplayPalette()

absl::Status yaze::gui::DisplayPalette ( gfx::SnesPalette & palette,
bool loaded )

Definition at line 54 of file color.cc.

References yaze::gfx::SnesPalette::size().

Referenced by yaze::editor::MessageEditor::DrawCurrentMessage(), and yaze::editor::ScreenEditor::DrawInventoryMenuEditor().

Here is the call graph for this function:

◆ SelectablePalettePipeline()

void yaze::gui::SelectablePalettePipeline ( uint64_t & palette_id,
bool & refresh_graphics,
gfx::SnesPalette & palette )

◆ DisplayEditablePalette()

absl::Status yaze::gui::DisplayEditablePalette ( gfx::SnesPalette & palette,
const std::string & title,
bool show_color_picker,
int colors_per_row,
ImGuiColorEditFlags flags )

◆ ConvertColorToImVec4()

ImVec4 yaze::gui::ConvertColorToImVec4 ( const Color & color)
inline

◆ ColorToHexString()

std::string yaze::gui::ColorToHexString ( const Color & color)
inline

◆ InputHex() [1/2]

◆ InputHex() [2/2]

IMGUI_API bool yaze::gui::InputHex ( const char * label,
int * data,
int num_digits,
float input_width )

Definition at line 148 of file input.cc.

References ImGui::InputScalarLeft(), kStepFastHex, and kStepOneHex.

Here is the call graph for this function:

◆ InputHexShort()

IMGUI_API bool yaze::gui::InputHexShort ( const char * label,
uint32_t * data )

Definition at line 155 of file input.cc.

References kStepFastHex, and kStepOneHex.

◆ InputHexWord() [1/2]

◆ InputHexWord() [2/2]

IMGUI_API bool yaze::gui::InputHexWord ( const char * label,
int16_t * data,
float input_width,
bool no_step )

Definition at line 168 of file input.cc.

References ImGui::InputScalarLeft(), kStepFastHex, and kStepOneHex.

Here is the call graph for this function:

◆ InputHexByte() [1/2]

◆ InputHexByte() [2/2]

IMGUI_API bool yaze::gui::InputHexByte ( const char * label,
uint8_t * data,
uint8_t max_value,
float input_width,
bool no_step )

Definition at line 182 of file input.cc.

References ImGui::InputScalarLeft(), kStepFastHex, and kStepOneHex.

Here is the call graph for this function:

◆ Paragraph()

IMGUI_API void yaze::gui::Paragraph ( const std::string & text)

Definition at line 195 of file input.cc.

◆ ClickableText()

IMGUI_API bool yaze::gui::ClickableText ( const std::string & text)
Todo
Setup themes and text/clickable colors

Definition at line 200 of file input.cc.

Referenced by yaze::editor::EditorManager::DrawHomepage().

◆ ItemLabel()

IMGUI_API void yaze::gui::ItemLabel ( absl::string_view title,
ItemLabelFlags flags )

Definition at line 236 of file input.cc.

Referenced by yaze::editor::MusicEditor::DrawToolset().

◆ ListBox()

IMGUI_API bool yaze::gui::ListBox ( const char * label,
int * current_item,
const std::vector< std::string > & items,
int height_in_items )

Definition at line 279 of file input.cc.

◆ InputTileInfo()

bool yaze::gui::InputTileInfo ( const char * label,
gfx::TileInfo * tile_info )

◆ GetID()

IMGUI_API ImGuiID yaze::gui::GetID ( const std::string & id)

◆ MapKeyToImGuiKey()

ImGuiKey yaze::gui::MapKeyToImGuiKey ( char key)

Definition at line 307 of file input.cc.

Referenced by yaze::editor::ParseShortcut().

◆ AddTableColumn()

void yaze::gui::AddTableColumn ( Table & table,
const std::string & label,
GuiElement element )

◆ DrawTable()

◆ DrawMenu()

void yaze::gui::DrawMenu ( Menu & menu)

Definition at line 397 of file input.cc.

References kSeparator.

Referenced by yaze::editor::EditorManager::DrawMenuBar().

◆ OpenUrl()

IMGUI_API bool yaze::gui::OpenUrl ( const std::string & url)

Definition at line 426 of file input.cc.

Referenced by yaze::editor::EditorManager::DrawHomepage().

◆ RenderLayout()

void yaze::gui::RenderLayout ( const Layout & layout)

Definition at line 431 of file input.cc.

References yaze::gui::Layout::elements.

◆ LoadTheme()

absl::StatusOr< Theme > yaze::gui::LoadTheme ( const std::string & filename)

Definition at line 48 of file style.cc.

References yaze::core::LoadFile(), and RETURN_IF_ERROR.

Here is the call graph for this function:

◆ SaveTheme()

◆ ApplyTheme()

◆ ColorsYaze()

void yaze::gui::ColorsYaze ( )

◆ DrawBitmapViewer()

void yaze::gui::DrawBitmapViewer ( const std::vector< gfx::Bitmap > & bitmaps,
float scale,
int & current_bitmap_id )

Definition at line 231 of file style.cc.

References yaze::gfx::Bitmap::height(), yaze::gfx::Bitmap::texture(), and yaze::gfx::Bitmap::width().

Here is the call graph for this function:

◆ GetAssemblyLanguageDef()

◆ BeginWindowWithDisplaySettings()

void yaze::gui::BeginWindowWithDisplaySettings ( const char * id,
bool * active,
const ImVec2 & size,
ImGuiWindowFlags flags )
Todo
Add more display settings to popup windows.

Definition at line 347 of file style.cc.

Referenced by yaze::editor::OverworldEditor::DrawOverworldProperties(), and yaze::editor::OverworldEditor::DrawToolset().

◆ EndWindowWithDisplaySettings()

void yaze::gui::EndWindowWithDisplaySettings ( )

◆ BeginPadding()

◆ EndPadding()

void yaze::gui::EndPadding ( )

◆ BeginNoPadding()

void yaze::gui::BeginNoPadding ( )

Definition at line 378 of file style.cc.

Referenced by yaze::editor::OverworldEditor::DrawOverworldCanvas().

◆ EndNoPadding()

◆ BeginChildWithScrollbar()

◆ BeginChildBothScrollbars()

void yaze::gui::BeginChildBothScrollbars ( int id)

Definition at line 389 of file style.cc.

Referenced by yaze::editor::OverworldEditor::DrawOverworldCanvas().

◆ DrawDisplaySettings()

void yaze::gui::DrawDisplaySettings ( ImGuiStyle * ref)

Definition at line 396 of file style.cc.

Referenced by yaze::editor::EditorManager::DrawMenuBar().

◆ TextWithSeparators()

◆ DrawFontManager()

void yaze::gui::DrawFontManager ( )

Definition at line 759 of file style.cc.

Referenced by yaze::editor::SettingsEditor::Update().

Variable Documentation

◆ kBlackColor

uint32_t yaze::gui::kBlackColor = IM_COL32(0, 0, 0, 255)
constexpr

Definition at line 37 of file canvas.cc.

Referenced by yaze::gui::Canvas::DrawRect(), and yaze::gui::Canvas::DrawText().

◆ kRectangleColor

uint32_t yaze::gui::kRectangleColor = IM_COL32(32, 32, 32, 255)
constexpr

Definition at line 38 of file canvas.cc.

Referenced by yaze::gui::Canvas::DrawBackground().

◆ kWhiteColor

◆ kOutlineRect

uint32_t yaze::gui::kOutlineRect = IM_COL32(255, 255, 255, 200)
constexpr

Definition at line 40 of file canvas.cc.

Referenced by yaze::gui::Canvas::DrawOutline().

◆ kMouseFlags

ImGuiButtonFlags yaze::gui::kMouseFlags
constexpr
Initial value:
=
ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight

Definition at line 42 of file canvas.cc.

Referenced by yaze::gui::Canvas::DrawBackground().

◆ kStepOneHex

const int yaze::gui::kStepOneHex = 0x01

◆ kStepFastHex

const int yaze::gui::kStepFastHex = 0x0F

◆ kDefaultModalSize

◆ kZeroPos

ImVec2 yaze::gui::kZeroPos = ImVec2(0, 0)
constexpr

◆ kSeparator

std::string yaze::gui::kSeparator = "-"
constexpr

Definition at line 91 of file input.h.

Referenced by DrawMenu(), and yaze::editor::EditorManager::Initialize().