| 42 | } |
| 43 | |
| 44 | ITr2SpriteObject* Tr2Sprite2dTransform::PickPoint( float x, float y, Tr2Sprite2dScene* renderer ) |
| 45 | { |
| 46 | if( !m_display ) |
| 47 | { |
| 48 | return NULL; |
| 49 | } |
| 50 | if( m_pickState == TR2_SPS_OFF ) |
| 51 | { |
| 52 | return NULL; |
| 53 | } |
| 54 | |
| 55 | // Check that we're within the bounding box of the transform object itself |
| 56 | renderer->PushTranslation( m_translation ); |
| 57 | bool isInside = renderer->IsInside( Vector2( x, y ), Vector2( 0.0f, 0.0f ), m_displayWidth, m_displayHeight, 0.0 ); |
| 58 | if( isInside && m_pickingMask ) |
| 59 | { |
| 60 | isInside = m_pickingMask->SampleMask( renderer->InverseTransformPoint( Vector2( x, y ) ), Vector2( 0.0f, 0.0f ), m_displayWidth, m_displayHeight ); |
| 61 | } |
| 62 | renderer->PopTranslation(); |
| 63 | if( !isInside ) |
| 64 | { |
| 65 | return NULL; |
| 66 | } |
| 67 | |
| 68 | ITr2SpriteObject* obj = NULL; |
| 69 | renderer->PushTransform( GetTransformationMatrix() ); |
| 70 | |
| 71 | for( ITr2SpriteObjectVector::iterator it = m_children.begin(); it != m_children.end(); ++it ) |
| 72 | { |
| 73 | obj = ( *it )->PickPoint( x, y, renderer ); |
| 74 | if( obj ) |
| 75 | { |
| 76 | break; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | // If transform itself is pickable and no child was found |
| 81 | if( m_pickState == TR2_SPS_ON ) |
| 82 | { |
| 83 | this->m_auxMouseover = NULL; |
| 84 | if( !obj ) |
| 85 | { |
| 86 | obj = this; |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | if( obj->IsAuxMouseover() ) |
| 91 | { |
| 92 | // The auxiliary mouseover can add content to the mouseover text or context menu |
| 93 | this->m_auxMouseover = obj; |
| 94 | obj = this; |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | renderer->PopTransform(); |
| 99 | |
| 100 | return obj; |
| 101 | } |
nothing calls this directly
no test coverage detected