I have an issue in my project, where I get use of undefined type AssetManager. I have been stuck with this error for 3 days now.
#pragma once
#include "Components.h"
#include "SDL.h"
#include "Animation.h"
#include "TextureManager.h"
#include "AssetManager.h"
#include"Game.h"
#include <map>
class SpriteComponent :public Component {
private:
TransformComponent *transform;
SDL_Rect srcRect, destRect;
SDL_Texture *texture;
bool animated = false;
int frames = 0;
int speed = 100;
int animIndex = 0;
public:
SpriteComponent() = default;
std::map<const char*, Animation>animations;
SDL_RendererFlip spriteFlip = SDL_FLIP_NONE;
SpriteComponent(std::string id, bool animate) {
setTexture(id);
Animation idle = Animation(100, 3, 0),
walk = Animation(100, 8, 1);
animations["idle"] = idle;
animations["walk"] = walk;
play("idle");
animated = animate;
}
void setTexture(std::string id) {
texture = Game::assets->getTexture(id);
}
};
Here is the code of the Game.h, knowing I included AssetManager.h inside Game.cpp:
#include<SDL.h>
#include<iostream>
#include<SDL_image.h>
#include<vector>
class AssetManager;
class Game
{...}