From 1c079a96e547ec78019ed81a81809fc5058616d8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 12 Dec 2019 21:01:30 +0100 Subject: [PATCH] [hud] Implement DXVK version info as a HUD item --- src/dxvk/hud/dxvk_hud.cpp | 11 ++--------- src/dxvk/hud/dxvk_hud_item.cpp | 17 +++++++++++++++++ src/dxvk/hud/dxvk_hud_item.h | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/dxvk/hud/dxvk_hud.cpp b/src/dxvk/hud/dxvk_hud.cpp index 8a1371de..46288fa3 100644 --- a/src/dxvk/hud/dxvk_hud.cpp +++ b/src/dxvk/hud/dxvk_hud.cpp @@ -1,5 +1,4 @@ #include -#include #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("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 }, diff --git a/src/dxvk/hud/dxvk_hud_item.cpp b/src/dxvk/hud/dxvk_hud_item.cpp index 153f1e0a..783ec4c1 100644 --- a/src/dxvk/hud/dxvk_hud_item.cpp +++ b/src/dxvk/hud/dxvk_hud_item.cpp @@ -1,5 +1,7 @@ #include "dxvk_hud_item.h" +#include + 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; + } + } diff --git a/src/dxvk/hud/dxvk_hud_item.h b/src/dxvk/hud/dxvk_hud_item.h index eccb054f..10d49312 100644 --- a/src/dxvk/hud/dxvk_hud_item.h +++ b/src/dxvk/hud/dxvk_hud_item.h @@ -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); + + }; + + } \ No newline at end of file