|
|
|
@ -15,6 +15,7 @@
|
|
|
|
|
|
|
|
|
|
// CHANGELOG
|
|
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
|
|
// 2018-11-30: Platform: Added touchscreen support.
|
|
|
|
|
// 2018-11-30: Misc: Setting up io.BackendPlatformName/io.BackendRendererName so they can be displayed in the About Window.
|
|
|
|
|
// 2018-06-13: Platform: Added clipboard support (from Allegro 5.1.12).
|
|
|
|
|
// 2018-06-13: Renderer: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
|
|
|
@ -268,6 +269,7 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
|
|
|
|
|
io.KeyMap[ImGuiKey_X] = ALLEGRO_KEY_X;
|
|
|
|
|
io.KeyMap[ImGuiKey_Y] = ALLEGRO_KEY_Y;
|
|
|
|
|
io.KeyMap[ImGuiKey_Z] = ALLEGRO_KEY_Z;
|
|
|
|
|
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
|
|
|
|
|
|
|
|
|
#if ALLEGRO_HAS_CLIPBOARD
|
|
|
|
|
io.SetClipboardTextFn = ImGui_ImplAllegro5_SetClipboardText;
|
|
|
|
@ -305,8 +307,31 @@ bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT *ev)
|
|
|
|
|
switch (ev->type)
|
|
|
|
|
{
|
|
|
|
|
case ALLEGRO_EVENT_MOUSE_AXES:
|
|
|
|
|
if (ev->mouse.display == g_Display)
|
|
|
|
|
{
|
|
|
|
|
io.MouseWheel += ev->mouse.dz;
|
|
|
|
|
io.MouseWheelH += ev->mouse.dw;
|
|
|
|
|
io.MousePos = ImVec2(ev->mouse.x, ev->mouse.y);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN:
|
|
|
|
|
case ALLEGRO_EVENT_MOUSE_BUTTON_UP:
|
|
|
|
|
if (ev->mouse.display == g_Display && ev->mouse.button <= 5)
|
|
|
|
|
io.MouseDown[ev->mouse.button - 1] = (ev->type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN);
|
|
|
|
|
return true;
|
|
|
|
|
case ALLEGRO_EVENT_TOUCH_MOVE:
|
|
|
|
|
if (ev->touch.display == g_Display)
|
|
|
|
|
io.MousePos = ImVec2(ev->touch.x, ev->touch.y);
|
|
|
|
|
return true;
|
|
|
|
|
case ALLEGRO_EVENT_TOUCH_BEGIN:
|
|
|
|
|
case ALLEGRO_EVENT_TOUCH_END:
|
|
|
|
|
case ALLEGRO_EVENT_TOUCH_CANCEL:
|
|
|
|
|
if (ev->touch.display == g_Display && ev->touch.primary)
|
|
|
|
|
io.MouseDown[0] = (ev->type == ALLEGRO_EVENT_TOUCH_BEGIN);
|
|
|
|
|
return true;
|
|
|
|
|
case ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY:
|
|
|
|
|
if (ev->mouse.display == g_Display)
|
|
|
|
|
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
|
|
|
|
return true;
|
|
|
|
|
case ALLEGRO_EVENT_KEY_CHAR:
|
|
|
|
|
if (ev->keyboard.display == g_Display)
|
|
|
|
@ -376,21 +401,5 @@ void ImGui_ImplAllegro5_NewFrame()
|
|
|
|
|
io.KeyAlt = al_key_down(&keys, ALLEGRO_KEY_ALT) || al_key_down(&keys, ALLEGRO_KEY_ALTGR);
|
|
|
|
|
io.KeySuper = al_key_down(&keys, ALLEGRO_KEY_LWIN) || al_key_down(&keys, ALLEGRO_KEY_RWIN);
|
|
|
|
|
|
|
|
|
|
ALLEGRO_MOUSE_STATE mouse;
|
|
|
|
|
if (keys.display == g_Display)
|
|
|
|
|
{
|
|
|
|
|
al_get_mouse_state(&mouse);
|
|
|
|
|
io.MousePos = ImVec2((float)mouse.x, (float)mouse.y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
al_get_mouse_state(&mouse);
|
|
|
|
|
io.MouseDown[0] = mouse.buttons & (1 << 0);
|
|
|
|
|
io.MouseDown[1] = mouse.buttons & (1 << 1);
|
|
|
|
|
io.MouseDown[2] = mouse.buttons & (1 << 2);
|
|
|
|
|
|
|
|
|
|
ImGui_ImplAllegro5_UpdateMouseCursor();
|
|
|
|
|
}
|
|
|
|
|