Graphics.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**
  2. * Copyright (c) 2006-2011 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #include "Graphics.h"
  21. namespace love
  22. {
  23. namespace graphics
  24. {
  25. Graphics::~Graphics()
  26. {
  27. }
  28. bool Graphics::getConstant(const char * in, DrawMode & out)
  29. {
  30. return drawModes.find(in, out);
  31. }
  32. bool Graphics::getConstant(DrawMode in, const char *& out)
  33. {
  34. return drawModes.find(in, out);
  35. }
  36. bool Graphics::getConstant(const char * in, AlignMode & out)
  37. {
  38. return alignModes.find(in, out);
  39. }
  40. bool Graphics::getConstant(AlignMode in, const char *& out)
  41. {
  42. return alignModes.find(in, out);
  43. }
  44. bool Graphics::getConstant(const char * in, BlendMode & out)
  45. {
  46. return blendModes.find(in, out);
  47. }
  48. bool Graphics::getConstant(BlendMode in, const char *& out)
  49. {
  50. return blendModes.find(in, out);
  51. }
  52. bool Graphics::getConstant(const char * in, ColorMode & out)
  53. {
  54. return colorModes.find(in, out);
  55. }
  56. bool Graphics::getConstant(ColorMode in, const char *& out)
  57. {
  58. return colorModes.find(in, out);
  59. }
  60. bool Graphics::getConstant(const char * in, LineStyle & out)
  61. {
  62. return lineStyles.find(in, out);
  63. }
  64. bool Graphics::getConstant(LineStyle in, const char *& out)
  65. {
  66. return lineStyles.find(in, out);
  67. }
  68. bool Graphics::getConstant(const char * in, PointStyle & out)
  69. {
  70. return pointStyles.find(in, out);
  71. }
  72. bool Graphics::getConstant(PointStyle in, const char *& out)
  73. {
  74. return pointStyles.find(in, out);
  75. }
  76. StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM>::Entry Graphics::drawModeEntries[] =
  77. {
  78. { "line", Graphics::DRAW_LINE },
  79. { "fill", Graphics::DRAW_FILL },
  80. };
  81. StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM> Graphics::drawModes(Graphics::drawModeEntries, sizeof(Graphics::drawModeEntries));
  82. StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM>::Entry Graphics::alignModeEntries[] =
  83. {
  84. { "left", Graphics::ALIGN_LEFT },
  85. { "right", Graphics::ALIGN_RIGHT },
  86. { "center", Graphics::ALIGN_CENTER },
  87. };
  88. StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM> Graphics::alignModes(Graphics::alignModeEntries, sizeof(Graphics::alignModeEntries));
  89. StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendModeEntries[] =
  90. {
  91. { "alpha", Graphics::BLEND_ALPHA },
  92. { "additive", Graphics::BLEND_ADDITIVE },
  93. { "subtractive", Graphics::BLEND_SUBTRACTIVE },
  94. { "multiplicative", Graphics::BLEND_MULTIPLICATIVE },
  95. };
  96. StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries));
  97. StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM>::Entry Graphics::colorModeEntries[] =
  98. {
  99. { "replace", Graphics::COLOR_REPLACE },
  100. { "modulate", Graphics::COLOR_MODULATE },
  101. };
  102. StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM> Graphics::colorModes(Graphics::colorModeEntries, sizeof(Graphics::colorModeEntries));
  103. StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM>::Entry Graphics::lineStyleEntries[] =
  104. {
  105. { "smooth", Graphics::LINE_SMOOTH },
  106. { "rough", Graphics::LINE_ROUGH }
  107. };
  108. StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM> Graphics::lineStyles(Graphics::lineStyleEntries, sizeof(Graphics::lineStyleEntries));
  109. StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM>::Entry Graphics::pointStyleEntries[] =
  110. {
  111. { "smooth", Graphics::POINT_SMOOTH },
  112. { "rough", Graphics::POINT_ROUGH }
  113. };
  114. StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM> Graphics::pointStyles(Graphics::pointStyleEntries, sizeof(Graphics::pointStyleEntries));
  115. } // graphics
  116. } // love