mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
ParticleSystem:setSizes no longer resets size variation to 0 (issue #640)
This commit is contained in:
@@ -578,13 +578,12 @@ void ParticleSystem::setSize(float size)
|
||||
sizes[0] = size;
|
||||
}
|
||||
|
||||
void ParticleSystem::setSize(const std::vector<float> &newSizes, float variation)
|
||||
void ParticleSystem::setSizes(const std::vector<float> &newSizes)
|
||||
{
|
||||
sizes = newSizes;
|
||||
sizeVariation = variation;
|
||||
}
|
||||
|
||||
const std::vector<float> &ParticleSystem::getSize() const
|
||||
const std::vector<float> &ParticleSystem::getSizes() const
|
||||
{
|
||||
return sizes;
|
||||
}
|
||||
|
||||
@@ -326,16 +326,15 @@ public:
|
||||
void setSize(float size);
|
||||
|
||||
/**
|
||||
* Sets the size of the sprite upon creation and upon death (1.0 being the default size) and any variation.
|
||||
* Sets the sizes of the sprite upon creation and upon death (1.0 being the default size).
|
||||
* @param newSizes Array of sizes
|
||||
* @param variation The amount of variation on the starting size (0 being no variation and 1.0 a random size between start and end).
|
||||
**/
|
||||
void setSize(const std::vector<float> &newSizes, float variation = 0.0f);
|
||||
void setSizes(const std::vector<float> &newSizes);
|
||||
|
||||
/**
|
||||
* Returns the size of the particle sprites.
|
||||
* Returns the sizes of the particle sprites.
|
||||
**/
|
||||
const std::vector<float> &getSize() const;
|
||||
const std::vector<float> &getSizes() const;
|
||||
|
||||
/**
|
||||
* Sets the amount of variation to the sprite's beginning size (0 being no variation and 1.0 a random size between start and end).
|
||||
|
||||
@@ -365,7 +365,7 @@ int w_ParticleSystem_setSizes(lua_State *L)
|
||||
for (size_t i = 0; i < nSizes; ++i)
|
||||
sizes[i] = luax_checkfloat(L, 1 + i + 1);
|
||||
|
||||
t->setSize(sizes);
|
||||
t->setSizes(sizes);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ int w_ParticleSystem_setSizes(lua_State *L)
|
||||
int w_ParticleSystem_getSizes(lua_State *L)
|
||||
{
|
||||
ParticleSystem *t = luax_checkparticlesystem(L, 1);
|
||||
const std::vector<float> &sizes = t->getSize();
|
||||
const std::vector<float> &sizes = t->getSizes();
|
||||
|
||||
for (size_t i = 0; i < sizes.size(); i++)
|
||||
lua_pushnumber(L, sizes[i]);
|
||||
|
||||
Reference in New Issue
Block a user