diff options
author | jonas <himself@jonasgunz.de> | 2018-12-27 00:26:34 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2018-12-27 00:26:34 +0100 |
commit | 7015245de4af673af3e6fa62d5d0f9c2e0c2a8a1 (patch) | |
tree | 8bec5d1716eebb0fedc75dcc036385443b1ecea5 /AmpelJonas/cObjectHandler.cpp | |
parent | 616951a353caf398908e6e6ce7dddf34a65513e5 (diff) | |
download | termgl-7015245de4af673af3e6fa62d5d0f9c2e0c2a8a1.tar.gz |
cleaned working tree
Diffstat (limited to 'AmpelJonas/cObjectHandler.cpp')
-rw-r--r-- | AmpelJonas/cObjectHandler.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/AmpelJonas/cObjectHandler.cpp b/AmpelJonas/cObjectHandler.cpp deleted file mode 100644 index d35653a..0000000 --- a/AmpelJonas/cObjectHandler.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "cObjectHandler.h" - -cObjectHandler::cObjectHandler(cRender *_render) -{ - render = _render; -} - -int cObjectHandler::createObject(cObject *_object) -{ - objects.push_back(_object); - return objects.size() - 1; -} - -int cObjectHandler::moveObject(int _object, sPos _pos, int _mode) -{ - if (_object >= objects.size()) //prevent segmentation faults - return 1; - - if (!objects[_object]) - return 1; - - sPos objPosition = objects[_object]->getPosition(); - - if (_mode == _MOVE_RELATIVE) - objects[_object]->setPosition(sPos{ objPosition.x + _pos.x, objPosition.y + _pos.y }); - else if (_mode == _MOVE_ABSOULUTE) - objects[_object]->setPosition(_pos); - - return 0; -} - -int cObjectHandler::destroyObject(int _object) -{ - delete objects[_object]; - objects[_object] = NULL; - - return 0; -} - -int cObjectHandler::write() -{ - render->clear(); - - for (unsigned long int i = 0; i < objects.size(); i++) - { - if (objects[i]) // Check if objects[i] is existent - { - //Draw every Object - sObject obj = objects[i]->getObject(); //get Object #i - - for (int o = 0; o < obj.sizeY; o++) { //y axis - for (int p = 0; p < obj.sizeX; p++) { //x axis - if (obj.cScreen[p][o]) { //Dont overwrite empty pixels - sPos pos{ obj.pos.x + p, obj.pos.y + o }; - render->drawPoint(obj.cScreen[p][o], pos, true, obj.wColor[p][o]); - } - } - } - } - } - - return 0; -} |