#pragma once #include #include "..\Common\DeviceResources.h" #include "..\Common\StepTimer.h" namespace CameraDirect_cpp { // Renders the current FPS value in the bottom right corner of the screen using Direct2D and DirectWrite. class SampleFpsTextRenderer { public: SampleFpsTextRenderer(const std::shared_ptr& deviceResources); void CreateDeviceDependentResources(); void ReleaseDeviceDependentResources(); void Update(DX::StepTimer const& timer); void Render(); private: // Cached pointer to device resources. std::shared_ptr m_deviceResources; // Resources related to text rendering. std::wstring m_text; DWRITE_TEXT_METRICS m_textMetrics; Microsoft::WRL::ComPtr m_whiteBrush; Microsoft::WRL::ComPtr m_stateBlock; Microsoft::WRL::ComPtr m_textLayout; Microsoft::WRL::ComPtr m_textFormat; }; }