Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
component.h
1 
9 #pragma once
10 
11 #include <core.h>
12 #include <Events/Observer.h>
13 #include <Events/signal.h>
14 
15 #ifndef BEHAVIOR_H_INCLUDED
16 #define BEHAVIOR_H_INCLUDED
17 
18 namespace rune{
19 
20 class GameObject;
21 
22 class RUNE_ENGINE Component : public Observer
23 {
24 protected:
26  GameObject* parentObject = nullptr;
28  bool isEnabled = true;
29 
30 public:
32  Component() = default;
34  virtual void awake();
36  virtual void start();
38  virtual void update();
40  virtual void fixedUpdate();
42  void setParent(GameObject* newParent);
44  void setEnable(bool newEnable);
46  bool isComponentEnabled(void);
47 
48  void onNotify(Signal const& signal) override{}
49 
50 
51 };
52 }
53 
54 #endif
rune::Signal
Object that is used as a signal to notify observers of action.
Definition: signal.h:19
rune::Observer
An interface that allows objects to watch a subject for signals, and perform some action when notifie...
Definition: observer.h:18
rune::Component
A component of a rune::GameObject, this class is used to add functionality to a object in the game wo...
Definition: component.h:23
rune::Component::Component
Component()=default
Default constructor to set up.
rune
The main namespace to be used for interfacing with the engine.
Definition: animator.h:21
rune::GameObject
Entity control system main object used for all objects in the scene.
Definition: gameObject.h:23
rune::Component::onNotify
void onNotify(Signal const &signal) override
A virtual method to be overridden by a concrete implementation of the observer class.
Definition: component.h:48