diff options
author | jonas <himself@jonasgunz.de> | 2019-03-04 00:47:23 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2019-03-04 00:47:23 +0100 |
commit | a94557f5119ca5cac0ecf970b02180152af83f5d (patch) | |
tree | 905245f181305d0fc40edd802423294acb5c4686 /cObjectHandler.h | |
parent | d25296d03fdaeaadd002cd37171ef2b20695cf26 (diff) | |
download | termgl-a94557f5119ca5cac0ecf970b02180152af83f5d.tar.gz |
Started collision detection, working progress
Move now triggers CheckCollision for every move action
Hit direction detection still missing
Diffstat (limited to 'cObjectHandler.h')
-rw-r--r-- | cObjectHandler.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cObjectHandler.h b/cObjectHandler.h index 0e7750c..1e872b3 100644 --- a/cObjectHandler.h +++ b/cObjectHandler.h @@ -8,9 +8,16 @@ //movemodes #define _MOVE_RELATIVE 0 #define _MOVE_ABSOLUTE 1 +#define _MOVE_FORCE_ABSOLUTE 2 using namespace std; +struct sCollision +{ + unsigned int *idv; + int *hitv; + unsigned int idc; +}; /** * Manages cObject and cWiremesh and writes them to a cRender framebuffer. @@ -32,7 +39,8 @@ public: /** * Alters position of _object by _pos either relative to old position or Absolute - * Depending on selected _mode (_MOVE_RELATIVE / _MOVE_ABSOLUTE). + * Depending on selected _mode (_MOVE_RELATIVE / _MOVE_ABSOLUTE / _MOVE_ABSOLUTE). + * _MOVE_ABSOLUTE not recommended: Collision is only checked at destination. To ensure initialisation, use _MOVE_FORCE_ABSOLUTE! */ int moveObject(int _object, sPos _pos, int _mode); @@ -89,6 +97,8 @@ public: private: + sCollision checkCollision(sPos _pos, sPos _size); + void buildHitmap(); vector<cObject*> objects; |