Skip to content

Commit

Permalink
Fix examples for latest ImGui
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Feb 19, 2024
1 parent 731ed25 commit 92263fe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions example/color_node_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <imnodes.h>
#include <imgui.h>

#include <SDL2/SDL_keycode.h>
#include <SDL2/SDL_timer.h>
#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -207,7 +206,7 @@ class ColorNodeEditor
{
const bool open_popup = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) &&
ImNodes::IsEditorHovered() &&
ImGui::IsKeyReleased(SDL_SCANCODE_A);
ImGui::IsKeyReleased(ImGuiKey_A);

ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
if (!ImGui::IsAnyItemHovered() && open_popup)
Expand Down Expand Up @@ -588,7 +587,7 @@ class ColorNodeEditor

{
const int num_selected = ImNodes::NumSelectedLinks();
if (num_selected > 0 && ImGui::IsKeyReleased(SDL_SCANCODE_X))
if (num_selected > 0 && ImGui::IsKeyReleased(ImGuiKey_X))
{
static std::vector<int> selected_links;
selected_links.resize(static_cast<size_t>(num_selected));
Expand All @@ -602,7 +601,7 @@ class ColorNodeEditor

{
const int num_selected = ImNodes::NumSelectedNodes();
if (num_selected > 0 && ImGui::IsKeyReleased(SDL_SCANCODE_X))
if (num_selected > 0 && ImGui::IsKeyReleased(ImGuiKey_X))
{
static std::vector<int> selected_nodes;
selected_nodes.resize(static_cast<size_t>(num_selected));
Expand Down
2 changes: 1 addition & 1 deletion example/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "node_editor.h"

#include <imgui.h>
#include <imgui_impl_sdl.h>
#include <imgui_impl_sdl2.h>
#include <imgui_impl_opengl3.h>
#include <imnodes.h>
#include <SDL2/SDL.h>
Expand Down
2 changes: 1 addition & 1 deletion example/multi_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void show_editor(const char* editor_name, Editor& editor)
ImNodes::BeginNodeEditor();

if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) &&
ImNodes::IsEditorHovered() && ImGui::IsKeyReleased(SDL_SCANCODE_A))
ImNodes::IsEditorHovered() && ImGui::IsKeyReleased(ImGuiKey_A))
{
const int node_id = ++editor.current_id;
ImNodes::SetNodeScreenSpacePos(node_id, ImGui::GetMousePos());
Expand Down
2 changes: 1 addition & 1 deletion example/save_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SaveLoadEditor
ImNodes::BeginNodeEditor();

if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) &&
ImNodes::IsEditorHovered() && ImGui::IsKeyReleased(SDL_SCANCODE_A))
ImNodes::IsEditorHovered() && ImGui::IsKeyReleased(ImGuiKey_A))
{
const int node_id = ++current_id_;
ImNodes::SetNodeScreenSpacePos(node_id, ImGui::GetMousePos());
Expand Down

0 comments on commit 92263fe

Please sign in to comment.