fork download
  1. struct TextCreate
  2. {
  3. std::unique_ptr<CD3DFont> pD3DFont;
  4.  
  5. TextCreate(const char * szFontName,int FontHeight,DWORD dwCreateFlags)
  6. :pD3DFont(szFontName,FontHeight,dwCreateFlags)
  7. {pD3DFont->Initialize(origIDirect3DDevice9);}
  8.  
  9. //unique_ptr automatically leaves move constructor, move assignment
  10. //unique_ptr automatically deletes copy constructor, copy assignment
  11.  
  12. ~TextCreate()
  13. {pD3DFont->Invalidate();}
  14. };
  15.  
  16. std::vector<TextCreate> fonts;
  17.  
  18. // ---OR---
  19. struct TextCreate
  20. {
  21. CD3DFont pD3DFont;
  22.  
  23. TextCreate(const char * szFontName,int FontHeight,DWORD dwCreateFlags)
  24. :D3DFont(szFontName,FontHeight,dwCreateFlags)
  25. {D3DFont.Initialize(origIDirect3DDevice9);}
  26.  
  27. TextCreate(const TextCreate& rhs) = delete;
  28. TextCreate(TextCreate&& rhs) = delete;
  29. TextCreate& operator=(const TextCreate& rhs) = delete;
  30. TextCreate& operator=(TextCreate&& rhs) = delete;
  31. ~TextCreate()
  32. {pD3DFont.Invalidate();}
  33. };
  34.  
  35. std::vector<std::unique_ptr<TextCreate>> fonts;
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty