MCPcopy Create free account
hub / github.com/carbonengine/trinity / PickPoint

Method PickPoint

trinity/Sprite2d/Tr2Sprite2dContainer.cpp:206–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206ITr2SpriteObject* 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 {

Callers

nothing calls this directly

Calls 12

PushTransformAbsoluteMethod · 0.80
PushTranslationMethod · 0.80
IsInsideMethod · 0.80
SampleMaskMethod · 0.80
InverseTransformPointMethod · 0.80
PushClipRectangleMethod · 0.80
PopClipRectangleMethod · 0.80
PopTranslationMethod · 0.80
PopTransformAbsoluteMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
IsAuxMouseoverMethod · 0.45

Tested by

no test coverage detected