Issue #1340 resolved

setAreaSpread resets AreaSpreadAngle and AreaSpreadIsRelativeDirection, and getAreaSpreadIsRelativeDirection returns number instead of boolean

hahawoo
created an issue
  • I think getAreaSpreadIsRelativeDirection should return true/false instead of 1/0.
  • Setting AreaSpread resets AreaSpreadAngle and AreaSpreadIsRelativeDirection to 0, which doesn't seem useful.
image = love.graphics.newImage(love.image.newImageData(1, 1))
ps = love.graphics.newParticleSystem(image)

ps:setAreaSpread('uniform', 10, 10)
ps:setAreaSpreadAngle(2)
ps:setAreaSpreadIsRelativeDirection(true)
print(ps:getAreaSpreadAngle())
print(tostring(ps:getAreaSpreadIsRelativeDirection()))
print()
ps:setAreaSpread('uniform', 10, 10)
print(ps:getAreaSpreadAngle())
print(tostring(ps:getAreaSpreadIsRelativeDirection()))

Output:

2
1

0
0

Comments (1)

  1. Bart van Strien

    Fix return type of ParticleSystem:getAreaSpreadIsRelativeDirection, remove optional parameters from ParticleSystem:setAreaSpread (resolves #1340)

    I opted to remove the optional parameters altogether since they seemed oddly out-of-place. They used to reset the values to defaults when not supplied, and they also weren't returned by getAreaSpread(), so setAreaSpread(getAreaSpread()) actually changed spread parameters.

    The other option was to remove the separate getters/setters for AreaSpreadIsRelativeDirection and AreaSpreadAngle, and fully rely on setAreaSpread for these parameters, but the rest of the ParticleSystem API tends to keep parameters separate.

    → <<cset 55b4b08e5154>>

  2. Log in to comment