Mercurial > love-experiments
annotate src/modules/graphics/opengl/wrap_ParticleSystem.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 | c70c9e4d10f3 |
| children | 923a594c28d1 |
| rev | line source |
|---|---|
| 1096 | 1 /** |
|
1282
b7f097053d74
Updated copyright text for the new year
Alex Szpakowski <slime73@gmail.com>
parents:
1192
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 "wrap_ParticleSystem.h" | |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
22 #include "wrap_Quad.h" |
| 1096 | 23 |
| 24 #include "common/Vector.h" | |
| 25 | |
| 26 #include <cstring> | |
| 27 | |
| 28 namespace love | |
| 29 { | |
| 30 namespace graphics | |
| 31 { | |
| 32 namespace opengl | |
| 33 { | |
| 34 | |
| 35 ParticleSystem *luax_checkparticlesystem(lua_State *L, int idx) | |
| 36 { | |
| 37 return luax_checktype<ParticleSystem>(L, idx, "ParticleSystem", GRAPHICS_PARTICLE_SYSTEM_T); | |
| 38 } | |
| 39 | |
| 40 int w_ParticleSystem_setSprite(lua_State *L) | |
| 41 { | |
| 42 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 43 Image *i = luax_checkimage(L, 2); | |
| 44 t->setSprite(i); | |
| 45 return 0; | |
| 46 } | |
| 47 | |
| 48 int w_ParticleSystem_setBufferSize(lua_State *L) | |
| 49 { | |
| 50 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 51 int arg1 = luaL_checkint(L, 2); | |
| 52 t->setBufferSize((unsigned int)arg1); | |
| 53 return 0; | |
| 54 } | |
| 55 | |
| 56 int w_ParticleSystem_setEmissionRate(lua_State *L) | |
| 57 { | |
| 58 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 59 int arg1 = luaL_checkint(L, 2); | |
| 60 t->setEmissionRate((unsigned int)arg1); | |
| 61 return 0; | |
| 62 } | |
| 63 | |
| 64 int w_ParticleSystem_setLifetime(lua_State *L) | |
| 65 { | |
| 66 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 67 float arg1 = (float)luaL_checknumber(L, 2); | |
| 68 t->setLifetime(arg1); | |
| 69 return 0; | |
| 70 } | |
| 71 | |
| 72 int w_ParticleSystem_setParticleLife(lua_State *L) | |
| 73 { | |
| 74 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 75 float arg1 = (float)luaL_checknumber(L, 2); | |
| 76 float arg2 = (float)luaL_optnumber(L, 3, arg1); | |
| 77 t->setParticleLife(arg1, arg2); | |
| 78 return 0; | |
| 79 } | |
| 80 | |
| 81 int w_ParticleSystem_setPosition(lua_State *L) | |
| 82 { | |
| 83 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 84 float arg1 = (float)luaL_checknumber(L, 2); | |
| 85 float arg2 = (float)luaL_checknumber(L, 3); | |
| 86 t->setPosition(arg1, arg2); | |
| 87 return 0; | |
| 88 } | |
| 89 | |
|
1127
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
90 int w_ParticleSystem_setAreaSpread(lua_State *L) |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
91 { |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
92 ParticleSystem *t = luax_checkparticlesystem(L, 1); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
93 |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
94 ParticleSystem::AreaSpreadDistribution distribution; |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
95 const char *str = luaL_checkstring(L, 2); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
96 if (!ParticleSystem::getConstant(str, distribution)) |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
97 return luaL_error(L, "Invalid distribution: '%s'", str); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
98 |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
99 float x = (float)luaL_checknumber(L, 3); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
100 float y = (float)luaL_checknumber(L, 4); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
101 if (x < 0.0f || y < 0.0f) |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
102 return luaL_error(L, "Invalid area spread parameters (must be >= 0)"); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
103 |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
104 t->setAreaSpread(distribution, x, y); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
105 return 0; |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
106 } |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
107 |
| 1096 | 108 int w_ParticleSystem_setDirection(lua_State *L) |
| 109 { | |
| 110 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 111 float arg1 = (float)luaL_checknumber(L, 2); | |
| 112 t->setDirection(arg1); | |
| 113 return 0; | |
| 114 } | |
| 115 | |
| 116 int w_ParticleSystem_setSpread(lua_State *L) | |
| 117 { | |
| 118 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 119 float arg1 = (float)luaL_checknumber(L, 2); | |
| 120 t->setSpread(arg1); | |
| 121 return 0; | |
| 122 } | |
| 123 | |
| 124 int w_ParticleSystem_setRelativeDirection(lua_State *L) | |
| 125 { | |
| 126 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 127 bool arg1 = (bool)luax_toboolean(L, 2); | |
| 128 t->setRelativeDirection(arg1); | |
| 129 return 0; | |
| 130 } | |
| 131 | |
| 132 int w_ParticleSystem_setSpeed(lua_State *L) | |
| 133 { | |
| 134 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 135 float arg1 = (float)luaL_checknumber(L, 2); | |
| 136 float arg2 = (float)luaL_optnumber(L, 3, arg1); | |
| 137 t->setSpeed(arg1, arg2); | |
| 138 return 0; | |
| 139 } | |
| 140 | |
| 141 int w_ParticleSystem_setGravity(lua_State *L) | |
| 142 { | |
| 143 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 144 float arg1 = (float)luaL_checknumber(L, 2); | |
| 145 float arg2 = (float)luaL_optnumber(L, 3, arg1); | |
| 146 t->setGravity(arg1, arg2); | |
| 147 return 0; | |
| 148 } | |
| 149 | |
| 150 int w_ParticleSystem_setRadialAcceleration(lua_State *L) | |
| 151 { | |
| 152 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 153 float arg1 = (float)luaL_checknumber(L, 2); | |
| 154 float arg2 = (float)luaL_optnumber(L, 3, arg1); | |
| 155 t->setRadialAcceleration(arg1, arg2); | |
| 156 return 0; | |
| 157 } | |
| 158 | |
| 159 int w_ParticleSystem_setTangentialAcceleration(lua_State *L) | |
| 160 { | |
| 161 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 162 float arg1 = (float)luaL_checknumber(L, 2); | |
| 163 float arg2 = (float)luaL_optnumber(L, 3, arg1); | |
| 164 t->setTangentialAcceleration(arg1, arg2); | |
| 165 return 0; | |
| 166 } | |
| 167 | |
| 168 int w_ParticleSystem_setSizes(lua_State *L) | |
| 169 { | |
| 170 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 171 size_t nSizes = lua_gettop(L) - 1; | |
| 172 | |
| 173 if (nSizes > 8) | |
| 174 return luaL_error(L, "At most eight (8) sizes may be used."); | |
| 175 | |
| 176 if (nSizes <= 1) | |
| 177 { | |
| 178 float size = luax_checkfloat(L, 2); | |
| 179 t->setSize(size); | |
| 180 } | |
| 181 else | |
| 182 { | |
| 183 std::vector<float> sizes(nSizes); | |
| 184 for (size_t i = 0; i < nSizes; ++i) | |
| 185 sizes[i] = luax_checkfloat(L, 1 + i + 1); | |
| 186 | |
| 187 t->setSize(sizes); | |
| 188 } | |
| 189 return 0; | |
| 190 } | |
| 191 | |
| 192 int w_ParticleSystem_setSizeVariation(lua_State *L) | |
| 193 { | |
| 194 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 195 float arg1 = (float)luaL_checknumber(L, 2); | |
|
1192
bf8e12d0015f
Enfore limits on ParticleSystem:setSizeVariation (issue #545)
Bart van Strien <bart.bes+projects@gmail.com>
parents:
1127
diff
changeset
|
196 if (arg1 < 0.0f || arg1 > 1.0f) |
|
bf8e12d0015f
Enfore limits on ParticleSystem:setSizeVariation (issue #545)
Bart van Strien <bart.bes+projects@gmail.com>
parents:
1127
diff
changeset
|
197 return luaL_error(L, "Size variation has to be between 0 and 1, inclusive."); |
|
bf8e12d0015f
Enfore limits on ParticleSystem:setSizeVariation (issue #545)
Bart van Strien <bart.bes+projects@gmail.com>
parents:
1127
diff
changeset
|
198 |
| 1096 | 199 t->setSizeVariation(arg1); |
| 200 return 0; | |
| 201 } | |
| 202 | |
| 203 int w_ParticleSystem_setRotation(lua_State *L) | |
| 204 { | |
| 205 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 206 float arg1 = (float)luaL_checknumber(L, 2); | |
| 207 float arg2 = (float)luaL_optnumber(L, 3, arg1); | |
| 208 t->setRotation(arg1, arg2); | |
| 209 return 0; | |
| 210 } | |
| 211 | |
| 212 int w_ParticleSystem_setSpin(lua_State *L) | |
| 213 { | |
| 214 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 215 float arg1 = (float)luaL_checknumber(L, 2); | |
| 216 float arg2 = (float)luaL_optnumber(L, 3, arg1); | |
| 217 float arg3 = (float)luaL_optnumber(L, 4, 0); | |
| 218 t->setSpin(arg1, arg2, arg3); | |
| 219 return 0; | |
| 220 } | |
| 221 | |
| 222 int w_ParticleSystem_setSpinVariation(lua_State *L) | |
| 223 { | |
| 224 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 225 float arg1 = (float)luaL_checknumber(L, 2); | |
| 226 t->setSpinVariation(arg1); | |
| 227 return 0; | |
| 228 } | |
| 229 | |
| 230 int w_ParticleSystem_setColors(lua_State *L) | |
| 231 { | |
| 232 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 233 | |
|
1367
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
234 if (lua_istable(L, 2)) // setColors({r,g,b,a}, {r,g,b,a}, ...) |
| 1096 | 235 { |
|
1367
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
236 size_t nColors = lua_gettop(L) - 1; |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
237 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
238 if (nColors > 8) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
239 return luaL_error(L, "At most eight (8) colors may be used."); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
240 |
| 1096 | 241 std::vector<Color> colors(nColors); |
|
1367
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
242 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
243 for (size_t i = 0; i < nColors; i++) |
| 1096 | 244 { |
|
1367
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
245 luaL_checktype(L, i + 2, LUA_TTABLE); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
246 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
247 if (lua_objlen(L, i + 2) < 3) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
248 return luaL_argerror(L, i + 2, "expected 4 color components"); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
249 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
250 for (int j = 0; j < 4; j++) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
251 // push args[i+2][j+1] onto the stack |
|
1417
c70c9e4d10f3
Cleaned up some Lua binding code
Alex Szpakowski <slime73@gmail.com>
parents:
1408
diff
changeset
|
252 lua_rawgeti(L, i + 2, j + 1); |
|
1367
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
253 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
254 int r = luaL_checkint(L, -4); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
255 int g = luaL_checkint(L, -3); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
256 int b = luaL_checkint(L, -2); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
257 int a = luaL_optint(L, -1, 255); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
258 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
259 // pop the color components from the stack |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
260 lua_pop(L, 4); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
261 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
262 colors[i] = Color(r, g, b, a); |
| 1096 | 263 } |
|
1367
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
264 |
| 1096 | 265 t->setColor(colors); |
| 266 } | |
|
1367
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
267 else // setColors(r,g,b,a, r,g,b,a, ...) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
268 { |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
269 int cargs = lua_gettop(L) - 1; |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
270 size_t nColors = (cargs + 3) / 4; // nColors = ceil(color_args / 4) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
271 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
272 if (cargs % 4 != 0 || cargs == 0) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
273 return luaL_error(L, "Expected red, green, blue, and alpha. Only got %d of 4 components.", cargs % 4); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
274 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
275 if (nColors > 8) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
276 return luaL_error(L, "At most eight (8) colors may be used."); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
277 |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
278 if (nColors == 1) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
279 { |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
280 int r = luaL_checkint(L, 2); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
281 int g = luaL_checkint(L, 3); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
282 int b = luaL_checkint(L, 4); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
283 int a = luaL_checkint(L, 5); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
284 t->setColor(Color(r,g,b,a)); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
285 } |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
286 else |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
287 { |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
288 std::vector<Color> colors(nColors); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
289 for (size_t i = 0; i < nColors; ++i) |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
290 { |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
291 int r = luaL_checkint(L, 1 + i*4 + 1); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
292 int g = luaL_checkint(L, 1 + i*4 + 2); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
293 int b = luaL_checkint(L, 1 + i*4 + 3); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
294 int a = luaL_checkint(L, 1 + i*4 + 4); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
295 colors[i] = Color(r,g,b,a); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
296 } |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
297 t->setColor(colors); |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
298 } |
|
a5f6c26fe799
ParticleSystem:setColors now accepts multiple color arrays (issue #440)
Alex Szpakowski <slime73@gmail.com>
parents:
1360
diff
changeset
|
299 } |
| 1096 | 300 |
| 301 return 0; | |
| 302 } | |
| 303 | |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
304 int w_ParticleSystem_setQuads(lua_State *L) |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
305 { |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
306 ParticleSystem *t = luax_checkparticlesystem(L, 1); |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
307 |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
308 int nQuads = lua_gettop(L) - 1; |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
309 if (lua_istable(L, 2)) |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
310 nQuads = lua_objlen(L, 2); |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
311 |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
312 // Remove all quads if no argument is given. |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
313 if (nQuads == 0) |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
314 { |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
315 t->setQuads(); |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
316 return 0; |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
317 } |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
318 |
|
1360
f1c353a5067d
Cleaned up some ParticleSystem and Quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1353
diff
changeset
|
319 std::vector<Quad *> quads(nQuads); |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
320 |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
321 if (lua_istable(L, 2)) |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
322 { |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
323 for (int i = 0; i < nQuads; i++) |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
324 { |
|
1417
c70c9e4d10f3
Cleaned up some Lua binding code
Alex Szpakowski <slime73@gmail.com>
parents:
1408
diff
changeset
|
325 lua_rawgeti(L, 2, i + 1); // array index |
|
1360
f1c353a5067d
Cleaned up some ParticleSystem and Quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1353
diff
changeset
|
326 quads[i] = luax_checkquad(L, -1); |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
327 lua_pop(L, 1); |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
328 } |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
329 } |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
330 else |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
331 { |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
332 for (int i = 0; i < nQuads; i++) |
|
1360
f1c353a5067d
Cleaned up some ParticleSystem and Quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1353
diff
changeset
|
333 quads[i] = luax_checkquad(L, i + 2); |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
334 } |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
335 |
|
1353
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
336 t->setQuads(quads); |
|
c3c9d6ed3e21
ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
Alex Szpakowski <slime73@gmail.com>
parents:
1352
diff
changeset
|
337 |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
338 return 0; |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
339 } |
|
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
340 |
| 1096 | 341 int w_ParticleSystem_setOffset(lua_State *L) |
| 342 { | |
| 343 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 344 float x = (float)luaL_checknumber(L, 2); | |
| 345 float y = (float)luaL_checknumber(L, 3); | |
| 346 t->setOffset(x, y); | |
| 347 return 0; | |
| 348 } | |
| 349 | |
| 350 int w_ParticleSystem_getX(lua_State *L) | |
| 351 { | |
| 352 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 353 lua_pushnumber(L, t->getX()); | |
| 354 return 1; | |
| 355 } | |
| 356 | |
| 357 int w_ParticleSystem_getY(lua_State *L) | |
| 358 { | |
| 359 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 360 lua_pushnumber(L, t->getY()); | |
| 361 return 1; | |
| 362 } | |
| 363 | |
| 364 int w_ParticleSystem_getPosition(lua_State *L) | |
| 365 { | |
| 366 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 367 const love::Vector &p = t->getPosition(); | |
| 368 lua_pushnumber(L, p.x); | |
| 369 lua_pushnumber(L, p.y); | |
| 370 return 2; | |
| 371 } | |
| 372 | |
|
1127
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
373 int w_ParticleSystem_getAreaSpread(lua_State *L) |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
374 { |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
375 ParticleSystem *t = luax_checkparticlesystem(L, 1); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
376 ParticleSystem::AreaSpreadDistribution distribution = t-> getAreaSpreadDistribution(); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
377 const char *str; |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
378 ParticleSystem::getConstant(distribution, str); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
379 const love::Vector &p = t->getAreaSpreadParameters(); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
380 |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
381 lua_pushstring(L, str); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
382 lua_pushnumber(L, p.x); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
383 lua_pushnumber(L, p.y); |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
384 |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
385 return 3; |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
386 } |
|
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
387 |
| 1096 | 388 int w_ParticleSystem_getDirection(lua_State *L) |
| 389 { | |
| 390 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 391 lua_pushnumber(L, t->getDirection()); | |
| 392 return 1; | |
| 393 } | |
| 394 | |
| 395 int w_ParticleSystem_getSpread(lua_State *L) | |
| 396 { | |
| 397 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 398 lua_pushnumber(L, t->getSpread()); | |
| 399 return 1; | |
| 400 } | |
| 401 | |
| 402 int w_ParticleSystem_getOffsetX(lua_State *L) | |
| 403 { | |
| 404 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 405 lua_pushnumber(L, t->getOffsetX()); | |
| 406 return 1; | |
| 407 } | |
| 408 | |
| 409 int w_ParticleSystem_getOffsetY(lua_State *L) | |
| 410 { | |
| 411 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 412 lua_pushnumber(L, t->getOffsetY()); | |
| 413 return 1; | |
| 414 } | |
| 415 | |
| 416 int w_ParticleSystem_count(lua_State *L) | |
| 417 { | |
| 418 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 419 lua_pushnumber(L, t->count()); | |
| 420 return 1; | |
| 421 } | |
| 422 | |
| 423 int w_ParticleSystem_start(lua_State *L) | |
| 424 { | |
| 425 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 426 t->start(); | |
| 427 return 0; | |
| 428 } | |
| 429 | |
| 430 int w_ParticleSystem_stop(lua_State *L) | |
| 431 { | |
| 432 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 433 t->stop(); | |
| 434 return 0; | |
| 435 } | |
| 436 | |
| 437 int w_ParticleSystem_pause(lua_State *L) | |
| 438 { | |
| 439 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 440 t->pause(); | |
| 441 return 0; | |
| 442 } | |
| 443 | |
| 444 int w_ParticleSystem_reset(lua_State *L) | |
| 445 { | |
| 446 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 447 t->reset(); | |
| 448 return 0; | |
| 449 } | |
| 450 | |
|
1408
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
451 int w_ParticleSystem_emit(lua_State *L) |
|
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
452 { |
|
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
453 ParticleSystem *t = luax_checkparticlesystem(L, 1); |
|
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
454 int num = luaL_checkint(L, 2); |
|
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
455 t->emit(num); |
|
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
456 return 0; |
|
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
457 } |
|
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
458 |
| 1096 | 459 int w_ParticleSystem_isActive(lua_State *L) |
| 460 { | |
| 461 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 462 luax_pushboolean(L, t->isActive()); | |
| 463 return 1; | |
| 464 } | |
| 465 | |
| 466 int w_ParticleSystem_isEmpty(lua_State *L) | |
| 467 { | |
| 468 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 469 luax_pushboolean(L, t->isEmpty()); | |
| 470 return 1; | |
| 471 } | |
| 472 | |
| 473 int w_ParticleSystem_isFull(lua_State *L) | |
| 474 { | |
| 475 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 476 luax_pushboolean(L, t->isFull()); | |
| 477 return 1; | |
| 478 } | |
| 479 | |
| 480 int w_ParticleSystem_update(lua_State *L) | |
| 481 { | |
| 482 ParticleSystem *t = luax_checkparticlesystem(L, 1); | |
| 483 float dt = (float)luaL_checknumber(L, 2); | |
| 484 t->update(dt); | |
| 485 return 0; | |
| 486 } | |
| 487 | |
| 488 static const luaL_Reg functions[] = | |
| 489 { | |
| 490 { "setSprite", w_ParticleSystem_setSprite }, | |
| 491 { "setBufferSize", w_ParticleSystem_setBufferSize }, | |
| 492 { "setEmissionRate", w_ParticleSystem_setEmissionRate }, | |
| 493 { "setLifetime", w_ParticleSystem_setLifetime }, | |
| 494 { "setParticleLife", w_ParticleSystem_setParticleLife }, | |
| 495 { "setPosition", w_ParticleSystem_setPosition }, | |
|
1127
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
496 { "setAreaSpread", w_ParticleSystem_setAreaSpread }, |
| 1096 | 497 { "setDirection", w_ParticleSystem_setDirection }, |
| 498 { "setSpread", w_ParticleSystem_setSpread }, | |
| 499 { "setRelativeDirection", w_ParticleSystem_setRelativeDirection }, | |
| 500 { "setSpeed", w_ParticleSystem_setSpeed }, | |
| 501 { "setGravity", w_ParticleSystem_setGravity }, | |
| 502 { "setRadialAcceleration", w_ParticleSystem_setRadialAcceleration }, | |
| 503 { "setTangentialAcceleration", w_ParticleSystem_setTangentialAcceleration }, | |
| 504 { "setSizes", w_ParticleSystem_setSizes }, | |
| 505 { "setSizeVariation", w_ParticleSystem_setSizeVariation }, | |
| 506 { "setRotation", w_ParticleSystem_setRotation }, | |
| 507 { "setSpin", w_ParticleSystem_setSpin }, | |
| 508 { "setSpinVariation", w_ParticleSystem_setSpinVariation }, | |
| 509 { "setColors", w_ParticleSystem_setColors }, | |
|
1352
470a47bebfb3
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
Alex Szpakowski <slime73@gmail.com>
parents:
1282
diff
changeset
|
510 { "setQuads", w_ParticleSystem_setQuads }, |
| 1096 | 511 { "setOffset", w_ParticleSystem_setOffset }, |
| 512 { "getX", w_ParticleSystem_getX }, | |
| 513 { "getY", w_ParticleSystem_getY }, | |
| 514 { "getPosition", w_ParticleSystem_getPosition }, | |
|
1127
13e6ca38c28c
Fix issue #437: Area-based particle spawn.
vrld <vrld@vrld.org>
parents:
1096
diff
changeset
|
515 { "getAreaSpread", w_ParticleSystem_getAreaSpread }, |
| 1096 | 516 { "getDirection", w_ParticleSystem_getDirection }, |
| 517 { "getSpread", w_ParticleSystem_getSpread }, | |
| 518 { "getOffsetX", w_ParticleSystem_getOffsetX }, | |
| 519 { "getOffsetY", w_ParticleSystem_getOffsetY }, | |
| 520 { "count", w_ParticleSystem_count }, | |
| 521 { "start", w_ParticleSystem_start }, | |
| 522 { "stop", w_ParticleSystem_stop }, | |
| 523 { "pause", w_ParticleSystem_pause }, | |
| 524 { "reset", w_ParticleSystem_reset }, | |
|
1408
107d80a59bca
Added ParticleSystem:emit(num) (issue #577)
Alex Szpakowski <slime73@gmail.com>
parents:
1367
diff
changeset
|
525 { "emit", w_ParticleSystem_emit }, |
| 1096 | 526 { "isActive", w_ParticleSystem_isActive }, |
| 527 { "isEmpty", w_ParticleSystem_isEmpty }, | |
| 528 { "isFull", w_ParticleSystem_isFull }, | |
| 529 { "update", w_ParticleSystem_update }, | |
| 530 { 0, 0 } | |
| 531 }; | |
| 532 | |
| 533 extern "C" int luaopen_particlesystem(lua_State *L) | |
| 534 { | |
| 535 return luax_register_type(L, "ParticleSystem", functions); | |
| 536 } | |
| 537 | |
| 538 } // opengl | |
| 539 } // graphics | |
| 540 } // love |
