Skip to content

Commit

Permalink
fix exporting PostBlur from shared build
Browse files Browse the repository at this point in the history
fix multiple particles spawning from particle manager fixes #9
add framerate as a property to sprite animations to allow multiple framerates per sprite
  • Loading branch information
fallahn committed Dec 5, 2016
1 parent 4372d5d commit a98d544
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ ReleaseStatic

# OSX #
*.DS_Store
ReleaseShared
packages
5 changes: 3 additions & 2 deletions xygine/include/xygine/components/AnimatedDrawable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace xy
struct XY_EXPORT_API Animation
{
friend class AnimatedDrawable;
Animation(const std::string& name, sf::Int16 begin, sf::Int16 end, bool loop = true)
: m_name(name), m_startFrame(begin), m_endFrame(end), m_loop(loop){}
Animation(const std::string& name, sf::Int16 begin, sf::Int16 end, bool loop = true, float frameRate = 0.f)
: m_name(name), m_startFrame(begin), m_endFrame(end), m_loop(loop), m_frameRate(frameRate){}

/*!
\brief Gets the name of the animation
Expand All @@ -61,6 +61,7 @@ namespace xy
sf::Int16 m_startFrame;
sf::Int16 m_endFrame;
bool m_loop;
float m_frameRate;
};

/*!
Expand Down
4 changes: 2 additions & 2 deletions xygine/include/xygine/postprocess/Blur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace xy
setEnabled() or via message callbacks. Blur amount is animated when
enabling or disabling for a smoother transition.
*/
class PostBlur final : public PostProcess
class XY_EXPORT_API PostBlur final : public PostProcess
{
public:
PostBlur();
Expand All @@ -59,7 +59,7 @@ namespace xy
*/
void setEnabled(bool);
/*!
\brief Sets the speed of the transition when enableing or disabling
\brief Sets the speed of the transition when enabling or disabling
the effect.
\param Value must be 1 or greater
*/
Expand Down
4 changes: 3 additions & 1 deletion xygine/src/components/ComponentAnimatedDrawable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ void AnimatedDrawable::play(sf::Int16 start, sf::Int16 end, sf::Int16 offset)
void AnimatedDrawable::play(Animation animation, sf::Int16 offset)
{
setLooped(animation.m_loop);
if(animation.m_frameRate > 0) setFrameRate(animation.m_frameRate);
play(animation.m_startFrame, animation.m_endFrame, offset);
}

Expand Down Expand Up @@ -303,7 +304,8 @@ void AnimatedDrawable::loadAnimationData(const std::string& path)
sf::Int16 start = (a.get("Start").is<double>()) ? static_cast<sf::Int16>(a.get("Start").get<double>()) : 0;
sf::Int16 end = (a.get("End").is<double>()) ? static_cast<sf::Int16>(a.get("End").get<double>()) : 0;
bool loop = (a.get("Loop").is<bool>()) ? a.get("Loop").get<bool>() : false;
m_animations.emplace_back(name, start, end, loop);
float framerate = (a.get("Framerate").is<double>()) ? static_cast<float>(a.get("Framerate").get<double>()) : 0.f;
m_animations.emplace_back(name, start, end, loop, framerate);
}
}

Expand Down
1 change: 1 addition & 0 deletions xygine/src/components/ComponentParticleController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void ParticleController::fire(SystemID id, const sf::Vector2f& position)
//if no inactive systems add a new one from the definition
auto entity = Entity::create(getMessageBus());
auto ps = definition.createSystem(getMessageBus());
ps->followParent(true); //assumes these systems will not move while active, to fix emission of particles in previous position
entity->addComponent<ParticleSystem>(ps);
entity->setWorldPosition(position);
entity->getComponent<ParticleSystem>()->start(definition.releaseCount, definition.delay, definition.duration);
Expand Down

0 comments on commit a98d544

Please sign in to comment.