@@ -34,43 +34,50 @@ namespace Tetragrama::Components
34
34
35
35
ImGui::Begin (Name.c_str (), (CanBeClosed ? &CanBeClosed : NULL ), ImGuiWindowFlags_NoCollapse);
36
36
37
- ImGui::BeginChild (" Left Pane" , ImVec2 (ImGui::GetContentRegionAvail ().x * 0 .15f , 0 ), true );
38
- RenderTreeBrowser ();
39
- ImGui::EndChild ();
37
+ ImGui::PushStyleVar (ImGuiStyleVar_FramePadding, ImVec2 (2 , 2 ));
38
+ ImVec2 current_win_size = ImGui::GetContentRegionAvail ();
39
+ if (ImGui::BeginTable (" #AssetBrowserArea" , 2 , ImGuiTableFlags_Resizable, current_win_size))
40
+ {
41
+ /* Left Pane*/
42
+ ImGui::TableNextRow ();
43
+ ImGui::TableSetColumnIndex (0 );
44
+ RenderTreeBrowser ();
45
+
46
+ /* Right Pane*/
47
+ ImGui::TableSetColumnIndex (1 );
48
+ if (ImGui::IsWindowHovered () && ImGui::IsMouseClicked (ImGuiMouseButton_Right))
49
+ {
50
+ ImGui::OpenPopup (" ContextMenu" );
51
+ }
52
+ if (ImGui::BeginPopup (" ContextMenu" ))
53
+ {
54
+ RenderContextMenu (ContextMenuType::RightPane, m_current_directory);
55
+ ImGui::EndPopup ();
56
+ }
57
+ RenderPopUpMenu ();
40
58
41
- ImGui::SameLine ();
42
- ImGui::GetWindowDrawList ()->AddLine (ImGui::GetCursorScreenPos (), ImVec2 (ImGui::GetCursorScreenPos ().x , ImGui::GetCursorScreenPos ().y + ImGui::GetContentRegionAvail ().y ), ImGui::GetColorU32 (ImGuiCol_Separator), 0 .5f );
59
+ RenderBackButton ();
60
+ ImGui::SameLine ();
61
+ ImGui::InputTextWithHint (" ##Search" , " Search ..." , m_search_buffer, IM_ARRAYSIZE (m_search_buffer));
62
+ ImGui::SameLine ();
43
63
44
- ImGui::BeginChild ( " Right Pane " , ImVec2 ( 0 , 0 ), true );
45
- if ( ImGui::IsWindowHovered () && ImGui::IsMouseClicked (ImGuiMouseButton_Right))
46
- {
47
- ImGui::OpenPopup ( " ContextMenu " );
48
- }
49
- if ( ImGui::BeginPopup ( " ContextMenu " ))
50
- {
51
- RenderContextMenu (ContextMenuType::RightPane, m_current_directory);
52
- ImGui::EndPopup ();
64
+ ImGui::PushFont ( ImGui::GetIO (). Fonts -> Fonts [ 0 ] );
65
+ auto relative_path = MakeRelative (m_current_directory, m_assets_directory. parent_path ());
66
+ ImGui::Text (relative_path. string (). c_str ());
67
+ ImGui::PopFont ( );
68
+ ImGui::Separator ();
69
+
70
+ RenderContentBrowser (renderer);
71
+
72
+ ImGui::EndTable ();
53
73
}
54
- RenderPopUpMenu ();
55
- RenderContentBrowser (renderer);
56
- ImGui::EndChild ();
74
+ ImGui::PopStyleVar ();
57
75
58
76
ImGui::End ();
59
77
}
60
78
61
79
void ProjectViewUIComponent::RenderContentBrowser (ZEngine::Rendering::Renderers::GraphicRenderer* const renderer)
62
80
{
63
-
64
- RenderBackButton ();
65
- ImGui::SameLine ();
66
- ImGui::InputTextWithHint (" ##Search" , " Search ..." , m_search_buffer, IM_ARRAYSIZE (m_search_buffer));
67
- ImGui::SameLine ();
68
- ImGui::PushFont (ImGui::GetIO ().Fonts ->Fonts [0 ]);
69
- auto relative_path = MakeRelative (m_current_directory, m_assets_directory.parent_path ());
70
- ImGui::Text (relative_path.string ().c_str ());
71
- ImGui::PopFont ();
72
- ImGui::Separator ();
73
-
74
81
const float padding = 16 .0f ;
75
82
const float cellSize = m_thumbnail_size + padding;
76
83
const float panelWidth = ImGui::GetContentRegionAvail ().x ;
@@ -110,7 +117,7 @@ namespace Tetragrama::Components
110
117
ImGui::SetCursorPos (ImVec2 (cursorPos.x + margin, cursorPos.y + margin));
111
118
112
119
ImGui::PushStyleColor (ImGuiCol_Button, ImVec4 (0 , 0 , 0 , 0 ));
113
- ImGui::ImageButton (icon, {m_thumbnail_size, m_thumbnail_size}, {0 , 1 }, {1 , 0 });
120
+ ImGui::ImageButton (" #image " , icon, {m_thumbnail_size, m_thumbnail_size}, {0 , 1 }, {1 , 0 });
114
121
ImGui::PopStyleColor ();
115
122
ImGui::SetCursorPos (ImVec2 (cursorPos.x , cursorPos.y + m_thumbnail_size + margin));
116
123
@@ -564,37 +571,25 @@ namespace Tetragrama::Components
564
571
565
572
void ProjectViewUIComponent::RenderBackButton ()
566
573
{
567
- ImGui::SameLine ();
568
- static constexpr float ButtonSize = 20 .0f ;
569
- static constexpr float TriangleSize = 8 .0f ;
570
- const ImU32 DefaultColor = IM_COL32 (150 , 150 , 150 , 255 );
571
- const ImU32 HoverColor = IM_COL32 (200 , 200 , 200 , 255 );
572
- const ImU32 DisabledColor = IM_COL32 (100 , 100 , 100 , 128 );
573
- ImDrawList* drawList = ImGui::GetWindowDrawList ();
574
- ImVec2 cursorPos = ImGui::GetCursorScreenPos ();
575
- // Calculate positions
576
- ImVec2 buttonSize (ButtonSize, ButtonSize);
577
- ImVec2 center = {cursorPos.x + ButtonSize / 2 , cursorPos.y + ButtonSize / 2 };
578
- // Calculate triangle vertices
579
- ImVec2 triangleLeft = {center.x - TriangleSize, center.y };
580
- ImVec2 triangleTopRight = {center.x + TriangleSize, center.y - TriangleSize};
581
- ImVec2 triangleBottomRight = {center.x + TriangleSize, center.y + TriangleSize};
582
- bool canGoBack = (m_current_directory != m_assets_directory);
583
- ImU32 triangleColor = DefaultColor;
574
+ bool canGoBack = (m_current_directory != m_assets_directory);
584
575
if (canGoBack)
585
576
{
586
- if (ImGui::Button (" ##BackButton " , buttonSize ))
577
+ if (ImGui::ArrowButton (" ##left " , ImGuiDir_Left ))
587
578
{
588
579
m_current_directory = m_current_directory.parent_path ();
589
580
}
590
- triangleColor = ImGui::IsItemHovered () ? HoverColor : DefaultColor;
591
581
}
592
582
else
593
583
{
594
- ImGui::Dummy (buttonSize);
595
- triangleColor = DisabledColor;
584
+ ImVec4 color = {0 .2f , 0 .2f , 0 .2f , .2f };
585
+ ImGui::PushStyleColor (ImGuiCol_Button, color); // Grayed out color
586
+ ImGui::PushStyleColor (ImGuiCol_ButtonHovered, color);
587
+ ImGui::PushStyleColor (ImGuiCol_ButtonActive, color);
588
+
589
+ ImGui::ArrowButton (" ##left" , ImGuiDir_Left);
590
+
591
+ ImGui::PopStyleColor (3 );
596
592
}
597
- drawList->AddTriangleFilled (triangleLeft, triangleTopRight, triangleBottomRight, triangleColor);
598
593
}
599
594
600
595
void ProjectViewUIComponent::RenderContextMenu (ContextMenuType type, const std::filesystem::path& targetPath)
0 commit comments