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...