diff --git a/main.cpp b/main.cpp index bec1313..8ed8b64 100644 --- a/main.cpp +++ b/main.cpp @@ -5,13 +5,9 @@ #define IMGUI_IMPLEMENTATION #define GL_SILENCE_DEPRECATION -/*#if defined(IMGUI_IMPL_OPENGL_ES2) -#include -#endif -#include */ // Will drag system OpenGL headers #include "imgui/misc/single_file/imgui_single_file.h" -#include - +#include +#include // [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers. // To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma. @@ -142,42 +138,49 @@ int main(int, char**) { ImGui::Begin("File Picker in 4K"); - ImGui::Text("Puta"); - const char* items[] = { "Arriba", "EspaƱa" }; - static int item_current_idx = 0; // Here we store our selection data as an index. + //TODO Win32 + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + LARGE_INTEGER filesize; + static char* debug32; + // + static int currentItemIdx = 0; ImGui::Text("Select a file:"); - /**/ - - if (ImGui::BeginListBox("NAME", ImVec2(FLT_MIN, 5.0f))){ - for (int n = 0; n < IM_ARRAYSIZE(items); n++) - { - //Selectable es popular con ese elemento - const bool is_selected = (item_current_idx == n); - if (ImGui::Selectable(items[n], is_selected)) - item_current_idx = n; + hFind = FindFirstFile("C:\\Users\\Fabio\\Downloads\\Street Fighter 6 - Closed Beta\\*", &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + if (ImGui::BeginListBox("fpLb", ImVec2(FLT_MIN, 25 * ImGui::GetTextLineHeightWithSpacing()))){ + for (int n = 0; FindNextFile(hFind, &ffd) != 0; n++) { + static std::string seleciable; + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + seleciable = " " + std::string(ffd.cFileName) + ""; + ImGui::Selectable(seleciable.c_str(), false); + } else { + filesize.QuadPart = (long long)(ffd.nFileSizeHigh * (MAXDWORD+1)) + ffd.nFileSizeLow; + seleciable = " " + std::string(ffd.cFileName) + " " + std::to_string(filesize.QuadPart); + ImGui::Selectable(seleciable.c_str(), false); + } + + //const bool isSelected = (currentItemIdx == n); + //if (ImGui::Selectable(items[n], is_selected)) + // item_current_idx = n; - // Set the initial focus when opening the combo (scrolling + keyboard navigation focus) - if (is_selected) - ImGui::SetItemDefaultFocus(); + // Set the initial focus when opening the combo (scrolling + keyboard navigation focus) + //if (is_selected) + // ImGui::SetItemDefaultFocus(); + + // Set the initial focus when opening the combo (scrolling + keyboard navigation focus) + //if (is_selected) ImGui::SetItemDefaultFocus(); + } + FindClose(hFind); + + ImGui::EndListBox(); } - - //TODO borrar - //Selectable es popular con ese elemento*/ - /**/ const bool is_selected = (item_current_idx == IM_ARRAYSIZE(items)); - if (ImGui::Selectable("Conio", is_selected)) - item_current_idx = IM_ARRAYSIZE(items); - - // Set the initial focus when opening the combo (scrolling + keyboard navigation focus) - if (is_selected) - ImGui::SetItemDefaultFocus(); - /**/ - - ImGui::EndListBox(); + } else { + ImGui::Text("cagaste"); } //ImGui::TreePop(); - /**/ ImGui::End(); }