Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
collision_data.h
Go to the documentation of this file.
1 #ifndef COLLISION_DATA_H
2 #define COLLISION_DATA_H
3 #include <easylogging++.h>
4 #include <vector>
5 #include "component.h"
6 
7 namespace Physics {
8  class CollisionData : public Component, virtual public el::Loggable {
9  private:
10  std::vector<std::vector<int>> collision_table;
11  unsigned int width;
12  unsigned int height;
13  public:
14  CollisionData() = delete;
15  CollisionData(const unsigned int map_width, const unsigned int map_height);
16 
17  void setIndexCollidable(const unsigned int x, const unsigned int y, const unsigned int collide_level);
18  int getCollideLevel(const int x, const int y);
19  unsigned int getWidth() const noexcept;
20  unsigned int getHeight() const noexcept;
21 
22  virtual void onStart() override;
23  virtual bool onUpdate(const double delta) override;
24  virtual void onDestroy() override;
25 
26  virtual unsigned long long getValueForSorting() const override;
27 
28  virtual std::string to_string() const noexcept override;
29  virtual void log(el::base::type::ostream_t& os) const override;
30 
31  };
32 }
33 #endif
virtual bool onUpdate(const double delta) override
Called every engine loop.
Definition: collision_data.cpp:29
Definition: collision_data.h:8
virtual void onDestroy() override
Called when the engine is shutting down.
Definition: collision_data.cpp:33
Base Class for all components.
Definition: component.h:20
int getCollideLevel(const int x, const int y)
Definition: collision_data.cpp:15
virtual void onStart() override
Called when the engine starts and when a new scene is loaded.
Definition: collision_data.cpp:25
void setIndexCollidable(const unsigned int x, const unsigned int y, const unsigned int collide_level)
Definition: collision_data.cpp:11
virtual unsigned long long getValueForSorting() const override
Gets the value for sorting.
Definition: collision_data.cpp:45
unsigned int getWidth() const noexcept
Definition: collision_data.cpp:37
unsigned int getHeight() const noexcept
Definition: collision_data.cpp:41
virtual void log(el::base::type::ostream_t &os) const override
Definition: collision_data.cpp:62
virtual std::string to_string() const noexceptoverride
Returns a string representation of the object.
Definition: collision_data.cpp:49