primer listado preliminar de directorio
This commit is contained in:
parent
070bec98b7
commit
4585771168
1 changed files with 39 additions and 36 deletions
71
main.cpp
71
main.cpp
|
|
@ -5,13 +5,9 @@
|
||||||
|
|
||||||
#define IMGUI_IMPLEMENTATION
|
#define IMGUI_IMPLEMENTATION
|
||||||
#define GL_SILENCE_DEPRECATION
|
#define GL_SILENCE_DEPRECATION
|
||||||
/*#if defined(IMGUI_IMPL_OPENGL_ES2)
|
|
||||||
#include <GLES2/gl2.h>
|
|
||||||
#endif
|
|
||||||
#include <GLFW/glfw3.h>*/ // Will drag system OpenGL headers
|
|
||||||
#include "imgui/misc/single_file/imgui_single_file.h"
|
#include "imgui/misc/single_file/imgui_single_file.h"
|
||||||
#include <stdio.h>
|
#include <iostream>
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
|
// [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.
|
// 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::Begin("File Picker in 4K");
|
||||||
ImGui::Text("Puta");
|
|
||||||
|
|
||||||
const char* items[] = { "Arriba", "España" };
|
//TODO Win32
|
||||||
static int item_current_idx = 0; // Here we store our selection data as an index.
|
HANDLE hFind = INVALID_HANDLE_VALUE;
|
||||||
|
WIN32_FIND_DATA ffd;
|
||||||
|
LARGE_INTEGER filesize;
|
||||||
|
static char* debug32;
|
||||||
|
//
|
||||||
|
static int currentItemIdx = 0;
|
||||||
ImGui::Text("Select a file:");
|
ImGui::Text("Select a file:");
|
||||||
/**/
|
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) + "<DIR>";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginListBox("NAME", ImVec2(FLT_MIN, 5.0f))){
|
//const bool isSelected = (currentItemIdx == n);
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
//if (ImGui::Selectable(items[n], is_selected))
|
||||||
{
|
// item_current_idx = 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;
|
|
||||||
|
|
||||||
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
||||||
if (is_selected)
|
//if (is_selected)
|
||||||
ImGui::SetItemDefaultFocus();
|
// ImGui::SetItemDefaultFocus();
|
||||||
|
|
||||||
|
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
||||||
|
//if (is_selected) ImGui::SetItemDefaultFocus();
|
||||||
|
}
|
||||||
|
FindClose(hFind);
|
||||||
|
|
||||||
|
ImGui::EndListBox();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
//TODO borrar
|
ImGui::Text("cagaste");
|
||||||
//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();
|
|
||||||
}
|
}
|
||||||
//ImGui::TreePop();
|
//ImGui::TreePop();
|
||||||
|
|
||||||
/**/
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue