//TODO: we should use a switch() instead of string compares. bool as_point::set_member(const tu_stringi& name, const as_value& val) { if( name == "x" ) { m_point.m_x = val.to_float(); return true; } else if( name == "y" ) { m_point.m_y = val.to_float(); return true; } return as_object::set_member( name, val ); }
bool as_color_transform::set_member(const lfl_stringi& name, const as_value& val) { as_color_transform_member member = get_color_transform_member( name ); switch( member ) { case alphaOffset: { m_color_transform.m_[ 3 ][ 1 ] = val.to_float(); return true; } case blueOffset: { m_color_transform.m_[ 2 ][ 1 ] = val.to_float(); return true; } case greenOffset: { m_color_transform.m_[ 1 ][ 1 ] = val.to_float(); return true; } case redOffset: { m_color_transform.m_[ 0 ][ 1 ] = val.to_float(); return true; } case alphaMultiplier: { m_color_transform.m_[ 3 ][ 0 ] = val.to_float(); return true; } case blueMultiplier: { m_color_transform.m_[ 2 ][ 0 ] = val.to_float(); return true; } case greenMultiplier: { m_color_transform.m_[ 1 ][ 0 ] = val.to_float(); return true; } case redMultiplier: { m_color_transform.m_[ 0 ][ 0 ] = val.to_float(); return true; } case rgb: { int rgb; rgb = val.to_int(); m_color_transform.m_[ 0 ][ 0 ] = 0.0f; m_color_transform.m_[ 1 ][ 0 ] = 0.0f; m_color_transform.m_[ 2 ][ 0 ] = 0.0f; m_color_transform.m_[ 3 ][ 0 ] = 0.0f; m_color_transform.m_[ 0 ][ 1 ] = static_cast<float>( ( rgb >> 16 ) & 0xFF ); m_color_transform.m_[ 1 ][ 1 ] = static_cast<float>( ( rgb >> 8 ) & 0xFF ); m_color_transform.m_[ 2 ][ 1 ] = static_cast<float>( rgb & 0xFF ); m_color_transform.m_[ 3 ][ 1 ] = 255.0f; return true; } default: break; } return as_object::set_member( name, val ); }