diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-10-23 13:49:20 +0200 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-10-23 13:49:20 +0200 |
commit | eaa05e7a981b0f581f5393882e4753d9294a3dba (patch) | |
tree | 4f55cbacf8a70229ec523a45848fe89915d707d5 /src/example/asset_manager.cpp | |
parent | f1857fc2d4ddec71b3f0395903f8446cf96b8d0c (diff) |
rendering and asset_manager poc
:
Diffstat (limited to 'src/example/asset_manager.cpp')
-rw-r--r-- | src/example/asset_manager.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/example/asset_manager.cpp b/src/example/asset_manager.cpp new file mode 100644 index 0000000..9b41c2f --- /dev/null +++ b/src/example/asset_manager.cpp @@ -0,0 +1,35 @@ + + +#include <crepe/Sound.h> +#include <crepe/api/AssetManager.h> +#include <crepe/api/Texture.h> + +using namespace crepe; +using namespace crepe::api; +int main() { + + // this needs to be called before the asset manager otherwise the destructor of sdl is not in the right order + { + Texture test("../asset/texture/img.png"); + } + + auto & mgr = AssetManager::get_instance(); + + { + auto bgm = mgr.cache<Sound>("../mwe/audio/bgm.ogg"); + auto sfx1 = mgr.cache<Sound>("../mwe/audio/sfx1.wav"); + auto sfx2 = mgr.cache<Sound>("../mwe/audio/sfx2.wav"); + + auto img = mgr.cache<Texture>("../asset/texture/img.png"); + auto img1 = mgr.cache<Texture>("../asset/texture/second.png"); + } + + { + auto bgm = mgr.cache<Sound>("../mwe/audio/bgm.ogg"); + auto sfx1 = mgr.cache<Sound>("../mwe/audio/sfx1.wav"); + auto sfx2 = mgr.cache<Sound>("../mwe/audio/sfx2.wav"); + + auto img = mgr.cache<Texture>("../asset/texture/img.png"); + auto img1 = mgr.cache<Texture>("../asset/texture/second.png"); + } +} |