text_engine.hpp 819 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // text_engine.hpp
  3. // engine
  4. //
  5. // Created by Sam Jaffe on 5/25/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #pragma once
  9. #include <memory>
  10. #include <string>
  11. #include <unordered_map>
  12. #include <game/graphics/object.hpp>
  13. #include <game/math/math_fwd.hpp>
  14. #include <math/vector/vector.hpp>
  15. namespace engine {
  16. class text_engine {
  17. public:
  18. struct cell {
  19. math::vec2 origin;
  20. math::vec2 size;
  21. std::string content;
  22. };
  23. public:
  24. text_engine(std::string const & font,
  25. std::shared_ptr<graphics::manager const> manager);
  26. void create_text_cells(std::vector<graphics::object> & out, cell const & in);
  27. private:
  28. // std::shared_ptr<graphics::manager const> manager_;
  29. std::string font_;
  30. graphics::object prototype_;
  31. std::unordered_map<char, math::vec2> glyphs_;
  32. };
  33. }