Exemplo n.º 1
0
void GameOverState::setCallbacks(const std::vector<Callback>& callbacks) {
	for (int i = 0; i < m_gameObjects.size(); i++) {
		if (dynamic_cast<MenuButton*>(m_gameObjects[i])) {
			MenuButton* pButton = dynamic_cast<MenuButton*>(m_gameObjects[i]);
			pButton->setCallback(callbacks[pButton->getCallbackID()]);
		}
	}
}
Exemplo n.º 2
0
void PlayState::setCallbacks()
{
	for (int i = 0; i < m_gObjects.size(); i++)
	{
		if (dynamic_cast<MenuButton*>(m_gObjects[i]))
		{
			MenuButton* pButton = dynamic_cast<MenuButton*>(m_gObjects[i]);
			pButton->setCallbacks(m_callbacksID[pButton->getCallbackID()]);
		}
	}

}
Exemplo n.º 3
0
void MenuState::setCallbacks(const std::vector<Callback>&callbacks){
	// go through the game objects
	for (int i = 0; i < m_gameObjectsMenuState.size(); i++)
	{
		// if they are of type MenuButton then assign a callback based on the id passed in from the file
			if (dynamic_cast<MenuButton*>(m_gameObjectsMenuState[i]))
			{
				MenuButton* pButton = dynamic_cast<MenuButton*>(m_gameObjectsMenuState[i]);
				pButton->setCallback(callbacks[pButton->getCallbackID()]);
			}
	}
}