Jagguar Game Engine

Loading...
Searching...
No Matches
Component.hpp
1#ifndef COMPONENT_HPP
2#define COMPONENT_HPP
3
4#if defined(LINUX) || defined(MINGW)
5#include <SDL2/SDL.h>
6#else
7// Windows and Mac use a different path
8// If you have compilation errors, change this as needed.
9#include <SDL.h>
10
11#endif
12
13#include "imgui.h"
14#include "imgui_impl_sdl2.h"
15#include "imgui_impl_sdlrenderer.h"
16
17#include <vector>
18#include <string>
19#include <algorithm>
20
25 enum ComponentTag {
26 Physics,
27 Input,
28 Graphics,
29 Position
30};
31
38 class Component {
39 public:
43 Component();
44
48 ~Component();
49
59 virtual void Update(SDL_Event e, int frame, std::vector<std::string> broadcastList);
60
67 virtual void Render(SDL_Renderer *ren);
68
75 virtual void ShowComponentEditor(bool* showEditor);
76
83 virtual bool HasTag(ComponentTag t);
84
92 virtual const char* ComponentTypeName() {return "Component";}
93
102 void ParseAndUpdateBroadcast(std::vector<std::string> broadcastList);
103
104 protected:
105 std::vector<ComponentTag> tags;
106 std::vector<std::string> previousBroadcasts;
107 std::vector<std::string> pendingBroadcasts;
108};
109
110#endif
Component
Definition: Component.hpp:38
Component::ComponentTypeName
virtual const char * ComponentTypeName()
Definition: Component.hpp:92
Component::Component
Component()
Definition: Component.cpp:5
Component::ShowComponentEditor
virtual void ShowComponentEditor(bool *showEditor)
Definition: Component.cpp:19
Component::Update
virtual void Update(SDL_Event e, int frame, std::vector< std::string > broadcastList)
Definition: Component.cpp:15
Component::~Component
~Component()
Definition: Component.cpp:8
Component::Render
virtual void Render(SDL_Renderer *ren)
Definition: Component.cpp:17
Component::ParseAndUpdateBroadcast
void ParseAndUpdateBroadcast(std::vector< std::string > broadcastList)
Definition: Component.cpp:37
Component::HasTag
virtual bool HasTag(ComponentTag t)
Definition: Component.cpp:30