yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1#ifndef YAZE_GUI_COLOR_H
2#define YAZE_GUI_COLOR_H
3
4// #include <format>
5#include <string>
6
7#include "absl/status/status.h"
9#include "imgui/imgui.h"
10
11namespace yaze {
12namespace gui {
13
14struct Color {
15 float red;
16 float blue;
17 float green;
18 float alpha;
19};
20
21inline ImVec4 ConvertColorToImVec4(const Color &color) {
22 return ImVec4(color.red, color.green, color.blue, color.alpha);
23}
24
25inline std::string ColorToHexString(const Color &color) {
26 return "";
27/* std::format(
28 "{:02X}{:02X}{:02X}{:02X}", static_cast<int>(color.red * 255),
29 static_cast<int>(color.green * 255), static_cast<int>(color.blue * 255),
30 static_cast<int>(color.alpha * 255)); */
31}
32
33// A utility function to convert an SnesColor object to an ImVec4 with
34// normalized color values
35ImVec4 ConvertSnesColorToImVec4(const gfx::SnesColor &color);
36
37// The wrapper function for ImGui::ColorButton that takes a SnesColor reference
38IMGUI_API bool SnesColorButton(absl::string_view id, gfx::SnesColor &color,
39 ImGuiColorEditFlags flags = 0,
40 const ImVec2 &size_arg = ImVec2(0, 0));
41
42IMGUI_API bool SnesColorEdit4(absl::string_view label, gfx::SnesColor *color,
43 ImGuiColorEditFlags flags = 0);
44
45absl::Status DisplayPalette(gfx::SnesPalette &palette, bool loaded);
46
47void SelectablePalettePipeline(uint64_t &palette_id, bool &refresh_graphics,
48 gfx::SnesPalette &palette);
49
50} // namespace gui
51} // namespace yaze
52
53#endif
SNES Color container.
Definition snes_color.h:38
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Graphical User Interface (GUI) components for the application.
Definition canvas.cc:15
ImVec4 ConvertColorToImVec4(const Color &color)
Definition color.h:21
IMGUI_API bool SnesColorButton(absl::string_view id, gfx::SnesColor &color, ImGuiColorEditFlags flags, const ImVec2 &size_arg)
Definition color.cc:19
ImVec4 ConvertSnesColorToImVec4(const gfx::SnesColor &color)
Definition color.cc:10
void SelectablePalettePipeline(uint64_t &palette_id, bool &refresh_graphics, gfx::SnesPalette &palette)
Definition color.cc:123
IMGUI_API bool SnesColorEdit4(absl::string_view label, gfx::SnesColor *color, ImGuiColorEditFlags flags)
Definition color.cc:36
std::string ColorToHexString(const Color &color)
Definition color.h:25
absl::Status DisplayPalette(gfx::SnesPalette &palette, bool loaded)
Definition color.cc:50
Main namespace for the application.
Definition controller.cc:18
float alpha
Definition color.h:18
float green
Definition color.h:17