From 8ce53fa793fcf44fb03927f23385a78694b77f57 Mon Sep 17 00:00:00 2001 From: Alfred Burgess <alfred.burgess95@gmail.com> Date: Thu, 28 Dec 2023 21:57:23 +0800 Subject: [PATCH] Added various components --- include/components/cCollision.h | 18 ++++++++++++++++++ include/components/cInput.h | 18 ++++++++++++++++++ include/components/cPointBar.h | 18 ++++++++++++++++++ include/components/cShape.h | 17 +++++++++++++++++ include/components/cTransform.h | 12 ++++++++---- 5 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 include/components/cCollision.h create mode 100644 include/components/cInput.h create mode 100644 include/components/cPointBar.h create mode 100644 include/components/cShape.h diff --git a/include/components/cCollision.h b/include/components/cCollision.h new file mode 100644 index 0000000..2c996e1 --- /dev/null +++ b/include/components/cCollision.h @@ -0,0 +1,18 @@ +#ifndef __COMPONENT__COLLISION_H__ +#define __COMPONENT__COLLISION_H__ + +#include "components/components-generic.h" +#include "maths/maths.h" + +class cCollision : public CComponentGeneric +{ + public: + double radius = 0.0; + + cCollision(){} + cCollision( float rad ) + : radius( rad ) {} +}; + + +#endif // __COMPONENT__COLLISION_H__ \ No newline at end of file diff --git a/include/components/cInput.h b/include/components/cInput.h new file mode 100644 index 0000000..32dd16e --- /dev/null +++ b/include/components/cInput.h @@ -0,0 +1,18 @@ +#ifndef __COMPONENT__INPUT_H__ +#define __COMPONENT__INPUT_H__ + +#include "components/components-generic.h" +#include "maths/maths.h" + +class cInput : public CComponentGeneric +{ + public: + bool up = false; + bool down = false; + bool left = false; + bool right = false; + bool shoot = false; +}; + + +#endif // __COMPONENT__INPUT_H__ diff --git a/include/components/cPointBar.h b/include/components/cPointBar.h new file mode 100644 index 0000000..12becff --- /dev/null +++ b/include/components/cPointBar.h @@ -0,0 +1,18 @@ +#ifndef __COMPONENT__POINT_BAR_H__ +#define __COMPONENT__POINT_BAR_H__ + +#include "components/components-generic.h" +#include "maths/maths.h" + +class cPointBar : public CComponentGeneric +{ + public: + cPointBar( uint16_t value ) + : _total(value), _current(value) {} + private: + uint16_t _total; + uint16_t _current; +}; + + +#endif // __COMPONENT__POINT_BAR_H__ diff --git a/include/components/cShape.h b/include/components/cShape.h new file mode 100644 index 0000000..ef99062 --- /dev/null +++ b/include/components/cShape.h @@ -0,0 +1,17 @@ +#ifndef __COMPONENT__SHAPE_H__ +#define __COMPONENT__SHAPE_H__ + +#include "components/components-generic.h" +#include "maths/maths.h" + +class cShape : public CComponentGeneric +{ + public: + cShape( uint8_t verticies ) + : _verticies( verticies ) {} + private: + uint8_t _verticies; +}; + + +#endif // __COMPONENT__SHAPE_H__ diff --git a/include/components/cTransform.h b/include/components/cTransform.h index 64e773d..13a269d 100644 --- a/include/components/cTransform.h +++ b/include/components/cTransform.h @@ -7,10 +7,14 @@ class cTransform : public CComponentGeneric { public: - Vec2 position; - Vec2 velocity; - Vec2 scale; - double angle; + Vec2 position = { 0.0, 0.0 }; + Vec2 velocity = { 0.0, 0.0 }; + Vec2 scale = { 0.0, 0.0 }; + double angle = 0.0; + + cTransform(){} + cTransform( const Vec2 &pos, const Vec2 &vel, float ang ) + : position(pos), velocity(vel), angle(ang) {} }; -- GitLab