Ejemplo n.º 1
0
void ScriptComponent::setClassName(const std::string& name)
{
	reset();

	ScriptObject *temp = new ScriptObject(name);

	scriptUpdate = temp->getField("onUpdate");
	if (!scriptUpdate->isNil()) {
		connections.push_back(EventManager::get()->eventUpdate.connect(
			std::bind(&ScriptComponent::onUpdate, this)));
	}

	scriptKeyboard = temp->getField("onKeyboard");
	if (!scriptKeyboard->isNil()) {
		connections.push_back(EventManager::get()->eventKeyboard.connect(
			std::bind(&ScriptComponent::onKeyboard, this, std::placeholders::_1)));
	}

	delete temp;
}