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 /cObject.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 'cObject.h')
-rw-r--r-- | cObject.h | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -3,8 +3,12 @@ #include "cRender.h" -struct sObject +#define _HIT_TOP 1 +#define _HIT_BOTTOM 2 +#define _HIT_LEFT 3 +#define _HIT_RIGHT 4 +struct sObject { sPos pos; WORD **wColor; @@ -60,6 +64,20 @@ public: */ virtual void onChar(unsigned char _c){} + + /** Called by cObjectHandler if Object hits another during move operation + * return true to abort move, false to continue and allow overlap + */ + virtual bool onCollisionActive(unsigned int _hit, int _passiveObject) { return false; } + + /** Called by cObjectHandler if Object is hit by another object + * return any integer value to be identified by hitting object + */ + virtual int onCollisionPassive(unsigned int _hit) { return 0; } + + + + protected: //For child classes cObject(); /** For inheriting classes: sets size of framebuffer |