// Processes 'color' and 'background-color' property changes.
void ElementTextSelection::OnPropertyChange(const Rocket::Core::PropertyNameList& changed_properties)
{
	Element::OnPropertyChange(changed_properties);

	if (widget == NULL)
		return;

	// Check for a colour change.
	if (changed_properties.find("color") != changed_properties.end() ||
		changed_properties.find("background-color") != changed_properties.end())
	{
		widget->UpdateSelectionColours();
	}
}
Esempio n. 2
0
    virtual void OnPropertyChange(const Rocket::Core::PropertyNameList& changed_properties)
    {
        Element::OnPropertyChange(changed_properties);

        for (Rocket::Core::PropertyNameList::const_iterator it = changed_properties.begin(); it != changed_properties.end(); ++it)
        {
            if (*it == "worldmodel")
            {
                mapName = GetProperty(*it)->Get<String>();
            }
            else if (*it == "vieworigin-x" || *it == "vieworigin-y" || *it == "vieworigin-z")
            {
                char lastChar = (*it)[it->Length() - 1];
                refdef.vieworg[lastChar - 'x'] = atof( GetProperty(*it)->Get<String>().CString() );
            }
            else if (*it == "viewangle-pitch")
            {
                baseAngles[PITCH] = atof( GetProperty(*it)->Get<String>().CString() );
            }
            else if (*it == "viewangle-yaw")
            {
                baseAngles[YAW] = atof( GetProperty(*it)->Get<String>().CString() );
            }
            else if (*it == "viewangle-roll")
            {
                baseAngles[ROLL] = atof( GetProperty(*it)->Get<String>().CString() );
            }

            else if (*it == "wave-pitch-amplitude")
            {
                aWaveAmplitude[PITCH] = atof( GetProperty(*it)->Get<String>().CString() );
            }
            else if (*it == "wave-yaw-amplitude")
            {
                aWaveAmplitude[YAW] = atof( GetProperty(*it)->Get<String>().CString() );
            }
            else if (*it == "wave-roll-amplitude")
            {
                aWaveAmplitude[ROLL] = atof( GetProperty(*it)->Get<String>().CString() );
            }

            else if (*it == "wave-pitch-phase")
            {
                aWavePhase[PITCH] = atof( GetProperty(*it)->Get<String>().CString() ) / 360.0f * M_TWOPI;
            }
            else if (*it == "wave-yaw-phase")
            {
                aWavePhase[YAW] = atof( GetProperty(*it)->Get<String>().CString() ) / 360.0f * M_TWOPI;
            }
            else if (*it == "wave-roll-phase")
            {
                aWavePhase[ROLL] = atof( GetProperty(*it)->Get<String>().CString() ) / 360.0f * M_TWOPI;
            }

            else if (*it == "wave-pitch-frequency")
            {
                aWaveFrequency[PITCH] = atof( GetProperty(*it)->Get<String>().CString() );
            }
            else if (*it == "wave-yaw-frequency")
            {
                aWaveFrequency[YAW] = atof( GetProperty(*it)->Get<String>().CString() );
            }
            else if (*it == "wave-roll-frequency")
            {
                aWaveFrequency[ROLL] = atof( GetProperty(*it)->Get<String>().CString() );
            }

            else if (*it == "fov")
            {
                fovX = atof( GetProperty(*it)->Get<String>().CString() );
            }

            else if (*it == "color-correction")
            {
                colorCorrection = GetProperty(*it)->Get<String>();
            }
        }
    }
Esempio n. 3
0
	virtual void OnPropertyChange( const Rocket::Core::PropertyNameList& changed_properties ) {
		Element::OnPropertyChange( changed_properties );

		for( Rocket::Core::PropertyNameList::const_iterator it = changed_properties.begin(); it != changed_properties.end(); ++it ) {
			if( *it == "model-modelpath" ) {
				modelName = GetProperty( *it )->Get<Rocket::Core::String>();
				Initialized = false;
			} else if( *it == "model-skinpath" && GetProperty( *it )->Get<Rocket::Core::String>().Length() > 0 ) {
				skinName = GetProperty( *it )->Get<Rocket::Core::String>();
				Initialized = false;
			} else if( *it == "model-scale" ) {
				entity.scale = GetProperty( *it )->Get<float>();
			} else if( *it == "model-outline-height" ) {
				entity.outlineHeight = GetProperty( *it )->Get<float>();
			} else if( *it == "model-outline-color" ) {
				Rocket::Core::Colourb color = GetProperty( *it )->Get<Rocket::Core::Colourb>();
				Vector4Set( entity.outlineRGBA, color.red, color.green, color.blue, color.alpha );
			} else if( *it == "model-shader-color" ) {
				Rocket::Core::Colourb color = GetProperty( *it )->Get<Rocket::Core::Colourb>();
				int shaderColor = COM_ValidatePlayerColor( COLOR_RGB( color.red, color.green, color.blue ) );
				Vector4Set( entity.shaderRGBA, COLOR_R( shaderColor ), COLOR_G( shaderColor ), COLOR_B( shaderColor ), color.alpha );
			} else if( *it == "model-fov-x" ) {
				const Property *prop = GetProperty( *it );
				if( prop->unit == Property::KEYWORD ) {
					fov_x = 0.0f;
				} else {
					fov_x = prop->Get<float>();
					clamp( fov_x, 1.0f, 179.0f );
				}
				RecomputePosition = true;
			} else if( *it == "model-fov-y" ) {
				const Property *prop = GetProperty( *it );
				if( prop->unit == Property::KEYWORD ) {
					fov_y = 0.0f;
				} else {
					fov_y = prop->Get<float>();
					clamp( fov_y, 1.0f, 179.0f );
				}
				RecomputePosition = true;
			} else if( *it == "model-rotation-pitch" ) {
				baseangles[0] = GetProperty( *it )->Get<float>();
				RecomputePosition = true;
			} else if( *it == "model-rotation-yaw" ) {
				baseangles[1] = GetProperty( *it )->Get<float>();
				RecomputePosition = true;
			} else if( *it == "model-rotation-roll" ) {
				baseangles[2] = GetProperty( *it )->Get<float>();
				RecomputePosition = true;
			} else if( *it == "model-rotation-speed-pitch" ) {
				anglespeed[0] = GetProperty( *it )->Get<float>();
			} else if( *it == "model-rotation-speed-yaw" ) {
				anglespeed[1] = GetProperty( *it )->Get<float>();
			} else if( *it == "model-rotation-speed-roll" ) {
				anglespeed[2] = GetProperty( *it )->Get<float>();
			} else if( *it == "model-rotation-autocenter" ) {
				AutoRotationCenter = ( GetProperty( *it )->Get<Rocket::Core::String>().ToLower() == "true" );
			}
		}

		if( std::fabs( refdef.width - GetClientWidth() ) >= MODELVIEW_EPSILON || std::fabs( refdef.height - GetClientHeight() ) >= MODELVIEW_EPSILON ) {
			RecomputePosition = true;
		}

		if( ( refdef.x - GetAbsoluteLeft() + GetClientLeft() ) >= MODELVIEW_EPSILON || ( refdef.y - GetAbsoluteTop() + GetClientTop() ) >= MODELVIEW_EPSILON ) {
			RecomputePosition = true;
		}
	}