1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[hud] Implement DXVK version info as a HUD item

This commit is contained in:
Philip Rebohle 2019-12-12 21:01:30 +01:00
parent 6931f03120
commit 1c079a96e5
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 34 additions and 9 deletions

View File

@ -1,5 +1,4 @@
#include <cstring>
#include <version.h>
#include "dxvk_hud.h"
@ -34,6 +33,8 @@ namespace dxvk::hud {
| VK_COLOR_COMPONENT_G_BIT
| VK_COLOR_COMPONENT_B_BIT
| VK_COLOR_COMPONENT_A_BIT;
addItem<HudVersionItem>("version");
}
@ -89,14 +90,6 @@ namespace dxvk::hud {
HudPos position = { 8.0f, 24.0f };
if (m_config.elements.test(HudElement::DxvkVersion)) {
m_renderer.drawText(16.0f,
{ position.x, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
"DXVK " DXVK_VERSION);
position.y += 24.0f;
}
if (m_config.elements.test(HudElement::DxvkClientApi)) {
m_renderer.drawText(16.0f,
{ position.x, position.y },

View File

@ -1,5 +1,7 @@
#include "dxvk_hud_item.h"
#include <version.h>
namespace dxvk::hud {
HudItem::~HudItem() {
@ -58,4 +60,19 @@ namespace dxvk::hud {
position = item->render(renderer, position);
}
HudPos HudVersionItem::render(
HudRenderer& renderer,
HudPos position) {
position.y += 16.0f;
renderer.drawText(16.0f,
{ position.x, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
"DXVK " DXVK_VERSION);
position.y += 8.0f;
return position;
}
}

View File

@ -99,4 +99,19 @@ namespace dxvk::hud {
};
/**
* \brief HUD item to display DXVK version
*/
class HudVersionItem : public HudItem {
public:
HudPos render(
HudRenderer& renderer,
HudPos position);
};
}