Mercurial > love-experiments
annotate src/modules/graphics/Graphics.cpp @ 1448:108ee2e81f65 default tip
Fix a case typo, imageData.h -> ImageData.h
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sat, 18 Jan 2014 13:57:44 +0100 |
| parents | 6f9dbdeae2c6 |
| children | 923a594c28d1 |
| rev | line source |
|---|---|
| 1096 | 1 /** |
|
1282
b7f097053d74
Updated copyright text for the new year
Alex Szpakowski <slime73@gmail.com>
parents:
1235
diff
changeset
|
2 * Copyright (c) 2006-2013 LOVE Development Team |
| 1096 | 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 | |
| 21 #include "Graphics.h" | |
| 22 | |
| 23 namespace love | |
| 24 { | |
| 25 namespace graphics | |
| 26 { | |
| 27 | |
| 28 Graphics::~Graphics() | |
| 29 { | |
| 30 } | |
| 31 | |
| 32 bool Graphics::getConstant(const char *in, DrawMode &out) | |
| 33 { | |
| 34 return drawModes.find(in, out); | |
| 35 } | |
| 36 | |
| 37 bool Graphics::getConstant(DrawMode in, const char *&out) | |
| 38 { | |
| 39 return drawModes.find(in, out); | |
| 40 } | |
| 41 | |
| 42 bool Graphics::getConstant(const char *in, AlignMode &out) | |
| 43 { | |
| 44 return alignModes.find(in, out); | |
| 45 } | |
| 46 | |
| 47 bool Graphics::getConstant(AlignMode in, const char *&out) | |
| 48 { | |
| 49 return alignModes.find(in, out); | |
| 50 } | |
| 51 | |
| 52 bool Graphics::getConstant(const char *in, BlendMode &out) | |
| 53 { | |
| 54 return blendModes.find(in, out); | |
| 55 } | |
| 56 | |
| 57 bool Graphics::getConstant(BlendMode in, const char *&out) | |
| 58 { | |
| 59 return blendModes.find(in, out); | |
| 60 } | |
| 61 | |
| 62 bool Graphics::getConstant(const char *in, ColorMode &out) | |
| 63 { | |
| 64 return colorModes.find(in, out); | |
| 65 } | |
| 66 | |
| 67 bool Graphics::getConstant(ColorMode in, const char *&out) | |
| 68 { | |
| 69 return colorModes.find(in, out); | |
| 70 } | |
| 71 | |
| 72 bool Graphics::getConstant(const char *in, LineStyle &out) | |
| 73 { | |
| 74 return lineStyles.find(in, out); | |
| 75 } | |
| 76 | |
| 77 bool Graphics::getConstant(LineStyle in, const char *&out) | |
| 78 { | |
| 79 return lineStyles.find(in, out); | |
| 80 } | |
| 81 | |
| 82 bool Graphics::getConstant(const char *in, PointStyle &out) | |
| 83 { | |
| 84 return pointStyles.find(in, out); | |
| 85 } | |
| 86 | |
| 87 bool Graphics::getConstant(PointStyle in, const char *&out) | |
| 88 { | |
| 89 return pointStyles.find(in, out); | |
| 90 } | |
| 91 | |
|
1438
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
92 bool Graphics::getConstant(const char *in, AlphaTestMode &out) |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
93 { |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
94 return alphaTests.find(in, out); |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
95 } |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
96 |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
97 bool Graphics::getConstant(AlphaTestMode in, const char *&out) |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
98 { |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
99 return alphaTests.find(in, out); |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
100 } |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
101 |
| 1096 | 102 bool Graphics::getConstant(const char *in, Support &out) |
| 103 { | |
| 104 return support.find(in, out); | |
| 105 } | |
| 106 | |
| 107 bool Graphics::getConstant(Support in, const char *&out) | |
| 108 { | |
| 109 return support.find(in, out); | |
| 110 } | |
| 111 | |
| 112 StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM>::Entry Graphics::drawModeEntries[] = | |
| 113 { | |
| 114 { "line", Graphics::DRAW_LINE }, | |
| 115 { "fill", Graphics::DRAW_FILL }, | |
| 116 }; | |
| 117 | |
| 118 StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM> Graphics::drawModes(Graphics::drawModeEntries, sizeof(Graphics::drawModeEntries)); | |
| 119 | |
| 120 StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM>::Entry Graphics::alignModeEntries[] = | |
| 121 { | |
| 122 { "left", Graphics::ALIGN_LEFT }, | |
| 123 { "right", Graphics::ALIGN_RIGHT }, | |
| 124 { "center", Graphics::ALIGN_CENTER }, | |
|
1105
1bd1670a04e1
Close issue #408: printf-justify alignment.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
125 { "justify", Graphics::ALIGN_JUSTIFY }, |
| 1096 | 126 }; |
| 127 | |
| 128 StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM> Graphics::alignModes(Graphics::alignModeEntries, sizeof(Graphics::alignModeEntries)); | |
| 129 | |
| 130 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendModeEntries[] = | |
| 131 { | |
| 132 { "alpha", Graphics::BLEND_ALPHA }, | |
| 133 { "additive", Graphics::BLEND_ADDITIVE }, | |
| 134 { "subtractive", Graphics::BLEND_SUBTRACTIVE }, | |
| 135 { "multiplicative", Graphics::BLEND_MULTIPLICATIVE }, | |
| 136 { "premultiplied", Graphics::BLEND_PREMULTIPLIED }, | |
|
1188
ae46ff867143
Add blend mode 'none' (issue #536)
Bart van Strien <bart.bes+projects@gmail.com>
parents:
1178
diff
changeset
|
137 { "none", Graphics::BLEND_NONE }, |
| 1096 | 138 }; |
| 139 | |
| 140 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries)); | |
| 141 | |
| 142 StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM>::Entry Graphics::colorModeEntries[] = | |
| 143 { | |
| 144 { "replace", Graphics::COLOR_REPLACE }, | |
| 145 { "modulate", Graphics::COLOR_MODULATE }, | |
| 146 { "combine", Graphics::COLOR_COMBINE }, | |
| 147 }; | |
| 148 | |
| 149 StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM> Graphics::colorModes(Graphics::colorModeEntries, sizeof(Graphics::colorModeEntries)); | |
| 150 | |
| 151 StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM>::Entry Graphics::lineStyleEntries[] = | |
| 152 { | |
| 153 { "smooth", Graphics::LINE_SMOOTH }, | |
| 154 { "rough", Graphics::LINE_ROUGH } | |
| 155 }; | |
| 156 | |
| 157 StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM> Graphics::lineStyles(Graphics::lineStyleEntries, sizeof(Graphics::lineStyleEntries)); | |
| 158 | |
| 159 StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM>::Entry Graphics::pointStyleEntries[] = | |
| 160 { | |
| 161 { "smooth", Graphics::POINT_SMOOTH }, | |
| 162 { "rough", Graphics::POINT_ROUGH } | |
| 163 }; | |
| 164 | |
| 165 StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM> Graphics::pointStyles(Graphics::pointStyleEntries, sizeof(Graphics::pointStyleEntries)); | |
| 166 | |
|
1438
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
167 StringMap<Graphics::AlphaTestMode, Graphics::ALPHATEST_MAX_ENUM>::Entry Graphics::alphaTestEntries[] = |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
168 { |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
169 { "<", Graphics::ALPHATEST_LESS }, |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
170 { "<=", Graphics::ALPHATEST_LEQUAL }, |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
171 { "==", Graphics::ALPHATEST_EQUAL }, |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
172 { "~=", Graphics::ALPHATEST_NOTEQUAL }, |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
173 { ">=", Graphics::ALPHATEST_GEQUAL }, |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
174 { ">", Graphics::ALPHATEST_GREATER }, |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
175 }; |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
176 |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
177 StringMap<Graphics::AlphaTestMode, Graphics::ALPHATEST_MAX_ENUM> Graphics::alphaTests(Graphics::alphaTestEntries, sizeof(Graphics::alphaTestEntries)); |
|
6f9dbdeae2c6
Added love.graphics.setAlphaTest (issue #534)
Alex Szpakowski <slime73@gmail.com>
parents:
1420
diff
changeset
|
178 |
| 1096 | 179 StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM>::Entry Graphics::supportEntries[] = |
| 180 { | |
| 181 { "canvas", Graphics::SUPPORT_CANVAS }, | |
|
1137
4296fccb2da4
Fix Issue #476: Add HDR Canvas (thanks, Alexander Szpakowski!).
vrld <vrld@vrld.org>
parents:
1105
diff
changeset
|
182 { "hdrcanvas", Graphics::SUPPORT_HDR_CANVAS }, |
|
1401
bee3f7b0dca0
fixed canvas:clear() when multi-canvas rendering is active, changed some names and wording
Alex Szpakowski <slime73@gmail.com>
parents:
1399
diff
changeset
|
183 { "multicanvas", Graphics::SUPPORT_MULTI_CANVAS }, |
|
1233
1cb8b929f662
Renamed all instances of 'ShaderEffect' (previously 'PixelEffect') to 'Shader'.
Alexander Szpakowski <amaranth72@gmail.com>
parents:
1230
diff
changeset
|
184 { "shader", Graphics::SUPPORT_SHADER }, |
| 1096 | 185 { "npot", Graphics::SUPPORT_NPOT }, |
| 186 { "subtractive", Graphics::SUPPORT_SUBTRACTIVE }, | |
|
1178
b757895d6ca2
Added "mipmap" love.graphics.isSupported string
Alexander Szpakowski <amaranth72@gmail.com>
parents:
1137
diff
changeset
|
187 { "mipmap", Graphics::SUPPORT_MIPMAP }, |
|
1420
2a5ef265e040
Added support for DXT1/3/5 and BC5/7 compressed textures via love.image.CompressedData. Some internals are still iffy.
Alex Szpakowski <slime73@gmail.com>
parents:
1401
diff
changeset
|
188 { "dxt", Graphics::SUPPORT_DXT }, |
|
2a5ef265e040
Added support for DXT1/3/5 and BC5/7 compressed textures via love.image.CompressedData. Some internals are still iffy.
Alex Szpakowski <slime73@gmail.com>
parents:
1401
diff
changeset
|
189 { "bc5", Graphics::SUPPORT_BC5 }, |
|
2a5ef265e040
Added support for DXT1/3/5 and BC5/7 compressed textures via love.image.CompressedData. Some internals are still iffy.
Alex Szpakowski <slime73@gmail.com>
parents:
1401
diff
changeset
|
190 { "bc7", Graphics::SUPPORT_BC7 }, |
| 1096 | 191 }; |
| 192 | |
| 193 StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM> Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries)); | |
| 194 | |
| 195 } // graphics | |
| 196 } // love |
