Add BeginWindowWithDisplaySettings with background opacity to start
This commit is contained in:
@@ -296,9 +296,9 @@ absl::Status OverworldEditor::DrawToolset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (show_gfx_group) {
|
if (show_gfx_group) {
|
||||||
ImGui::Begin("Gfx Group Editor", &show_gfx_group);
|
gui::BeginWindowWithDisplaySettings("Gfx Group Editor", &show_gfx_group);
|
||||||
RETURN_IF_ERROR(gfx_group_editor_.Update())
|
RETURN_IF_ERROR(gfx_group_editor_.Update())
|
||||||
ImGui::End();
|
gui::EndWindowWithDisplaySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_properties) {
|
if (show_properties) {
|
||||||
@@ -721,13 +721,15 @@ void OverworldEditor::CheckForCurrentMap() {
|
|||||||
parent_map_x * small_map_size, large_map_size,
|
parent_map_x * small_map_size, large_map_size,
|
||||||
large_map_size);
|
large_map_size);
|
||||||
// ow_map_canvas_.mutable_points()->push_back(
|
// ow_map_canvas_.mutable_points()->push_back(
|
||||||
// ImVec2(parent_map_x * small_map_size, parent_map_y * small_map_size));
|
// ImVec2(parent_map_x * small_map_size, parent_map_y *
|
||||||
|
// small_map_size));
|
||||||
} else {
|
} else {
|
||||||
ow_map_canvas_.DrawOutline(current_map_x * small_map_size,
|
ow_map_canvas_.DrawOutline(current_map_x * small_map_size,
|
||||||
current_map_y * small_map_size,
|
current_map_y * small_map_size, small_map_size,
|
||||||
small_map_size, small_map_size);
|
small_map_size);
|
||||||
// ow_map_canvas_.mutable_points()->push_back(
|
// ow_map_canvas_.mutable_points()->push_back(
|
||||||
// ImVec2(current_map_x * small_map_size, current_map_y * small_map_size));
|
// ImVec2(current_map_x * small_map_size, current_map_y *
|
||||||
|
// small_map_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prev_map_;
|
static int prev_map_;
|
||||||
|
|||||||
@@ -5,9 +5,32 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
|
|
||||||
|
void BeginWindowWithDisplaySettings(const char* id, bool* active, const ImVec2& size,
|
||||||
|
ImGuiWindowFlags flags) {
|
||||||
|
ImGuiStyle* ref = &ImGui::GetStyle();
|
||||||
|
static float childBgOpacity = 0.75f;
|
||||||
|
auto color = ImVec4(0.f, 0.f, 0.f, childBgOpacity);
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, color);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, color);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Border, color);
|
||||||
|
|
||||||
|
ImGui::Begin(id, active, flags | ImGuiWindowFlags_MenuBar);
|
||||||
|
ImGui::BeginMenuBar();
|
||||||
|
if (ImGui::BeginMenu("Display Settings")) {
|
||||||
|
ImGui::SliderFloat("Child Background Opacity", &childBgOpacity, 0.0f, 1.0f);
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EndWindowWithDisplaySettings() {
|
||||||
|
ImGui::End();
|
||||||
|
ImGui::PopStyleColor(3);
|
||||||
|
}
|
||||||
|
|
||||||
void DrawDisplaySettings(ImGuiStyle* ref) {
|
void DrawDisplaySettings(ImGuiStyle* ref) {
|
||||||
// You can pass in a reference ImGuiStyle structure to compare to, revert to
|
// You can pass in a reference ImGuiStyle structure to compare to, revert to
|
||||||
// and save to (without a reference style pointer, we will use one compared
|
// and save to (without a reference style pointer, we will use one compared
|
||||||
@@ -473,6 +496,7 @@ void ColorsYaze() {
|
|||||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
||||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -9,6 +9,12 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace gui {
|
namespace gui {
|
||||||
|
|
||||||
|
void BeginWindowWithDisplaySettings(const char* id, bool* active,
|
||||||
|
const ImVec2& size = ImVec2(0, 0),
|
||||||
|
ImGuiWindowFlags flags = 0);
|
||||||
|
|
||||||
|
void EndWindowWithDisplaySettings();
|
||||||
|
|
||||||
void DrawDisplaySettings(ImGuiStyle* ref = nullptr);
|
void DrawDisplaySettings(ImGuiStyle* ref = nullptr);
|
||||||
|
|
||||||
void TextWithSeparators(const absl::string_view& text);
|
void TextWithSeparators(const absl::string_view& text);
|
||||||
|
|||||||
Reference in New Issue
Block a user