예제 #1
0
void MyImageWidget::drawTarget(int x, int y)
{
    setTargetX(x);
    setTargetY(y);
    update();
}
void QchScreenShot::resetTargetX() {
    setTargetX(0);
}
예제 #3
0
int CzCamera::LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node)
{
	// Process attributes
	for (CzXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++)
	{
		unsigned int name_hash = (*it)->getName().getHash();

		if (name_hash == CzHashes::Name_Hash)
			setName((*it)->getValue().c_str());
		else
		if (name_hash == CzHashes::Tag_Hash)
			setTag((*it)->getValue().c_str());
		else
		if (name_hash == CzHashes::Position_Hash)
		{
			if (!(*it)->getValueAsPoint(Position))
				CzDebug::Log(CZ_DEBUG_CHANNEL_WARNING, "Camera - Invalid value for Camera::Position", DebugInfo.c_str());
		}
		else
		if (name_hash == CzHashes::Angle_Hash)
			Angle = (*it)->getValueAsFloat();
		else
		if (name_hash == CzHashes::Scale_Hash)
			Scale = (*it)->getValueAsFloat();
		else
		if (name_hash == CzHashes::TargetX_Hash)
			setTargetX((*it)->getValue().c_str());
		else
		if (name_hash == CzHashes::TargetY_Hash)
			setTargetY((*it)->getValue().c_str());
		else
		if (name_hash == CzHashes::VelocityDamping_Hash)
		{
			if (!(*it)->getValueAsPoint(VelocityDamping))
				CzDebug::Log(CZ_DEBUG_CHANNEL_WARNING, "Camera - Invalid value for Camera::VelocityDamping", DebugInfo.c_str());
		}
		else
		if (name_hash == CzHashes::FollowSpeed_Hash)
		{
			if (!(*it)->getValueAsPoint(FollowSpeed))
				CzDebug::Log(CZ_DEBUG_CHANNEL_WARNING, "Camera - Invalid value for Camera::FollowSpeed", DebugInfo.c_str());
		}
		else
		if (name_hash == CzHashes::TouchPanX_Hash)
			setTouchPanX((*it)->getValueAsBool());
		else
		if (name_hash == CzHashes::TouchPanY_Hash)
			setTouchPanY((*it)->getValueAsBool());
		else
		if (name_hash == CzHashes::IgnoreActors_Hash)
			setIgnoreActors((*it)->getValueAsBool());
	}

	// If we are declared inside a scene then shape is local to the scene
	CzScene* scene = NULL;
	if (parent != NULL && parent->getClassTypeHash() == CzHashes::Actor_Hash)
		scene = ((CzActor*)parent)->getScene();
	else
	if (parent != NULL && parent->getClassTypeHash() == CzHashes::Scene_Hash)
		scene = (CzScene*)parent;
	Scene = scene;

	bool ret = false;
	if (scene != NULL)
		ret = scene->getResourceManager()->addResource(this);
	else
		ret = CZ_GLOBAL_RESOURCES->getResourceManager()->addResource(this);

	if (!ret)
		return 0;

	Update(0);

	return 1;
}