string3d.h 864 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _STRING3D_
  2. #define _STRING3D_
  3. #include <vector>
  4. #include "vec3.h"
  5. /* string3d
  6. * Used to draw 3d text on screen.
  7. * This class has all the letters in a static way so they
  8. * are loaded once using the `init()` function.
  9. * Each instance of this class, behaves like a style-font,
  10. * this means that it has data to save text, but does not
  11. * save the text itself.
  12. */
  13. class string3d
  14. {
  15. private:
  16. //Vectors of colors, front and back
  17. vec3 colorFront, colorBack;
  18. //Align - left 1 | center 2 | right 3
  19. unsigned char align;
  20. public:
  21. //Constructor
  22. string3d();
  23. //Setters
  24. void setColorFront(float r, float g, float b);
  25. void setColorBack (float r, float g, float b);
  26. void setAlign (unsigned char);
  27. //Draw
  28. void draw(const char* text);
  29. void drawInt(int num);
  30. //Static
  31. static std::vector<vec3> letter[26], number[10];
  32. static void init();
  33. };
  34. #endif