Add asset module

This commit is contained in:
2025-05-31 14:36:11 +02:00
parent af6fd5fc45
commit dbddea69f5
3 changed files with 8 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ AudioAsset load_audio(uint8_t const* data, size_t size)
return audio_asset;
}
void init_assets(flecs::world& world)
AssetModule::AssetModule(flecs::world& world)
{
auto* renderer = world.get<SdlHandles>()->renderer;

View File

@@ -31,4 +31,7 @@ struct AudioAssets
AudioAsset background_music;
};
void init_assets(flecs::world& world);
struct AssetModule
{
AssetModule(flecs::world& world);
};

View File

@@ -39,11 +39,12 @@ int main()
}
flecs::world world;
world.set<Game>(Game{.ticks = 0});
world.set<ButtonInput>(ButtonInput{});
world.set<SdlHandles>(SdlHandles{.window = window, .renderer = renderer});
init_assets(world);
world.import <AssetModule>();
world.import <PhysicsModule>();
world.import <LevelModule>();