Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

59 rindas
998 B

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include "core.h"
  14. /*
  15. * Forge implementation class
  16. */
  17. static class ForgeData
  18. {
  19. friend class Forge;
  20. public:
  21. Dict fonts;
  22. }
  23. forgedata;
  24. static ForgeData * const data = &forgedata;
  25. /*
  26. * Public Forge class
  27. */
  28. int Forge::Register(char const *path)
  29. {
  30. int id = data->fonts.MakeSlot(path);
  31. if (!data->fonts.GetEntity(id))
  32. {
  33. Font *font = new Font(path);
  34. data->fonts.SetEntity(id, font);
  35. }
  36. return id;
  37. }
  38. void Forge::Deregister(int id)
  39. {
  40. data->fonts.RemoveSlot(id);
  41. }
  42. Font *Forge::GetFont(int id)
  43. {
  44. return (Font *)data->fonts.GetEntity(id);
  45. }