/*
 * AssetManager.cpp
 *
 *  Created on: Apr 4, 2020
 *      Author: ayoungblood
 */

#include "AssetManager.h"
#include "../ecs/Components.h"
#include "../ecs/ECS.h"


class Manager;

AssetManager::AssetManager(Manager* man) : manager(man)
{}

AssetManager::~AssetManager()
{}

// void AssetManager::CreateProjectile(Vector2D pos, Vector2D vel, int range, int speed, std::string id)
// {
// 	auto& projectile(manager->addEntity());
// 	projectile.addComponent<TransformComponent>(pos.x, pos.y, 32, 32, 1);
// 	projectile.addComponent<SpriteComponent>(id);
// 	projectile.addComponent<ProjectileComponent>(range,speed,vel);
// 	projectile.addComponent<ColliderComponent>("projectile");
// 	projectile.addGroup(Game::groupProjectiles);
// ;}

//void AssetManager::CreateText(Vector2D pos, std::string textToDisplay, std::string id)
//{
//	auto& text(manager->addEntity());
//	text.addComponent<TransformComponent>(pos.x,pos.y,32,32,1);
//
//	text.addGroup(Game::groupUI);
//}


void AssetManager::AddTexture(std::string id, const char* path)
{
	textures.emplace(id, TextureManager::LoadTexture(path));
}

SDL_Texture* AssetManager::GetTexture(std::string id)
{
	return textures[id];
}

//Sound Mixer

//Sound Clips
void AssetManager::AddSoundClip(std::string id, const char* path)
{
	soundClips.emplace(id, MusicManager::LoadSound(path));
}
Mix_Chunk* AssetManager::GetSoundClip(std::string id)
{
	return soundClips[id];
}

//Music
void AssetManager::AddMusicTrack(std::string id, const char* path)
{
	musicTracks.emplace(id, MusicManager::LoadMusic(path));
}
Mix_Music* AssetManager::GetMusicTrack(std::string id)
{
	return musicTracks[id];
}
