OnScreenDisplay.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2008 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <functional>
  5. #include <memory>
  6. #include <string>
  7. #include <vector>
  8. #include "Common/CommonTypes.h"
  9. #include "VideoCommon/Assets/CustomTextureData.h"
  10. namespace OSD
  11. {
  12. enum class MessageType
  13. {
  14. NetPlayPing,
  15. NetPlayBuffer,
  16. // This entry must be kept last so that persistent typed messages are
  17. // displayed before other messages
  18. Typeless,
  19. };
  20. namespace Color
  21. {
  22. constexpr u32 CYAN = 0xFF00FFFF;
  23. constexpr u32 GREEN = 0xFF00FF00;
  24. constexpr u32 RED = 0xFFFF0000;
  25. constexpr u32 YELLOW = 0xFFFFFF30;
  26. } // namespace Color
  27. namespace Duration
  28. {
  29. constexpr u32 SHORT = 2000;
  30. constexpr u32 NORMAL = 5000;
  31. constexpr u32 VERY_LONG = 10000;
  32. } // namespace Duration
  33. // On-screen message display (colored yellow by default)
  34. void AddMessage(std::string message, u32 ms = Duration::SHORT, u32 argb = Color::YELLOW,
  35. const VideoCommon::CustomTextureData::ArraySlice::Level* icon = nullptr);
  36. void AddTypedMessage(MessageType type, std::string message, u32 ms = Duration::SHORT,
  37. u32 argb = Color::YELLOW,
  38. const VideoCommon::CustomTextureData::ArraySlice::Level* icon = nullptr);
  39. // Draw the current messages on the screen. Only call once per frame.
  40. void DrawMessages();
  41. void ClearMessages();
  42. void SetObscuredPixelsLeft(int width);
  43. void SetObscuredPixelsTop(int height);
  44. } // namespace OSD