void Image::Reset() { // Set amount of rows & cols if animation is non-null rows = (animation == nullptr) ? 1 : animation->rows; cols = (animation == nullptr) ? 1 : animation->cols; max_frame = rows * cols - 1; // Find dimensions of the texture int _query = SDL_QueryTexture(texture, NULL, NULL, &width, &height); // Check for texture error if (_query < 0) Log::s(Log::e << "Texture query error occured on an Image" << SDL_GetError()); frame_width = width / cols; frame_height = height / rows; src->w = frame_width; src->h = frame_height; // Reset routine for position, animation data, frame, and scale SetFrameDelay( (animation == nullptr) ? 1 : animation->delay ); SetAnimate(true); SetPosition(0, 0); SetFrame(0); Scale(1.0f); }
void SmileyType::MoveToNextFrame() { m_index = m_xepimg->SelectNextFrame(m_index); for (int i = 0; i < m_arSmileys.getCount(); i++) m_arSmileys[i]->Draw(); SetFrameDelay(); // reset timer }