Debug verbosity, modified README
This commit is contained in:
parent
809a5abcd5
commit
46996d68ef
3 changed files with 200 additions and 121 deletions
|
|
@ -1,5 +1,4 @@
|
|||
//Demo executable based on GLFW
|
||||
|
||||
#define IMGUI_IMPLEMENTATION
|
||||
#define GL_SILENCE_DEPRECATION
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ int main(int, char**) {
|
|||
#endif
|
||||
|
||||
// Create window with graphics context
|
||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL3 example", NULL, NULL);
|
||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "File Picker Demo", NULL, NULL);
|
||||
if (window == NULL)
|
||||
return 1;
|
||||
glfwMakeContextCurrent(window);
|
||||
|
|
@ -58,11 +57,20 @@ int main(int, char**) {
|
|||
// Setup Platform/Renderer backends
|
||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||
|
||||
// Our state
|
||||
bool show_demo_window = true;
|
||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||
|
||||
//
|
||||
bool debugDirectory = true;
|
||||
bool debugVolume = true;
|
||||
bool debugExtension = true;
|
||||
bool debugLogic = true;
|
||||
|
||||
// Our state
|
||||
char path[MAX_PATH * 4] = "";// = malloc(MAX_PATH * sizeof(char));
|
||||
int debugVerbosity = fp::DebugVerbosity::DIRECTORY | fp::DebugVerbosity::VOLUME | fp::DebugVerbosity::EXTENSION | fp::DebugVerbosity::LOGIC;
|
||||
bool windowOpen = true;
|
||||
bool memoryFreed = true;
|
||||
|
||||
// Main loop
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
// Poll and handle events (inputs, window resize, etc.)
|
||||
|
|
@ -75,13 +83,41 @@ int main(int, char**) {
|
|||
ImGui::NewFrame();
|
||||
|
||||
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||
static wchar_t path[MAX_PATH];// = malloc(MAX_PATH * sizeof(char));
|
||||
static bool windowOpen = true;
|
||||
|
||||
fp::setDebugInfo(debugVerbosity);
|
||||
if(windowOpen)
|
||||
fp::renderFilePicker(&path[0], &windowOpen, 0);
|
||||
fp::renderFilePicker(&path[0], &windowOpen, &memoryFreed, 0);
|
||||
else if(!memoryFreed)
|
||||
fp::freeResources(&memoryFreed);
|
||||
|
||||
if (show_demo_window)
|
||||
ImGui::ShowDemoWindow(&show_demo_window);
|
||||
//if (show_demo_window)
|
||||
ImGui::SetNextWindowSize(ImVec2(500.0f, 500.0f));
|
||||
ImGui::Begin("Values", NULL, 0);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PopStyleVar(1);
|
||||
ImGui::Text(path);
|
||||
// debugVerbosity = DEBUG_DIRECTORY | DEBUG_EXTENSION;
|
||||
// debugVerbosity &= ~DEBUG_DIRECTORY;
|
||||
// if (debugVerbosity & (DEBUG_DIRECTORY | DEBUG_EXTENSION));
|
||||
ImGui::Text("Debug verbosity");
|
||||
ImGui::Checkbox("Directory" , &debugDirectory);
|
||||
ImGui::Checkbox("Volume" , &debugVolume );
|
||||
ImGui::Checkbox("Extension" , &debugExtension);
|
||||
ImGui::Checkbox("Logic" , &debugLogic );
|
||||
debugVerbosity = (debugDirectory) ? debugVerbosity | fp::DIRECTORY : debugVerbosity& ~fp::DIRECTORY;
|
||||
debugVerbosity = (debugVolume) ? debugVerbosity | fp::VOLUME : debugVerbosity& ~fp::VOLUME;
|
||||
debugVerbosity = (debugExtension) ? debugVerbosity | fp::EXTENSION : debugVerbosity& ~fp::EXTENSION;
|
||||
debugVerbosity = (debugLogic) ? debugVerbosity | fp::LOGIC : debugVerbosity& ~fp::LOGIC;
|
||||
|
||||
//fp::DebugVerbosity::DIRECTORY | fp::DebugVerbosity::VOLUME | fp::DebugVerbosity::EXTENSION | fp::DebugVerbosity::LOGIC;
|
||||
if (!windowOpen)
|
||||
if(ImGui::Button("Open file picker")) {
|
||||
windowOpen = !windowOpen;
|
||||
}
|
||||
//ImGui::Text(std::to_string(state).c_str());
|
||||
//ImGui::Text(state);
|
||||
ImGui::End();
|
||||
//ImGui::ShowDemoWindow(&show_demo_window);
|
||||
|
||||
// Rendering
|
||||
ImGui::Render();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue