mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 04:28:47 +02:00
Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display..(#1599)
Examples: Updated examples.
This commit is contained in:
@ -10,6 +10,12 @@
|
||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||
// https://github.com/ocornut/imgui, Original code by @birthggd
|
||||
|
||||
// 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-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 <stdint.h> // uint64_t
|
||||
#include <cstring> // memcpy
|
||||
#include "imgui.h"
|
||||
@ -35,7 +41,9 @@ struct ImDrawVertAllegro
|
||||
ALLEGRO_COLOR col;
|
||||
};
|
||||
|
||||
void ImGui_ImplA5_RenderDrawLists(ImDrawData* draw_data)
|
||||
// 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)
|
||||
{
|
||||
int op, src, dst;
|
||||
al_get_blender(&op, &src, &dst);
|
||||
@ -190,7 +198,6 @@ bool ImGui_ImplA5_Init(ALLEGRO_DISPLAY* display)
|
||||
io.KeyMap[ImGuiKey_Y] = ALLEGRO_KEY_Y;
|
||||
io.KeyMap[ImGuiKey_Z] = ALLEGRO_KEY_Z;
|
||||
|
||||
io.RenderDrawListsFn = ImGui_ImplA5_RenderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
|
||||
#ifdef _WIN32
|
||||
io.ImeWindowHandle = al_get_win_window_handle(g_Display);
|
||||
#endif
|
||||
|
@ -18,6 +18,7 @@ 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);
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
|
@ -114,6 +114,7 @@ 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());
|
||||
al_flip_display();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user