KrCollisionMap* KrSpriteResource::GetCollisionMap( KrImage* state/*, int window*/ ) { GLASSERT( state && state->ToSprite() ); KrSprite* sprite = state->ToSprite(); GLASSERT( sprite->SpriteResource() == this ); if ( state->XScale( /*window*/ ) != 1 || state->YScale( /*window*/ ) != 1 ) { if ( !IsScaleCached( state->CompositeXForm( /*window*/ ).xScale, state->CompositeXForm( /*window*/ ).yScale ) ) { // For sprites, only cached scales can be used! /*#ifdef DEBUG GLOUTPUT( "ERROR: Collision only allowed with cahed sprites!\n" ); GLOUTPUT( "SpriteResource '%s' for Action '%s' Frame %d scale %f, %f\n", ResourceName().c_str(), sprite->GetAction()->Name().c_str(), sprite->Frame(), state->CompositeXForm( window ).xScale.ToDouble(), state->CompositeXForm( window ).xScale.ToDouble() ); #endif*/ GLASSERT( 0 ); return 0; } } KrAction* action = sprite->GetAction(); return action->GetCollisionMap( state->CompositeXForm( /*window*/ ).xScale, state->CompositeXForm( /*window*/ ).yScale, sprite->Frame() ); }
PyObject * _wrap_sprite_frame (PyObject *self, PyObject *args) { PyObject *py_r; if (!PyArg_ParseTuple (args, "O:frame", &py_r)) return NULL; GLASSERT (py_r && py_r != Py_None); KrSprite *r = AS_PTR (KrSprite, py_r); GLASSERT (r); int frame = r->Frame(); return PyInt_FromLong (frame); }