Thank you. I've been thumbing through forums and docs while completely missing the examples folder. Since I have your attention, is this runtime error familar to you? Everything should be linked correctly, using the debug libs in debug mode etc.
Error:
Produced from the following @ animator.playAnimation();
#include <Windows.h>
#include <SFML\Graphics.hpp>
#include <Thor\Animations.hpp>
#include <Thor\Graphics.hpp>
#define frames 6
sf::IntRect rect[] = {
{ 83, 28, 40, 92 },
{ 133, 27, 41, 93 },
{ 183, 27, 41, 93 },
{ 235, 27, 38, 93 },
{ 283, 28, 38, 92 },
{ 332, 28, 39, 92 },
{ 381, 28, 40, 92 },
};
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
sf::Vector2f Screen(600, 400);
sf::RenderWindow window(sf::VideoMode(Screen.x, Screen.y), "Title");
sf::Image img;
img.loadFromFile("img.png");
sf::Color color(159, 82, 159);
img.createMaskFromColor(color);
sf::Texture tex;
tex.loadFromImage(img);
sf::Sprite sprite;
sprite.setTexture(tex);
thor::FrameAnimation Idle;
for (int c = 0; c <= frames; c++)
{
Idle.addFrame(1.f, rect[c]);
}
thor::Animator<sf::Sprite, std::string> animator;
animator.addAnimation("idle", Idle, sf::seconds(1.f));
sf::Clock frameclock;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
switch (event.type)
{
case sf::Event::Closed:
window.close();
break;
}
}
animator.update(frameclock.restart());
animator.playAnimation("Idle", true);
animator.animate(sprite);
window.draw(sprite);
window.display();
window.clear();
}
}
I've seen a few posts here with other people having similar runtime errors but with different references. One suggestion was to rebuild with Cmake, check the examples box and test. I've tried this as well. It's some simple user error surely.