Coding the GameObject class
I am going to go through the code in this class in quite a lot of detail because it is key to how all the other classes work. I think you will benefit, however, from seeing the code in its entirety and studying it first. With this in mind, create a new header file in the Header Files/GameObjects
filter called GameObject.h
and add the following code:
#pragma once #include <SFML/Graphics.hpp> #include <vector> #include <string> #include "Component.h" #include "GraphicsComponent.h" #include "GameObjectSharer.h" #include "UpdateComponent.h" class GameObject { private: vector<shared_ptr<Component>> m_Components; string m_Tag; bool m_Active = false; int m_NumberUpdateComponents = 0; bool m_HasUpdateComponent = false; int m_FirstUpdateComponentLocation...