aboutsummaryrefslogtreecommitdiff
path: root/cObjectHandler.h
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2019-03-04 00:47:23 +0100
committerGravatar jonas <himself@jonasgunz.de> 2019-03-04 00:47:23 +0100
commita94557f5119ca5cac0ecf970b02180152af83f5d (patch)
tree905245f181305d0fc40edd802423294acb5c4686 /cObjectHandler.h
parentd25296d03fdaeaadd002cd37171ef2b20695cf26 (diff)
downloadtermgl-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.h12
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;