Yes, I don't know how I got there, probably something related to the accessing the map does that jump. , VS when error open a new page named xtree, there it points to a line:
_Tree_find_result<_Nodeptr> _Result{{_Scary->_Myhead->_Parent, _Tree_child::_Right}, _Scary->_Myhead};
and a popup with an error of access violation etc...
1 2 3 4 5 6 7 8 9 10
|
kinematicObject player;
sf::Event event;
event.key.code = sf::Keyboard::Up;
std::map<sf::Keyboard::Key, std::function<void(kinematicObject*)>> m;
m.insert({ event.key.code, [](kinematicObject* k) {
k->getSprite().move(sf::Vector2f{ 0,-32 });
std::cout << "success";
}
});
m[event.key.code](&player);
|
this works, I just tried to do it on a small scale and it succeeded, so still I don't know what's the problem with the bigger example...
I think the static_cast don't work as expected.. let me investigate...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
void gameWindow::addObject(Object* obj) {
Object* o = new Object{ *obj };
switch (o->getType()) {
case Object::TYPE::BACKGROUND_OBJ: {
bgObjectStack.push_back(*o);
break;
}
case Object::TYPE::KINEMATIC_OBJ: {
kinematicObjectStack.push_back(*o);
break;
}
case Object::TYPE::STATIC_OBJ: {
staticObjectStack.push_back(*o);
break;
}
case Object::TYPE::MOVABLE_OBJ: {
movableObjectStack.push_back(*o);
break;
}
default:break;
}
}
|
I think this is the cause of the problem, I'm creating with new, Object object, and give him a kinematicObject, and then he slicing it, and the cast don't work..
I think that's the problem...