void myAssetSystem::ProcessAsset(const tinyxml2::XMLNode* AssetNode) { const tinyxml2::XMLElement* assetElement = AssetNode->ToElement(); std::string id(assetElement->Attribute("id")); std::string filename(assetElement->Attribute("filename")); unsigned int type = atoi(assetElement->Attribute("type")); switch (type) { case myAsset::SPRITE: { std::shared_ptr<mySprite> sprite(new mySprite(id, filename)); _sharedAssets.push_back(sprite); myDebug::Log(myDebug::LOG_INFO, "Loaded:\n%s", sprite->ToString().c_str()); } break; case myAsset::SPRITE_SHEET: { const tinyxml2::XMLElement* spriteSheetElement = assetElement->FirstChild()->ToElement(); int totalRows = atoi(spriteSheetElement->Attribute("totalRows")); int totalColumns = atoi(spriteSheetElement->Attribute("totalColumns")); unsigned long update = (unsigned long) atof(spriteSheetElement->Attribute("update")); std::shared_ptr<mySpriteSheet> spriteSheet(new mySpriteSheet(id, filename, totalRows, totalColumns, update)); _sharedAssets.push_back(spriteSheet); myDebug::Log(myDebug::LOG_INFO, "Loaded:\n%s", spriteSheet->ToString().c_str()); } break; } }
void DefaultCliDelegate::exportFiles(Context* ctx, DocExporter& exporter) { LOG("APP: Exporting sheet...\n"); std::unique_ptr<Doc> spriteSheet(exporter.exportSheet(ctx)); // Sprite sheet isn't used, we just delete it. LOG("APP: Export sprite sheet: Done\n"); }
void AssetDefinition::initParticles() { Image spriteSheet("Particles.png"); Image spark = spriteSheet.cut({0, 0}, {16, 16}); // ------------------------------------------------------------------ // ### Spark // ------------------------------------------------------------------ { auto& d = Spark; d.Sprite = spark; d.LifeTime = 2.0f; d.Color.clear(); d.Color.insert(0.0f, {1.f, 0.8f, 0.5f, 0.90f}); d.Color.insert(0.5f, {1.f, 0.5f, 0.3f, 0.85f}); d.Color.insert(1.0f, {1.f, 0.1f, 0.1f, 0.00f}); } }