| 204 | } |
| 205 | |
| 206 | ITr2SpriteObject* Tr2Sprite2dContainer::PickPoint( float x, float y, Tr2Sprite2dScene* renderer ) |
| 207 | { |
| 208 | if( !m_display ) |
| 209 | { |
| 210 | return NULL; |
| 211 | } |
| 212 | if( m_pickState == TR2_SPS_OFF ) |
| 213 | { |
| 214 | return NULL; |
| 215 | } |
| 216 | |
| 217 | if( m_displayWidth <= 0.0f || m_displayHeight <= 0.0f ) |
| 218 | { |
| 219 | return NULL; |
| 220 | } |
| 221 | |
| 222 | ITr2SpriteObject* obj = NULL; |
| 223 | |
| 224 | if( m_absoluteCoordinates ) |
| 225 | { |
| 226 | renderer->PushTransformAbsolute(); |
| 227 | } |
| 228 | |
| 229 | renderer->PushTranslation( m_translation ); |
| 230 | |
| 231 | if( renderer->IsInside( Vector2( x, y ), Vector2( 0.0f, 0.0f ), m_displayWidth, m_displayHeight, m_pickRadius ) ) |
| 232 | { |
| 233 | if( !m_pickingMask || m_pickingMask->SampleMask( renderer->InverseTransformPoint( Vector2( x, y ) ), Vector2( 0.0f, 0.0f ), m_displayWidth, m_displayHeight ) ) |
| 234 | { |
| 235 | if( m_clip ) |
| 236 | { |
| 237 | renderer->PushClipRectangle( 0.0f, 0.0f, m_displayWidth, m_displayHeight ); |
| 238 | } |
| 239 | |
| 240 | for( ITr2SpriteObjectVector::iterator it = m_children.begin(); it != m_children.end(); ++it ) |
| 241 | { |
| 242 | obj = ( *it )->PickPoint( x, y, renderer ); |
| 243 | if( obj ) |
| 244 | { |
| 245 | break; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | if( m_clip ) |
| 250 | { |
| 251 | renderer->PopClipRectangle(); |
| 252 | } |
| 253 | |
| 254 | // If container itself is pickable and no child was found |
| 255 | if( m_pickState == TR2_SPS_ON ) |
| 256 | { |
| 257 | this->m_auxMouseover = NULL; |
| 258 | if( !obj ) |
| 259 | { |
| 260 | obj = this; |
| 261 | } |
| 262 | else |
| 263 | { |
nothing calls this directly
no test coverage detected