From 6d0f9244b842ad082f6f347e9634f0c3c5fa93d9 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 16 Feb 2018 23:54:57 +0100 Subject: [PATCH] Examples: Allegro5, Marmalade: Moved bindings to parent folder. Renamed Allegro stuff from *A5_ to *Allegro5_ --- examples/allegro5_example/main.cpp | 16 +++++++------- ...ui_impl_a5.cpp => imgui_impl_allegro5.cpp} | 22 +++++++++---------- .../imgui_impl_a5.h => imgui_impl_allegro5.h} | 14 ++++++------ .../imgui_impl_marmalade.cpp | 0 .../imgui_impl_marmalade.h | 0 examples/marmalade_example/main.cpp | 2 +- .../marmalade_example/marmalade_example.mkb | 6 ++--- 7 files changed, 30 insertions(+), 30 deletions(-) rename examples/{allegro5_example/imgui_impl_a5.cpp => imgui_impl_allegro5.cpp} (95%) rename examples/{allegro5_example/imgui_impl_a5.h => imgui_impl_allegro5.h} (65%) rename examples/{marmalade_example => }/imgui_impl_marmalade.cpp (100%) rename examples/{marmalade_example => }/imgui_impl_marmalade.h (100%) diff --git a/examples/allegro5_example/main.cpp b/examples/allegro5_example/main.cpp index 1478573c..4a534610 100644 --- a/examples/allegro5_example/main.cpp +++ b/examples/allegro5_example/main.cpp @@ -5,7 +5,7 @@ #include #include #include "imgui.h" -#include "imgui_impl_a5.h" +#include "../imgui_impl_allegro5.h" int main(int, char**) { @@ -25,7 +25,7 @@ int main(int, char**) // Setup ImGui binding ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; - ImGui_ImplA5_Init(display); + ImGui_ImplAllegro5_Init(display); //io.NavFlags |= ImGuiNavFlags_EnableKeyboard; // Enable Keyboard Controls // Setup style @@ -62,17 +62,17 @@ int main(int, char**) ALLEGRO_EVENT ev; while (al_get_next_event(queue, &ev)) { - ImGui_ImplA5_ProcessEvent(&ev); + ImGui_ImplAllegro5_ProcessEvent(&ev); if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) running = false; if (ev.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { - ImGui_ImplA5_InvalidateDeviceObjects(); + ImGui_ImplAllegro5_InvalidateDeviceObjects(); al_acknowledge_resize(display); - Imgui_ImplA5_CreateDeviceObjects(); + ImGui_ImplAllegro5_CreateDeviceObjects(); } } - ImGui_ImplA5_NewFrame(); + ImGui_ImplAllegro5_NewFrame(); // 1. Show a simple window. // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". @@ -114,12 +114,12 @@ int main(int, char**) // Rendering al_clear_to_color(al_map_rgba_f(clear_color.x, clear_color.y, clear_color.z, clear_color.w)); ImGui::Render(); - ImGui_ImplA5_RenderDrawData(ImGui::GetDrawData()); + ImGui_ImplAllegro5_RenderDrawData(ImGui::GetDrawData()); al_flip_display(); } // Cleanup - ImGui_ImplA5_Shutdown(); + ImGui_ImplAllegro5_Shutdown(); ImGui::DestroyContext(); al_destroy_event_queue(queue); al_destroy_display(display); diff --git a/examples/allegro5_example/imgui_impl_a5.cpp b/examples/imgui_impl_allegro5.cpp similarity index 95% rename from examples/allegro5_example/imgui_impl_a5.cpp rename to examples/imgui_impl_allegro5.cpp index 127bf196..228ae0cb 100644 --- a/examples/allegro5_example/imgui_impl_a5.cpp +++ b/examples/imgui_impl_allegro5.cpp @@ -12,14 +12,14 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) -// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplA5_RenderDrawData() in the .h file so you can call it yourself. +// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplAllegro5_RenderDrawData() in the .h file so you can call it yourself. // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves. // 2018-02-06: Inputs: Added mapping for ImGuiKey_Space. #include // uint64_t #include // memcpy #include "imgui.h" -#include "imgui_impl_a5.h" +#include "imgui_impl_allegro5.h" #include #include @@ -43,7 +43,7 @@ struct ImDrawVertAllegro // Render function. // (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop) -void ImGui_ImplA5_RenderDrawData(ImDrawData* draw_data) +void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data) { int op, src, dst; al_get_blender(&op, &src, &dst); @@ -97,7 +97,7 @@ void ImGui_ImplA5_RenderDrawData(ImDrawData* draw_data) al_set_clipping_rectangle(0, 0, al_get_display_width(g_Display), al_get_display_height(g_Display)); } -bool Imgui_ImplA5_CreateDeviceObjects() +bool ImGui_ImplAllegro5_CreateDeviceObjects() { // Build texture atlas ImGuiIO &io = ImGui::GetIO(); @@ -144,7 +144,7 @@ bool Imgui_ImplA5_CreateDeviceObjects() return true; } -void ImGui_ImplA5_InvalidateDeviceObjects() +void ImGui_ImplAllegro5_InvalidateDeviceObjects() { if (g_Texture) { @@ -159,7 +159,7 @@ void ImGui_ImplA5_InvalidateDeviceObjects() } } -bool ImGui_ImplA5_Init(ALLEGRO_DISPLAY* display) +bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display) { g_Display = display; @@ -205,16 +205,16 @@ bool ImGui_ImplA5_Init(ALLEGRO_DISPLAY* display) return true; } -void ImGui_ImplA5_Shutdown() +void ImGui_ImplAllegro5_Shutdown() { - ImGui_ImplA5_InvalidateDeviceObjects(); + ImGui_ImplAllegro5_InvalidateDeviceObjects(); } // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. -bool ImGui_ImplA5_ProcessEvent(ALLEGRO_EVENT *ev) +bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT *ev) { ImGuiIO &io = ImGui::GetIO(); @@ -238,10 +238,10 @@ bool ImGui_ImplA5_ProcessEvent(ALLEGRO_EVENT *ev) return false; } -void ImGui_ImplA5_NewFrame() +void ImGui_ImplAllegro5_NewFrame() { if (!g_Texture) - Imgui_ImplA5_CreateDeviceObjects(); + ImGui_ImplAllegro5_CreateDeviceObjects(); ImGuiIO &io = ImGui::GetIO(); diff --git a/examples/allegro5_example/imgui_impl_a5.h b/examples/imgui_impl_allegro5.h similarity index 65% rename from examples/allegro5_example/imgui_impl_a5.h rename to examples/imgui_impl_allegro5.h index ccc3ac45..4b75dffa 100644 --- a/examples/allegro5_example/imgui_impl_a5.h +++ b/examples/imgui_impl_allegro5.h @@ -15,12 +15,12 @@ struct ALLEGRO_DISPLAY; union ALLEGRO_EVENT; -IMGUI_API bool ImGui_ImplA5_Init(ALLEGRO_DISPLAY* display); -IMGUI_API void ImGui_ImplA5_Shutdown(); -IMGUI_API void ImGui_ImplA5_NewFrame(); -IMGUI_API void ImGui_ImplA5_RenderDrawData(ImDrawData* draw_data); -IMGUI_API bool ImGui_ImplA5_ProcessEvent(ALLEGRO_EVENT* event); +IMGUI_API bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display); +IMGUI_API void ImGui_ImplAllegro5_Shutdown(); +IMGUI_API void ImGui_ImplAllegro5_NewFrame(); +IMGUI_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data); +IMGUI_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event); // Use if you want to reset your rendering device without losing ImGui state. -IMGUI_API bool Imgui_ImplA5_CreateDeviceObjects(); -IMGUI_API void ImGui_ImplA5_InvalidateDeviceObjects(); +IMGUI_API bool ImGui_ImplAllegro5_CreateDeviceObjects(); +IMGUI_API void ImGui_ImplAllegro5_InvalidateDeviceObjects(); diff --git a/examples/marmalade_example/imgui_impl_marmalade.cpp b/examples/imgui_impl_marmalade.cpp similarity index 100% rename from examples/marmalade_example/imgui_impl_marmalade.cpp rename to examples/imgui_impl_marmalade.cpp diff --git a/examples/marmalade_example/imgui_impl_marmalade.h b/examples/imgui_impl_marmalade.h similarity index 100% rename from examples/marmalade_example/imgui_impl_marmalade.h rename to examples/imgui_impl_marmalade.h diff --git a/examples/marmalade_example/main.cpp b/examples/marmalade_example/main.cpp index f2ddae40..08f8b1d5 100644 --- a/examples/marmalade_example/main.cpp +++ b/examples/marmalade_example/main.cpp @@ -5,7 +5,7 @@ // This file is part of ImGui #include "imgui.h" -#include "imgui_impl_marmalade.h" +#include "../imgui_impl_marmalade.h" #include #include diff --git a/examples/marmalade_example/marmalade_example.mkb b/examples/marmalade_example/marmalade_example.mkb index 9f8ea44a..11b0392f 100644 --- a/examples/marmalade_example/marmalade_example.mkb +++ b/examples/marmalade_example/marmalade_example.mkb @@ -34,11 +34,11 @@ files ../../imgui_draw.cpp ../../imconfig.h ../../imgui.h - ../../imgui_internal.h + ../../imgui_internal.h ["imgui","Marmalade binding"] - imgui_impl_marmalade.h - imgui_impl_marmalade.cpp + ../imgui_impl_marmalade.h + ../imgui_impl_marmalade.cpp main.cpp }