Graphics.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #ifndef LOVE_GRAPHICS_GRAPHICS_H
  21. #define LOVE_GRAPHICS_GRAPHICS_H
  22. // LOVE
  23. #include <common/Module.h>
  24. #include <common/StringMap.h>
  25. namespace love
  26. {
  27. namespace graphics
  28. {
  29. class Graphics : public Module
  30. {
  31. public:
  32. enum DrawMode
  33. {
  34. DRAW_LINE = 1,
  35. DRAW_FILL,
  36. DRAW_MAX_ENUM
  37. };
  38. enum AlignMode
  39. {
  40. ALIGN_LEFT = 1,
  41. ALIGN_CENTER,
  42. ALIGN_RIGHT,
  43. ALIGN_MAX_ENUM
  44. };
  45. enum BlendMode
  46. {
  47. BLEND_ALPHA = 1,
  48. BLEND_ADDITIVE,
  49. BLEND_SUBTRACTIVE,
  50. BLEND_MULTIPLICATIVE,
  51. BLEND_MAX_ENUM
  52. };
  53. enum ColorMode
  54. {
  55. COLOR_MODULATE = 1,
  56. COLOR_REPLACE,
  57. COLOR_MAX_ENUM
  58. };
  59. enum LineStyle
  60. {
  61. LINE_ROUGH = 1,
  62. LINE_SMOOTH,
  63. LINE_MAX_ENUM
  64. };
  65. enum PointStyle
  66. {
  67. POINT_ROUGH = 1,
  68. POINT_SMOOTH,
  69. POINT_MAX_ENUM
  70. };
  71. enum Support
  72. {
  73. SUPPORT_FRAMEBUFFERS = 1,
  74. SUPPORT_PIXELEFFECTS,
  75. SUPPORT_MAX_ENUM
  76. };
  77. virtual ~Graphics();
  78. static bool getConstant(const char * in, DrawMode & out);
  79. static bool getConstant(DrawMode in, const char *& out);
  80. static bool getConstant(const char * in, AlignMode & out);
  81. static bool getConstant(AlignMode in, const char *& out);
  82. static bool getConstant(const char * in, BlendMode & out);
  83. static bool getConstant(BlendMode in, const char *& out);
  84. static bool getConstant(const char * in, ColorMode & out);
  85. static bool getConstant(ColorMode in, const char *& out);
  86. static bool getConstant(const char * in, LineStyle & out);
  87. static bool getConstant(LineStyle in, const char *& out);
  88. static bool getConstant(const char * in, PointStyle & out);
  89. static bool getConstant(PointStyle in, const char *& out);
  90. static bool getConstant(const char * in, Support & out);
  91. static bool getConstant(Support in, const char *& out);
  92. private:
  93. static StringMap<DrawMode, DRAW_MAX_ENUM>::Entry drawModeEntries[];
  94. static StringMap<DrawMode, DRAW_MAX_ENUM> drawModes;
  95. static StringMap<AlignMode, ALIGN_MAX_ENUM>::Entry alignModeEntries[];
  96. static StringMap<AlignMode, ALIGN_MAX_ENUM> alignModes;
  97. static StringMap<BlendMode, BLEND_MAX_ENUM>::Entry blendModeEntries[];
  98. static StringMap<BlendMode, BLEND_MAX_ENUM> blendModes;
  99. static StringMap<ColorMode, COLOR_MAX_ENUM>::Entry colorModeEntries[];
  100. static StringMap<ColorMode, COLOR_MAX_ENUM> colorModes;
  101. static StringMap<LineStyle, LINE_MAX_ENUM>::Entry lineStyleEntries[];
  102. static StringMap<LineStyle, LINE_MAX_ENUM> lineStyles;
  103. static StringMap<PointStyle, POINT_MAX_ENUM>::Entry pointStyleEntries[];
  104. static StringMap<PointStyle, POINT_MAX_ENUM> pointStyles;
  105. static StringMap<Support, SUPPORT_MAX_ENUM>::Entry supportEntries[];
  106. static StringMap<Support, SUPPORT_MAX_ENUM> support;
  107. }; // Graphics
  108. } // graphics
  109. } // love
  110. #endif // LOVE_GRAPHICS_GRAPHICS_H