LogDisplay.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //-------------------------------------------------------------------------------
  2. /**
  3. * This program is distributed under the terms of the GNU Lesser General
  4. * Public License (LGPL).
  5. *
  6. * ASSIMP Viewer Utility
  7. *
  8. */
  9. //-------------------------------------------------------------------------------
  10. #if (!defined AV_LOG_DISPLAY_H_INCLUDED)
  11. #define AV_LOG_DISPLAY_H_INCLUDE
  12. //-------------------------------------------------------------------------------
  13. /** \brief Class to display log strings in the upper right corner of the view
  14. */
  15. //-------------------------------------------------------------------------------
  16. class CLogDisplay
  17. {
  18. private:
  19. CLogDisplay() {}
  20. public:
  21. // data structure for an entry in the log queue
  22. struct SEntry
  23. {
  24. SEntry ()
  25. :
  26. clrColor(D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0x00)), dwStartTicks(0)
  27. {}
  28. std::string szText;
  29. D3DCOLOR clrColor;
  30. DWORD dwStartTicks;
  31. };
  32. // Singleton accessors
  33. static CLogDisplay s_cInstance;
  34. inline static CLogDisplay& Instance ()
  35. {
  36. return s_cInstance;
  37. }
  38. // Add an entry to the log queue
  39. void AddEntry(const std::string& szText,
  40. const D3DCOLOR clrColor = D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0x00));
  41. // Release any native resources associated with the instance
  42. void ReleaseNativeResource();
  43. // Recreate any native resources associated with the instance
  44. void RecreateNativeResource();
  45. // Called during the render loop
  46. void OnRender();
  47. private:
  48. std::list<SEntry> asEntries;
  49. ID3DXFont* piFont;
  50. };
  51. #endif // AV_LOG_DISPLAY_H_INCLUDE