imgui_utils.h 833 B

123456789101112131415161718192021222324252627282930313233
  1. /*******************************************************************************************
  2. *
  3. * raylib-extras [ImGui] example - asset browser
  4. *
  5. * This is a more complex ImGui Integration
  6. * It shows how to build windows on top of 2d and 3d views using a render texture
  7. *
  8. * Copyright (c) 2024 Jeffery Myers
  9. *
  10. ********************************************************************************************/
  11. #pragma once
  12. #include <string>
  13. #include "raylib.h"
  14. namespace ImGuiUtils
  15. {
  16. void TextWithEllipsis(const char* string, float maxWidth, bool useWordBoundaries = false, float aSpacing = 0);
  17. // DPI scaling functions
  18. inline float ScaleToDPIF(float value)
  19. {
  20. return GetWindowScaleDPI().x * value;
  21. }
  22. inline int ScaleToDPII(int value)
  23. {
  24. return int(GetWindowScaleDPI().x * value);
  25. }
  26. }