You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
739 B

  1. //
  2. // Deus Hax (working title)
  3. // Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
  4. //
  5. #if defined HAVE_CONFIG_H
  6. # include "config.h"
  7. #endif
  8. #include "core.h"
  9. /*
  10. * Forge implementation class
  11. */
  12. static class ForgeData
  13. {
  14. friend class Forge;
  15. public:
  16. Dict fonts;
  17. }
  18. forgedata;
  19. static ForgeData * const data = &forgedata;
  20. /*
  21. * Public Forge class
  22. */
  23. int Forge::Register(char const *path)
  24. {
  25. int id = data->fonts.MakeSlot(path);
  26. if (!data->fonts.GetEntity(id))
  27. {
  28. Font *font = new Font(path);
  29. data->fonts.SetEntity(id, font);
  30. }
  31. return id;
  32. }
  33. void Forge::Deregister(int id)
  34. {
  35. data->fonts.RemoveSlot(id);
  36. }
  37. Font *Forge::GetFont(int id)
  38. {
  39. return (Font *)data->fonts.GetEntity(id);
  40. }