void Sprite::load(ResourceManager & resourceManager) { if(this->texture) { /* texture is already loaded */ return; } Texture2DLoader loader(resourceManager); uint64_t textureId = resourceManager.loadResource(this->imageName, loader); this->texture = static_cast<Texture2D *>(resourceManager.getResourceById(textureId)); SDL_assert(this->texture); const Rectangle & r = this->texture->getBounds(); this->source = Rectangle( r.x / r.width, r.y / r.height, 1, 1 ); if(!(this->bounds.width) || !(this->bounds.height)) { this->bounds = this->texture->getBounds(); } }