At me, in static debug mode, even the pure SFML code
#include <SFML/Window.hpp>
sf::Window window(sf::VideoMode(640, 480), "window");
int main() {}
crashes before reaching
main(). That's why I always avoid globals, and you should try it without, too.
Does this code, where I moved all the class instances to local scope, work for you?
#include <SFML/Graphics.hpp>
#include <Thor/Events.hpp>
bool run = true;
void someAction()
{
run = false;
}
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "window");
thor::ActionMap<std::string>::CallbackSystem m_callbackSystem;
thor::ActionMap<std::string> m_actionsTable(window);
m_actionsTable["exit"] = thor::Action(sf::Keyboard::Escape, thor::Action::PressOnce) || thor::Action(sf::Event::Closed);
m_callbackSystem.connect("exit", std::bind(&someAction));
while (window.isOpen() && run)
{
m_actionsTable.update();
m_actionsTable.invokeCallbacks(m_callbackSystem);
window.clear();
window.display();
}
}
Do you link SFML and Thor statically or dynamically?