diff --git a/src/dxvk/hud/dxvk_hud.cpp b/src/dxvk/hud/dxvk_hud.cpp index 46288fa36..860c6a6c0 100644 --- a/src/dxvk/hud/dxvk_hud.cpp +++ b/src/dxvk/hud/dxvk_hud.cpp @@ -35,6 +35,7 @@ namespace dxvk::hud { | VK_COLOR_COMPONENT_A_BIT; addItem<HudVersionItem>("version"); + addItem<HudClientApiItem>("api", m_device); } @@ -90,14 +91,6 @@ namespace dxvk::hud { HudPos position = { 8.0f, 24.0f }; - if (m_config.elements.test(HudElement::DxvkClientApi)) { - m_renderer.drawText(16.0f, - { position.x, position.y }, - { 1.0f, 1.0f, 1.0f, 1.0f }, - m_device->clientApi()); - position.y += 24.0f; - } - if (m_config.elements.test(HudElement::DeviceInfo)) position = m_hudDeviceInfo.render(m_renderer, position); diff --git a/src/dxvk/hud/dxvk_hud_item.cpp b/src/dxvk/hud/dxvk_hud_item.cpp index 783ec4c1d..54bc9b20f 100644 --- a/src/dxvk/hud/dxvk_hud_item.cpp +++ b/src/dxvk/hud/dxvk_hud_item.cpp @@ -75,4 +75,30 @@ namespace dxvk::hud { return position; } + + HudClientApiItem::HudClientApiItem(const Rc<DxvkDevice>& device) + : m_device(device) { + + } + + + HudClientApiItem::~HudClientApiItem() { + + } + + + HudPos HudClientApiItem::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 }, + m_device->clientApi()); + + 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 10d493125..3b70699dc 100644 --- a/src/dxvk/hud/dxvk_hud_item.h +++ b/src/dxvk/hud/dxvk_hud_item.h @@ -114,4 +114,26 @@ namespace dxvk::hud { }; + /** + * \brief HUD item to display the client API + */ + class HudClientApiItem : public HudItem { + + public: + + HudClientApiItem(const Rc<DxvkDevice>& device); + + ~HudClientApiItem(); + + HudPos render( + HudRenderer& renderer, + HudPos position); + + private: + + Rc<DxvkDevice> m_device; + + }; + + } \ No newline at end of file