mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-19 12:55:34 +00:00
CI, Backends: fixes for example_null building. Add consistent IMGUI_IMPL_API in backend.
This commit is contained in:
34
.github/workflows/build.yml
vendored
34
.github/workflows/build.yml
vendored
@@ -300,7 +300,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -Wextra -Werror -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros -Wno-empty-body -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -Wextra -Werror -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros -Wno-empty-body -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (freetype)
|
||||
run: |
|
||||
@@ -317,7 +317,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with ImWchar32)
|
||||
run: |
|
||||
@@ -330,7 +330,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with large ImDrawIdx + pointer ImTextureID)
|
||||
run: |
|
||||
@@ -344,7 +344,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with IMGUI_DISABLE_OBSOLETE_FUNCTIONS)
|
||||
run: |
|
||||
@@ -357,7 +357,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with IMGUI_DISABLE_OBSOLETE_KEYIO)
|
||||
run: |
|
||||
@@ -370,7 +370,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with C++20)
|
||||
run: |
|
||||
@@ -383,7 +383,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_DEBUG_TOOLS)
|
||||
run: |
|
||||
@@ -397,7 +397,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with IMGUI_DISABLE_FILE_FUNCTIONS)
|
||||
run: |
|
||||
@@ -410,7 +410,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with IMGUI_USE_BGRA_PACKED_COLOR)
|
||||
run: |
|
||||
@@ -423,7 +423,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (with IM_VEC2_CLASS_EXTRA and IM_VEC4_CLASS_EXTRA)
|
||||
run: |
|
||||
@@ -444,7 +444,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
g++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (C++26, Clang)
|
||||
run: |
|
||||
@@ -457,7 +457,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
clang++ -I. -std=c++26 -Wall -Wformat -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
|
||||
clang++ -I. -Ibackends -std=c++26 -Wall -Wformat -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (without c++ runtime, Clang)
|
||||
run: |
|
||||
@@ -470,7 +470,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
|
||||
clang++ -I. -Ibackends -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_glfw_opengl2
|
||||
run: make -C examples/example_glfw_opengl2
|
||||
@@ -487,7 +487,7 @@ jobs:
|
||||
run: make -C examples/example_sdl2_opengl3
|
||||
|
||||
- name: Build with IMGUI_IMPL_VULKAN_NO_PROTOTYPES
|
||||
run: g++ -c -I. -std=c++11 -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES=1 backends/imgui_impl_vulkan.cpp
|
||||
run: g++ -c -I. -Ibackends -std=c++11 -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES=1 backends/imgui_impl_vulkan.cpp
|
||||
|
||||
MacOS:
|
||||
runs-on: macos-latest
|
||||
@@ -511,7 +511,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
clang++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
clang++ -I. -Ibackends -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (single file build, c++20)
|
||||
run: |
|
||||
@@ -523,7 +523,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
clang++ -I. -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
clang++ -I. -Ibackends -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_null (without c++ runtime)
|
||||
run: |
|
||||
@@ -535,7 +535,7 @@ jobs:
|
||||
#include "examples/example_null/main.cpp"
|
||||
|
||||
EOF
|
||||
clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
|
||||
clang++ -I. -Ibackends -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
|
||||
|
||||
- name: Build example_glfw_opengl2
|
||||
run: make -C examples/example_glfw_opengl2
|
||||
|
||||
@@ -17,46 +17,46 @@
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui_impl_null.h"
|
||||
|
||||
bool ImGui_ImplNull_Init()
|
||||
IMGUI_IMPL_API bool ImGui_ImplNull_Init()
|
||||
{
|
||||
ImGui_ImplNullPlatform_Init();
|
||||
ImGui_ImplNullRender_Init();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplNull_Shutdown()
|
||||
IMGUI_IMPL_API void ImGui_ImplNull_Shutdown()
|
||||
{
|
||||
ImGui_ImplNullRender_Shutdown();
|
||||
ImGui_ImplNullPlatform_Shutdown();
|
||||
}
|
||||
|
||||
void ImGui_ImplNull_NewFrame()
|
||||
IMGUI_IMPL_API void ImGui_ImplNull_NewFrame()
|
||||
{
|
||||
ImGui_ImplNullPlatform_NewFrame();
|
||||
ImGui_ImplNullRender_NewFrame();
|
||||
}
|
||||
|
||||
bool ImGui_ImplNullPlatform_Init()
|
||||
IMGUI_IMPL_API bool ImGui_ImplNullPlatform_Init()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplNullPlatform_Shutdown()
|
||||
IMGUI_IMPL_API void ImGui_ImplNullPlatform_Shutdown()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_HasMouseCursors;
|
||||
}
|
||||
|
||||
void ImGui_ImplNullPlatform_NewFrame()
|
||||
IMGUI_IMPL_API void ImGui_ImplNullPlatform_NewFrame()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.DisplaySize = ImVec2(1920, 1080);
|
||||
io.DeltaTime = 1.0f / 60.0f;
|
||||
}
|
||||
|
||||
bool ImGui_ImplNullRender_Init()
|
||||
IMGUI_IMPL_API bool ImGui_ImplNullRender_Init()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset;
|
||||
@@ -64,14 +64,14 @@ bool ImGui_ImplNullRender_Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplNullRender_Shutdown()
|
||||
IMGUI_IMPL_API void ImGui_ImplNullRender_Shutdown()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_RendererHasVtxOffset;
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_RendererHasTextures;
|
||||
}
|
||||
|
||||
void ImGui_ImplNullRender_NewFrame()
|
||||
IMGUI_IMPL_API void ImGui_ImplNullRender_NewFrame()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void ImGui_ImplNullRender_UpdateTexture(ImTextureData* tex)
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui_ImplNullRender_RenderDrawData(ImDrawData* draw_data)
|
||||
IMGUI_IMPL_API void ImGui_ImplNullRender_RenderDrawData(ImDrawData* draw_data)
|
||||
{
|
||||
if (draw_data->Textures != nullptr)
|
||||
for (ImTextureData* tex : *draw_data->Textures)
|
||||
|
||||
@@ -220,7 +220,7 @@ IMGUI_IMPL_API bool ImGui_ImplWin32_InitForOpenGL(void* hwnd)
|
||||
return ImGui_ImplWin32_InitEx(hwnd, true);
|
||||
}
|
||||
|
||||
void ImGui_ImplWin32_Shutdown()
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown()
|
||||
{
|
||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
|
||||
@@ -392,7 +392,7 @@ static void ImGui_ImplWin32_UpdateGamepads(ImGuiIO& io)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImGui_ImplWin32_NewFrame()
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame()
|
||||
{
|
||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "Context or backend not initialized? Did you call ImGui_ImplWin32_Init()?");
|
||||
@@ -861,7 +861,7 @@ typedef HRESULT(WINAPI* PFN_GetDpiForMonitor)(HMONITOR, MONITOR_DPI_TYPE, UINT*,
|
||||
typedef DPI_AWARENESS_CONTEXT(WINAPI* PFN_SetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); // User32.lib + dll, Windows 10 v1607+ (Creators Update)
|
||||
|
||||
// Helper function to enable DPI awareness without setting up a manifest
|
||||
void ImGui_ImplWin32_EnableDpiAwareness()
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness()
|
||||
{
|
||||
if (_IsWindows10OrGreater())
|
||||
{
|
||||
@@ -890,7 +890,7 @@ void ImGui_ImplWin32_EnableDpiAwareness()
|
||||
#pragma comment(lib, "gdi32") // Link with gdi32.lib for GetDeviceCaps(). MinGW will require linking with '-lgdi32'
|
||||
#endif
|
||||
|
||||
float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
||||
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
||||
{
|
||||
UINT xdpi = 96, ydpi = 96;
|
||||
if (_IsWindows8Point1OrGreater())
|
||||
@@ -916,7 +916,7 @@ float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
||||
return xdpi / 96.0f;
|
||||
}
|
||||
|
||||
float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd)
|
||||
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd)
|
||||
{
|
||||
HMONITOR monitor = ::MonitorFromWindow((HWND)hwnd, MONITOR_DEFAULTTONEAREST);
|
||||
return ImGui_ImplWin32_GetDpiScaleForMonitor(monitor);
|
||||
@@ -933,7 +933,7 @@ float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd)
|
||||
// [experimental]
|
||||
// Borrowed from GLFW's function updateFramebufferTransparency() in src/win32_window.c
|
||||
// (the Dwm* functions are Vista era functions but we are borrowing logic from GLFW)
|
||||
void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd)
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd)
|
||||
{
|
||||
if (!_IsWindowsVistaOrGreater())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user