StatsUiNode.h 760 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Scene/SceneNode.h>
  7. #include <AnKi/Ui/UiCanvas.h>
  8. namespace anki {
  9. /// @addtogroup scene
  10. /// @{
  11. /// A node that draws a UI with stats.
  12. class StatsUiNode : public SceneNode
  13. {
  14. public:
  15. StatsUiNode(CString name);
  16. ~StatsUiNode();
  17. void setFpsOnly(Bool fpsOnly)
  18. {
  19. m_fpsOnly = fpsOnly;
  20. }
  21. private:
  22. class Value;
  23. static constexpr U32 kBufferedFrames = 30;
  24. ImFont* m_font = nullptr;
  25. Bool m_fpsOnly = false;
  26. SceneDynamicArray<Value> m_averageValues;
  27. U32 m_bufferedFrames = 0;
  28. void draw(UiCanvas& canvas);
  29. };
  30. /// @}
  31. } // end namespace anki