Skip to content

Commit

Permalink
Merge pull request #23 from RicoP/master
Browse files Browse the repository at this point in the history
Fixes compile bug for imgui v1.80
  • Loading branch information
gallickgunner authored Feb 8, 2021
2 parents f9f08b9 + eaf7d73 commit a0afdf5
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 59 deletions.
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ matrix:
script:
- |
clang++ imgui/examples/example_sdl_opengl3/main.cpp \
imgui/examples/imgui_impl_sdl.cpp \
imgui/examples/imgui_impl_opengl3.cpp \
imgui/imgui.cpp imgui/imgui_draw.cpp \
imgui/backends/imgui_impl_opengl3.cpp \
imgui/backends/imgui_impl_sdl.cpp \
imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_tables.cpp \
imgui/imgui_widgets.cpp FileBrowser/imgui_demo.cpp \
FileBrowser/ImGuiFileBrowser.cpp \
-DIMGUI_IMPL_OPENGL_LOADER_GLEW \
-I imgui \
-I imgui/examples \
-I imgui/backends \
-I /usr/local/include/SDL2 \
-lSDL2 -lGLEW \
-framework OpenGL \
Expand All @@ -34,14 +35,15 @@ matrix:
script:
- |
g++ imgui/examples/example_sdl_opengl3/main.cpp \
imgui/examples/imgui_impl_sdl.cpp \
imgui/examples/imgui_impl_opengl3.cpp \
imgui/imgui.cpp imgui/imgui_draw.cpp \
imgui/backends/imgui_impl_opengl3.cpp \
imgui/backends/imgui_impl_sdl.cpp \
imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_tables.cpp \
imgui/imgui_widgets.cpp FileBrowser/imgui_demo.cpp \
FileBrowser/ImGuiFileBrowser.cpp \
-DIMGUI_IMPL_OPENGL_LOADER_GLEW \
-I imgui \
-I imgui/examples \
-I imgui/backends \
-I /usr/include/SDL2 \
-lSDL2 -lGL -lGLEW \
-o example_sdl_opengl3
Expand All @@ -55,14 +57,15 @@ matrix:
script:
- |
clang++ imgui/examples/example_sdl_opengl3/main.cpp \
imgui/examples/imgui_impl_sdl.cpp \
imgui/examples/imgui_impl_opengl3.cpp \
imgui/imgui.cpp imgui/imgui_draw.cpp \
imgui/backends/imgui_impl_opengl3.cpp \
imgui/backends/imgui_impl_sdl.cpp \
imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_tables.cpp \
imgui/imgui_widgets.cpp FileBrowser/imgui_demo.cpp \
FileBrowser/ImGuiFileBrowser.cpp \
-DIMGUI_IMPL_OPENGL_LOADER_GLEW \
-I imgui \
-I imgui/examples \
-I imgui/backends \
-I /usr/include/SDL2 \
-lSDL2 -lGL -lGLEW \
-o example_sdl_opengl3
2 changes: 1 addition & 1 deletion FileBrowser/ImGuiFileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ namespace imgui_addons
input_combobox_sz.y = std::min((inputcb_filter_files.size() + 1) * frame_height + style.WindowPadding.y * 2.0f,
8 * ImGui::GetFrameHeight() + style.WindowPadding.y * 2.0f);

if(show_inputbar_combobox && ( ImGui::GetFocusScopeID() == focus_scope_id || ImGui::GetCurrentContext()->ActiveIdIsAlive == input_id ))
if(show_inputbar_combobox && ( ImGui::GetFocusedFocusScope() == focus_scope_id || ImGui::GetCurrentContext()->ActiveIdIsAlive == input_id ))
{
ImGuiWindowFlags popupFlags = ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoResize |
Expand Down
95 changes: 47 additions & 48 deletions FileBrowser/imgui_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ Index of this file:
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif

//For Custom widget
#include "ImGuiFileBrowser.h"

//For Custom widget
#include "ImGuiFileBrowser.h"

#include "imgui.h"
#ifndef IMGUI_DISABLE
Expand Down Expand Up @@ -205,18 +205,18 @@ static void ShowDemoWindowLayout();
static void ShowDemoWindowPopups();
static void ShowDemoWindowColumns();
static void ShowDemoWindowMisc();
static bool show_open_dialog = false;
static bool show_save_dialog = false;
static bool show_open_dialog = false;
static bool show_save_dialog = false;
static bool show_select_dialog = false;

// Demonstrate most Dear ImGui features (this is big function!)
// You may execute this function to experiment with the UI and understand what it does. You may then search for keywords in the code when you are interested by a specific feature.
void ImGui::ShowDemoWindow(bool* p_open)
{
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!"); // Exceptionally add an extra assert here for people confused with initial dear imgui setup

//For Demonstrating File Dialog Addon accessible from MainMenu bar (from Examples Menu) or simple Menu bar
static imgui_addons::ImGuiFileBrowser file_dialog;

//For Demonstrating File Dialog Addon accessible from MainMenu bar (from Examples Menu) or simple Menu bar
static imgui_addons::ImGuiFileBrowser file_dialog;

// Examples Apps (accessible from the "Examples" menu)
static bool show_app_documents = false;
Expand Down Expand Up @@ -324,43 +324,43 @@ void ImGui::ShowDemoWindow(bool* p_open)
ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor);
ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about);
ImGui::EndMenu();
}

if(show_open_dialog)
{
ImGui::OpenPopup("Open File");
show_open_dialog = false;
}
else if (show_save_dialog)
{
ImGui::OpenPopup("Save File");
show_save_dialog = false;
}
else if (show_select_dialog)
{
ImGui::OpenPopup("Select Directory##popup");
show_select_dialog = false;
}

//Show an open/save/select file dialog. Last argument provides a list of supported files. Selecting other files will show error. If "*.*" is provided, all files can be opened.
if(file_dialog.showFileDialog("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ImVec2(600, 300), ".h,.cpp,.c"))
{
printf("%s\n", file_dialog.selected_fn.c_str());
printf("%s\n", file_dialog.selected_path.c_str());
}

if(file_dialog.showFileDialog("Select Directory##popup", imgui_addons::ImGuiFileBrowser::DialogMode::SELECT, ImVec2(600, 300)))
{
printf("%s\n", file_dialog.selected_fn.c_str());
printf("%s\n", file_dialog.selected_path.c_str());
}

if(file_dialog.showFileDialog("Save File", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, ImVec2(600, 300), ".png,.jpg,.bmp"))
{
printf("%s\n", file_dialog.selected_fn.c_str());
printf("%s\n", file_dialog.ext.c_str());
printf("%s\n", file_dialog.selected_path.c_str());
}
}

if(show_open_dialog)
{
ImGui::OpenPopup("Open File");
show_open_dialog = false;
}
else if (show_save_dialog)
{
ImGui::OpenPopup("Save File");
show_save_dialog = false;
}
else if (show_select_dialog)
{
ImGui::OpenPopup("Select Directory##popup");
show_select_dialog = false;
}

//Show an open/save/select file dialog. Last argument provides a list of supported files. Selecting other files will show error. If "*.*" is provided, all files can be opened.
if(file_dialog.showFileDialog("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ImVec2(600, 300), ".h,.cpp,.c"))
{
printf("%s\n", file_dialog.selected_fn.c_str());
printf("%s\n", file_dialog.selected_path.c_str());
}

if(file_dialog.showFileDialog("Select Directory##popup", imgui_addons::ImGuiFileBrowser::DialogMode::SELECT, ImVec2(600, 300)))
{
printf("%s\n", file_dialog.selected_fn.c_str());
printf("%s\n", file_dialog.selected_path.c_str());
}

if(file_dialog.showFileDialog("Save File", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, ImVec2(600, 300), ".png,.jpg,.bmp"))
{
printf("%s\n", file_dialog.selected_fn.c_str());
printf("%s\n", file_dialog.ext.c_str());
printf("%s\n", file_dialog.selected_path.c_str());
}

ImGui::EndMenuBar();
}
Expand Down Expand Up @@ -3234,7 +3234,7 @@ void ImGui::ShowAboutWindow(bool* p_open)
if (io.ConfigInputTextCursorBlink) ImGui::Text("io.ConfigInputTextCursorBlink");
if (io.ConfigWindowsResizeFromEdges) ImGui::Text("io.ConfigWindowsResizeFromEdges");
if (io.ConfigWindowsMoveFromTitleBarOnly) ImGui::Text("io.ConfigWindowsMoveFromTitleBarOnly");
if (io.ConfigWindowsMemoryCompactTimer >= 0.0f) ImGui::Text("io.ConfigWindowsMemoryCompactTimer = %.1ff", io.ConfigWindowsMemoryCompactTimer);
if (io.ConfigMemoryCompactTimer >= 0.0f) ImGui::Text("io.ConfigMemoryCompactTimer = %.1ff", io.ConfigMemoryCompactTimer);
ImGui::Text("io.BackendFlags: 0x%08X", io.BackendFlags);
if (io.BackendFlags & ImGuiBackendFlags_HasGamepad) ImGui::Text(" HasGamepad");
if (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) ImGui::Text(" HasMouseCursors");
Expand Down Expand Up @@ -3472,7 +3472,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui::PopFont();
ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font
ImGui::SameLine(); HelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, "%.0f");
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
ImGui::Text("Fallback character: '%c' (U+%04X)", font->FallbackChar, font->FallbackChar);
ImGui::Text("Ellipsis character: '%c' (U+%04X)", font->EllipsisChar, font->EllipsisChar);
Expand Down Expand Up @@ -3602,7 +3601,7 @@ static void ShowExampleMenuFile()
{
ImGui::MenuItem("(dummy menu)", NULL, false, false);
if (ImGui::MenuItem("New")) {}
if (ImGui::MenuItem("Open", "Ctrl+O")) { show_open_dialog = true; }
if (ImGui::MenuItem("Open", "Ctrl+O")) { show_open_dialog = true; }
if (ImGui::MenuItem("Select Directory")) { show_select_dialog = true; }
if (ImGui::BeginMenu("Open Recent"))
{
Expand Down
2 changes: 1 addition & 1 deletion imgui
Submodule imgui updated 151 files

0 comments on commit a0afdf5

Please sign in to comment.