Hello, I've recently built and setup thor and I've finally gotten around to trying to test it out. I started out with particles which seemed interesting . . . and that's where my fun ended. :<
Anyways I feel like I'm missing something blatantly obvious or I just have a setup that's incompatible with thor.
With this code:
#include <Thor/Particles.hpp>
#include <Thor/Animation.hpp>
#include <Thor/Vectors/PolarVector.hpp>
#include <Thor/Math/Distributions.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow win(sf::VideoMode(400, 300), "Thor test", sf::Style::Close);
sf::Event event;
sf::Texture smoke;
smoke.loadFromFile("smokeparticle.png");
thor::ParticleSystem smokeSystem(smoke);
sf::Clock smokeSystemClock;
thor::UniversalEmitter::Ptr smokeEmitter = thor::UniversalEmitter::create();
smokeEmitter->setEmissionRate(15.0f);
smokeEmitter->setParticleLifetime(thor::Distribution<sf::Time>(sf::seconds(5)));
smokeSystem.addEmitter(smokeEmitter);
smokeSystemClock.restart();
while(win.isOpen())
{
while(win.pollEvent(event))
{
if(event.type == sf::Event::Closed)
{
win.close();
return 0;
}
}
smokeSystem.update(smokeSystemClock.restart());
win.clear(sf::Color(255, 255, 255));
win.draw(smokeSystem);
win.display();
}
}
Errors:
Line 20: Method 'setEmissionRate' could not be resolved
Line 21: Method 'setParticleLifetime' could not be resolved
Line 22: Invalid arguments ' Candidates are: void addEmitter(?) void addEmitter(?, sf::Time) '
I've also tried the example code for particles found on github, with the same errors, everywhere that 'emitter->' and '.addEmitter' are used. I am able to compile the above project with thor if I exclude the emitter code and keep the ParticleSystem it builds and runs properly.
I've setup the compiler flag for c++11 I've tested using shared_ptr separate from the above code with success. I'm using MinGW, gcc 4.7.2 with Eclipse CDT
I hope you have some idea of what's wrong and where I was a derp. Thanks for the help in advanced.
EDIT:
I fixed the issues with functions of UniversalEmitter being unresolved by casting the shared_ptr before using it. like this:
((thor::UniversalEmitter)*smokeEmitter).setEmissionRate(15.0f);
((thor::UniversalEmitter)*smokeEmitter).setParticleLifetime(thor::Distribution<sf::Time>(sf::seconds(5)));
The issues with adding the emitter to the particle system still remain however.
EDIT: EDIT:
I believe I found where I was being a derp all a long.
I should have checked the time stamps on the .exe. It was building just the eclipse indexer was saying that there were issues that would stop it from compiling. That still remains a problem so if you know how to fix that, that would be much appreciated.