CmTestTextSprite.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "CmTestTextSprite.h"
  2. #include "CmSceneObject.h"
  3. #include "CmRenderable.h"
  4. #include "CmMesh.h"
  5. #include "CmVector2.h"
  6. #include "BsTextSprite.h"
  7. #include "CmFont.h"
  8. #include "CmMaterial.h"
  9. #include "BsGUILabel.h"
  10. #include "BsGUISkin.h"
  11. #include "CmOverlayManager.h"
  12. using namespace BansheeEngine;
  13. namespace CamelotEngine
  14. {
  15. TestTextSprite::TestTextSprite(const HSceneObject& parent)
  16. :GUIWidget(parent), mSkin(nullptr)
  17. {
  18. }
  19. TestTextSprite::~TestTextSprite()
  20. {
  21. // TODO - temporarily not deleting this
  22. //if(mSkin != nullptr)
  23. // CM_DELETE(mSkin, GUISkin, PoolAlloc);
  24. }
  25. void TestTextSprite::setText(const HCamera& camera, const String& text, HFont font, UINT32 fontSize)
  26. {
  27. mSkin = CM_NEW(GUISkin, PoolAlloc) GUISkin();
  28. OverlayManager::instance().attachOverlay(camera.get(), this);
  29. GUIElementStyle labelStyle;
  30. labelStyle.font = font;
  31. labelStyle.fontSize = fontSize;
  32. mSkin->setStyle(BansheeEngine::GUILabel::getGUITypeName(), labelStyle);
  33. setSkin(mSkin);
  34. BansheeEngine::GUILabel::create(this, text, 400, 400, true, THA_Right, TVA_Bottom);
  35. }
  36. void TestTextSprite::update()
  37. {
  38. }
  39. }