From af13c2061432803cec981ef11a602c9437431e9e Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Wed, 30 Oct 2024 22:39:10 +0100 Subject: [PATCH] Fix Dear ImGui colors on Big Endian systems https://github.com/dhewm/dhewm3/issues/625#issuecomment-2448341504 confirms that it's broken for the fix, see https://github.com/ocornut/imgui/issues/6732#issuecomment-1682918657 https://github.com/ocornut/imgui/pull/5190 --- neo/libs/imgui/imconfig.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/neo/libs/imgui/imconfig.h b/neo/libs/imgui/imconfig.h index 63d6ba08..cf57e7cc 100644 --- a/neo/libs/imgui/imconfig.h +++ b/neo/libs/imgui/imconfig.h @@ -137,3 +137,13 @@ namespace ImGui void MyFunction(const char* name, MyMatrix44* mtx); } */ + +// DG: on Big Endian systems the order of color channels in an uint32 color is inverted. +// this seems to be the official way to support Big Endian platforms in ImGUI: +#if D3_IS_BIG_ENDIAN + #define IM_COL32_R_SHIFT 24 + #define IM_COL32_G_SHIFT 16 + #define IM_COL32_B_SHIFT 8 + #define IM_COL32_A_SHIFT 0 + #define IM_COL32_A_MASK 0x000000FF +#endif