From a08add12dec2bb7d15eb76d3a0f70991b4af04dc Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Mon, 23 Jan 2023 08:02:13 +0100 Subject: [PATCH] [WIP] creation of movement trajectory based on Catmull-Rom --- CMakeLists.txt | 3 +++ src/main.cpp | 2 ++ src/point2D.cpp | 21 +++++++++++++++++++++ src/point2D.h | 19 +++++++++++++++++++ src/trajectory.cpp | 13 +++++++++++++ src/trajectory.h | 24 ++++++++++++++++++++++++ 6 files changed, 82 insertions(+) create mode 100644 src/point2D.cpp create mode 100644 src/point2D.h create mode 100644 src/trajectory.cpp create mode 100644 src/trajectory.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 883073c..8cc5e5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ set(SOURCES src/enemy.cpp src/starfieldshader.cpp + src/point2D.cpp + src/trajectory.cpp + # ... ) set(ASSETS_cg diff --git a/src/main.cpp b/src/main.cpp index 04970a7..e8150d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,8 @@ #include "MyAzurShaders.h" #include "impact.h" +#include "trajectory.h" + #include #include diff --git a/src/point2D.cpp b/src/point2D.cpp new file mode 100644 index 0000000..225e695 --- /dev/null +++ b/src/point2D.cpp @@ -0,0 +1,21 @@ +#include "point2D.h" + + +Point2D::Point2D( ) +{ + x = libnum::num( 0 ); + y = libnum::num( 0 ); +} + + +Point2D::Point2D( int16_t _x, int16_t _y ) +{ + x = libnum::num( _x ); + y = libnum::num( _y ); +} + + +Point2D::~Point2D( ) +{ + +} diff --git a/src/point2D.h b/src/point2D.h new file mode 100644 index 0000000..dde3885 --- /dev/null +++ b/src/point2D.h @@ -0,0 +1,19 @@ +#ifndef POINT2D_H +#define POINT2D_H + +#include +#include +#include + + +class Point2D +{ + public: + libnum::num x, y; + Point2D( ); + Point2D( int16_t _x, int16_t _y ); + ~Point2D( ); +}; + + +#endif \ No newline at end of file diff --git a/src/trajectory.cpp b/src/trajectory.cpp new file mode 100644 index 0000000..2fa618c --- /dev/null +++ b/src/trajectory.cpp @@ -0,0 +1,13 @@ +#include "trajectory.h" + +Trajectory::Trajectory( ) +{ + +} + + +Trajectory::~Trajectory( ) +{ + + +} \ No newline at end of file diff --git a/src/trajectory.h b/src/trajectory.h new file mode 100644 index 0000000..2e820c3 --- /dev/null +++ b/src/trajectory.h @@ -0,0 +1,24 @@ +#ifndef TRAJECTORY_H +#define TRAJECTORY_H + +#include +#include +#include + +#include +#include "point2D.h" + + +class Trajectory +{ + public: + Trajectory( ); + ~Trajectory( ); + + + std::vector ControlPoints; + bool isLoop; +}; + + +#endif \ No newline at end of file