Przeglądaj źródła

Merge pull request #46 from omar-elhamedy/patch-1

Override function to convert from ImVec4 back to Raylib Color R8G8B8A8 (32bit)
Jeffery Myers 1 rok temu
rodzic
commit
03d4b8196e
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      rlImGuiColors.h

+ 6 - 1
rlImGuiColors.h

@@ -39,4 +39,9 @@ namespace rlImGuiColors
     {
     {
         return ImVec4(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f);
         return ImVec4(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f);
     }
     }
-}
+
+    inline ::Color Convert(ImVec4 color)
+    {
+        return ::Color{ (unsigned char)(color.x * 255.0f), (unsigned char)(color.y * 255.0f), (unsigned char)(color.z * 255.0f), (unsigned char)(color.w * 255.0f) };
+    }
+}