Mercurial > love-experiments
annotate src/modules/graphics/Graphics.cpp @ 1230:30028d55e410
Merged in from main repository (originally from love-mipmap fork)
| author | Alexander Szpakowski <amaranth72@gmail.com> |
|---|---|
| date | Sat, 12 Jan 2013 18:07:14 -0500 |
| parents | 9e6915ef96c8 b757895d6ca2 |
| children | 1cb8b929f662 |
| rev | line source |
|---|---|
| 1096 | 1 /** |
| 2 * Copyright (c) 2006-2012 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 | |
| 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 | |
| 92 bool Graphics::getConstant(const char *in, Support &out) | |
| 93 { | |
| 94 return support.find(in, out); | |
| 95 } | |
| 96 | |
| 97 bool Graphics::getConstant(Support in, const char *&out) | |
| 98 { | |
| 99 return support.find(in, out); | |
| 100 } | |
| 101 | |
| 102 StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM>::Entry Graphics::drawModeEntries[] = | |
| 103 { | |
| 104 { "line", Graphics::DRAW_LINE }, | |
| 105 { "fill", Graphics::DRAW_FILL }, | |
| 106 }; | |
| 107 | |
| 108 StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM> Graphics::drawModes(Graphics::drawModeEntries, sizeof(Graphics::drawModeEntries)); | |
| 109 | |
| 110 StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM>::Entry Graphics::alignModeEntries[] = | |
| 111 { | |
| 112 { "left", Graphics::ALIGN_LEFT }, | |
| 113 { "right", Graphics::ALIGN_RIGHT }, | |
| 114 { "center", Graphics::ALIGN_CENTER }, | |
|
1105
1bd1670a04e1
Close issue #408: printf-justify alignment.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
115 { "justify", Graphics::ALIGN_JUSTIFY }, |
| 1096 | 116 }; |
| 117 | |
| 118 StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM> Graphics::alignModes(Graphics::alignModeEntries, sizeof(Graphics::alignModeEntries)); | |
| 119 | |
| 120 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendModeEntries[] = | |
| 121 { | |
| 122 { "alpha", Graphics::BLEND_ALPHA }, | |
| 123 { "additive", Graphics::BLEND_ADDITIVE }, | |
| 124 { "subtractive", Graphics::BLEND_SUBTRACTIVE }, | |
| 125 { "multiplicative", Graphics::BLEND_MULTIPLICATIVE }, | |
| 126 { "premultiplied", Graphics::BLEND_PREMULTIPLIED }, | |
| 127 }; | |
| 128 | |
| 129 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries)); | |
| 130 | |
| 131 StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM>::Entry Graphics::colorModeEntries[] = | |
| 132 { | |
| 133 { "replace", Graphics::COLOR_REPLACE }, | |
| 134 { "modulate", Graphics::COLOR_MODULATE }, | |
| 135 { "combine", Graphics::COLOR_COMBINE }, | |
| 136 }; | |
| 137 | |
| 138 StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM> Graphics::colorModes(Graphics::colorModeEntries, sizeof(Graphics::colorModeEntries)); | |
| 139 | |
| 140 StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM>::Entry Graphics::lineStyleEntries[] = | |
| 141 { | |
| 142 { "smooth", Graphics::LINE_SMOOTH }, | |
| 143 { "rough", Graphics::LINE_ROUGH } | |
| 144 }; | |
| 145 | |
| 146 StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM> Graphics::lineStyles(Graphics::lineStyleEntries, sizeof(Graphics::lineStyleEntries)); | |
| 147 | |
| 148 StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM>::Entry Graphics::pointStyleEntries[] = | |
| 149 { | |
| 150 { "smooth", Graphics::POINT_SMOOTH }, | |
| 151 { "rough", Graphics::POINT_ROUGH } | |
| 152 }; | |
| 153 | |
| 154 StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM> Graphics::pointStyles(Graphics::pointStyleEntries, sizeof(Graphics::pointStyleEntries)); | |
| 155 | |
| 156 StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM>::Entry Graphics::supportEntries[] = | |
| 157 { | |
| 158 { "canvas", Graphics::SUPPORT_CANVAS }, | |
|
1137
4296fccb2da4
Fix Issue #476: Add HDR Canvas (thanks, Alexander Szpakowski!).
vrld <vrld@vrld.org>
parents:
1105
diff
changeset
|
159 { "hdrcanvas", Graphics::SUPPORT_HDR_CANVAS }, |
|
1200
448da0a19ddb
changed PixelEffect name to ShaderEffect, added lua-side support for vert/frag shader combinations with love.graphics.newShaderEffect, added tentative support for single-file vertex+fragment shaders
Alexander Szpakowski <amaranth72@gmail.com>
parents:
1137
diff
changeset
|
160 { "shadereffect", Graphics::SUPPORT_SHADEREFFECT }, |
|
1211
9e6915ef96c8
Re-added "pixeleffect" graphics isSupported string for compatibility
Alexander Szpakowski <amaranth72@gmail.com>
parents:
1200
diff
changeset
|
161 { "pixeleffect", Graphics::SUPPORT_SHADEREFFECT }, // for compatibility |
| 1096 | 162 { "npot", Graphics::SUPPORT_NPOT }, |
| 163 { "subtractive", Graphics::SUPPORT_SUBTRACTIVE }, | |
|
1178
b757895d6ca2
Added "mipmap" love.graphics.isSupported string
Alexander Szpakowski <amaranth72@gmail.com>
parents:
1137
diff
changeset
|
164 { "mipmap", Graphics::SUPPORT_MIPMAP }, |
| 1096 | 165 }; |
| 166 | |
| 167 StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM> Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries)); | |
| 168 | |
| 169 } // graphics | |
| 170 } // love |
