mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Examples: Allegro5, Marmalade: Moved bindings to parent folder. Renamed Allegro stuff from *A5_ to *Allegro5_
This commit is contained in:
parent
80a8aea7e3
commit
6d0f9244b8
@ -5,7 +5,7 @@
|
||||
#include <allegro5/allegro.h>
|
||||
#include <allegro5/allegro_primitives.h>
|
||||
#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);
|
||||
|
@ -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 <stdint.h> // uint64_t
|
||||
#include <cstring> // memcpy
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_a5.h"
|
||||
#include "imgui_impl_allegro5.h"
|
||||
#include <allegro5/allegro.h>
|
||||
#include <allegro5/allegro_primitives.h>
|
||||
|
||||
@ -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();
|
||||
|
@ -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();
|
@ -5,7 +5,7 @@
|
||||
// This file is part of ImGui
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_marmalade.h"
|
||||
#include "../imgui_impl_marmalade.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include <s3eKeyboard.h>
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user