Example 2: Creating a sprite with a frame from a texture atlasc++ // Load a texture atlas from file auto textureAtlas = cocos2d::SpriteFrameCache::getInstance()->getSpriteFrameByName("atlas.plist"); // Create a sprite with a frame from the texture atlas auto sprite = cocos2d::Sprite::createWithSpriteFrame(textureAtlas); // Add the sprite to the scene and set its position this->addChild(sprite); sprite->setPosition(Vec2(300, 300)); // Mark the sprite for automatic release sprite->autorelease(); ``` These code examples use Cocos2d-x as a package library, which is an open-source game engine for building 2D games on various platforms, such as iOS, Android, and Windows.