feat: Implement Jump-to Functionality for Cross-Editor Navigation
- Added JumpToDungeonRoom and JumpToOverworldMap methods to facilitate quick navigation between dungeon and overworld editors. - Introduced SwitchToEditor method to manage editor tab activation based on the selected editor type. - Enhanced DungeonEditorV2 with room and entrance selection capabilities, improving user experience and workflow efficiency. - Updated header files to declare new methods and ensure proper integration within the editor management system.
This commit is contained in:
@@ -141,7 +141,7 @@ void DrawCanvasRect(ImDrawList* draw_list, ImVec2 canvas_p0, ImVec2 scrolling,
|
||||
ImVec2 size(canvas_p0.x + scrolling.x + scaled_x + scaled_w,
|
||||
canvas_p0.y + scrolling.y + scaled_y + scaled_h);
|
||||
|
||||
uint32_t color_u32 = IM_COL32(color.x, color.y, color.z, color.w);
|
||||
uint32_t color_u32 = IM_COL32(color.x * 255, color.y * 255, color.z * 255, color.w * 255);
|
||||
draw_list->AddRectFilled(origin, size, color_u32);
|
||||
|
||||
// Add a black outline
|
||||
|
||||
@@ -229,11 +229,14 @@ bool Toolset::AddUsageStatsButton(const char* tooltip) {
|
||||
// ============================================================================
|
||||
|
||||
EditorCard::EditorCard(const char* title, const char* icon)
|
||||
: title_(title), icon_(icon ? icon : ""), default_size_(400, 300) {}
|
||||
: title_(title), icon_(icon ? icon : ""), default_size_(400, 300) {
|
||||
window_name_ = icon_.empty() ? title_ : icon_ + " " + title_;
|
||||
}
|
||||
|
||||
EditorCard::EditorCard(const char* title, const char* icon, bool* p_open)
|
||||
: title_(title), icon_(icon ? icon : ""), default_size_(400, 300) {
|
||||
p_open_ = p_open;
|
||||
window_name_ = icon_.empty() ? title_ : icon_ + " " + title_;
|
||||
}
|
||||
|
||||
void EditorCard::SetDefaultSize(float width, float height) {
|
||||
@@ -301,11 +304,20 @@ bool EditorCard::Begin(bool* p_open) {
|
||||
}
|
||||
|
||||
void EditorCard::End() {
|
||||
// Check if window was focused this frame
|
||||
focused_ = ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows);
|
||||
|
||||
ImGui::End();
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
|
||||
void EditorCard::Focus() {
|
||||
// Set window focus using ImGui's focus system
|
||||
ImGui::SetWindowFocus(window_name_.c_str());
|
||||
focused_ = true;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// EditorLayout Implementation
|
||||
// ============================================================================
|
||||
|
||||
@@ -132,15 +132,24 @@ class EditorCard {
|
||||
void SetMinimized(bool minimized) { minimized_ = minimized; }
|
||||
bool IsMinimized() const { return minimized_; }
|
||||
|
||||
// Focus the card window (bring to front and set focused)
|
||||
void Focus();
|
||||
bool IsFocused() const { return focused_; }
|
||||
|
||||
// Get the window name for ImGui operations
|
||||
const char* GetWindowName() const { return window_name_.c_str(); }
|
||||
|
||||
private:
|
||||
std::string title_;
|
||||
std::string icon_;
|
||||
std::string window_name_; // Full window name with icon
|
||||
ImVec2 default_size_;
|
||||
Position position_ = Position::Free;
|
||||
bool minimizable_ = true;
|
||||
bool closable_ = true;
|
||||
bool minimized_ = false;
|
||||
bool first_draw_ = true;
|
||||
bool focused_ = false;
|
||||
bool* p_open_ = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -133,6 +133,12 @@ struct EnhancedTheme {
|
||||
Color editor_grid; // Grid lines in editors
|
||||
Color editor_cursor; // Cursor/selection in editors
|
||||
Color editor_selection; // Selected area in editors
|
||||
|
||||
Color entrance_color;
|
||||
Color hole_color;
|
||||
Color exit_color;
|
||||
Color item_color;
|
||||
Color sprite_color;
|
||||
|
||||
// Style parameters
|
||||
float window_rounding = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user