TextSample.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef TEXTSAMPLE_H_
  2. #define TEXTSAMPLE_H_
  3. #include "gameplay.h"
  4. #include "Sample.h"
  5. using namespace gameplay;
  6. /**
  7. * Sample the text and font class with various text functionality.
  8. */
  9. class TextSample : public Sample, public Control::Listener
  10. {
  11. public:
  12. TextSample();
  13. protected:
  14. void initialize();
  15. void finalize();
  16. void update(float elapsedTime);
  17. void render(float elapsedTime);
  18. void touchEvent(Touch::TouchEvent event, int x, int y, unsigned int contactIndex);
  19. void controlEvent(Control* control, EventType evt);
  20. private:
  21. void renderToTexture();
  22. void buildQuad(Texture* texture);
  23. Form* _form;
  24. RenderState::StateBlock* _stateBlock;
  25. unsigned int _size;
  26. bool _wrap;
  27. bool _ignoreClip;
  28. bool _useViewport;
  29. bool _rightToLeft;
  30. bool _simple;
  31. Font::Justify _alignment;
  32. std::vector<Font*> _fonts;
  33. unsigned int _fontsCount;
  34. unsigned int _fontIndex;
  35. Font* _font;
  36. Rectangle _viewport;
  37. std::string _sampleString;
  38. };
  39. #endif