2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2009-02-22 23:17:57 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2009-02-22 23:17:57 -07:00
|
|
|
|
2013-08-23 18:13:54 -06:00
|
|
|
#include <functional>
|
2023-10-16 17:42:22 -06:00
|
|
|
#include <memory>
|
2013-08-23 17:41:17 -06:00
|
|
|
#include <string>
|
2023-10-16 17:42:22 -06:00
|
|
|
#include <vector>
|
2013-08-23 17:41:17 -06:00
|
|
|
|
2014-10-21 00:01:38 -06:00
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
|
2013-08-23 17:41:17 -06:00
|
|
|
namespace OSD
|
2009-02-21 05:53:10 -07:00
|
|
|
{
|
2016-02-02 08:35:27 -07:00
|
|
|
enum class MessageType
|
|
|
|
{
|
|
|
|
NetPlayPing,
|
|
|
|
NetPlayBuffer,
|
|
|
|
|
|
|
|
// This entry must be kept last so that persistent typed messages are
|
|
|
|
// displayed before other messages
|
|
|
|
Typeless,
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace Color
|
|
|
|
{
|
|
|
|
constexpr u32 CYAN = 0xFF00FFFF;
|
|
|
|
constexpr u32 GREEN = 0xFF00FF00;
|
|
|
|
constexpr u32 RED = 0xFFFF0000;
|
|
|
|
constexpr u32 YELLOW = 0xFFFFFF30;
|
2019-05-05 17:48:12 -06:00
|
|
|
}; // namespace Color
|
2016-02-02 08:35:27 -07:00
|
|
|
|
|
|
|
namespace Duration
|
|
|
|
{
|
|
|
|
constexpr u32 SHORT = 2000;
|
|
|
|
constexpr u32 NORMAL = 5000;
|
|
|
|
constexpr u32 VERY_LONG = 10000;
|
2019-05-05 17:48:12 -06:00
|
|
|
}; // namespace Duration
|
2016-02-02 08:35:27 -07:00
|
|
|
|
2023-10-16 17:42:22 -06:00
|
|
|
struct Icon
|
|
|
|
{
|
|
|
|
std::vector<u8> rgba_data;
|
|
|
|
u32 width = 0;
|
|
|
|
u32 height = 0;
|
|
|
|
}; // struct Icon
|
|
|
|
|
2015-01-01 11:23:34 -07:00
|
|
|
// On-screen message display (colored yellow by default)
|
2023-10-16 17:42:22 -06:00
|
|
|
void AddMessage(std::string message, u32 ms = Duration::SHORT, u32 argb = Color::YELLOW,
|
|
|
|
std::unique_ptr<Icon> icon = nullptr);
|
2019-07-28 20:46:08 -06:00
|
|
|
void AddTypedMessage(MessageType type, std::string message, u32 ms = Duration::SHORT,
|
2023-10-16 17:42:22 -06:00
|
|
|
u32 argb = Color::YELLOW, std::unique_ptr<Icon> icon = nullptr);
|
2019-07-28 20:46:08 -06:00
|
|
|
|
|
|
|
// Draw the current messages on the screen. Only call once per frame.
|
|
|
|
void DrawMessages();
|
2011-02-01 21:40:27 -07:00
|
|
|
void ClearMessages();
|
2020-09-12 09:56:47 -06:00
|
|
|
|
|
|
|
void SetObscuredPixelsLeft(int width);
|
|
|
|
void SetObscuredPixelsTop(int height);
|
2013-08-23 18:13:54 -06:00
|
|
|
} // namespace OSD
|