Skip to content

Instantly share code, notes, and snippets.

@Reputeless
Created December 18, 2022 04:10
Show Gist options
  • Save Reputeless/9ce288b57451dc2ede914044b9e006d6 to your computer and use it in GitHub Desktop.
Save Reputeless/9ce288b57451dc2ede914044b9e006d6 to your computer and use it in GitHub Desktop.
# include <Siv3D.hpp> // OpenSiv3D v0.6.6
void Main()
{
std::unique_ptr<TextureAssetData> assetData = std::make_unique<TextureAssetData>();
// ロード時の仕事
assetData->onLoad = [](TextureAssetData& asset, [[maybe_unused]] const String& hint)
{
// ここに作成したテクスチャを代入する
asset.texture = Texture{ Image{ 256, 256, Palette::Skyblue }, TextureDesc::Mipped };
return true;
};
// 登録
TextureAsset::Register(U"MyTexture", std::move(assetData));
while (System::Update())
{
TextureAsset(U"MyTexture").draw();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment