/** * \brief Applies a movement to this object. * * Any previous movement is stopped. * * \param movement The movement to apply. */ void Drawable::start_movement(Movement& movement) { stop_movement(); this->movement = &movement; movement.set_drawable(this); movement.increment_refcount(); }
/** * \brief Updates this object. * * This function is called repeatedly. * You can redefine it for your needs. */ void Drawable::update() { if (transition != NULL) { transition->update(); if (transition->is_finished()) { delete transition; transition = NULL; int ref = transition_callback_ref; transition_callback_ref = LUA_REFNIL; if (lua_context != NULL) { // Note that this callback may create a new transition right now. lua_context->do_callback(ref); } } } if (movement != NULL) { movement->update(); if (movement != NULL && movement->is_finished()) { stop_movement(); } } }
/** * \brief Applies a movement to this object. * * Any previous movement is stopped. * * \param movement The movement to apply. */ void Drawable::start_movement(Movement& movement) { stop_movement(); this->movement = &movement; movement.set_drawable(this); RefCountable::ref(&movement); }
/** * \brief Destructor. */ Drawable::~Drawable() { stop_transition(); stop_movement(); }