aboutsummaryrefslogtreecommitdiff
path: root/src/example/asset_manager.cpp
blob: 9b41c2f8dc12b81cbc2645bf45f5988b2140babb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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");
	}
}