Created
October 12, 2010 02:51
-
-
Save notlion/621595 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TouchMgr::TouchMgr(AppCocoaTouch *app) | |
{ | |
app->registerTouchesBegan(this, &TouchMgr::onTouchesBegan); | |
} | |
bool TouchMgr::onTouchesBegan(TouchEvent e) | |
{ | |
const std::vector<TouchEvent::Touch> touches = e.getTouches(); | |
for(std::vector<TouchEvent::Touch>::const_iterator tit = touches.begin(); tit != touches.end(); ++tit){ | |
active_pnts.insert(std::make_pair(tit->getId(), TouchPoint(tit->getPos()))); | |
} | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TouchMgr { | |
public: | |
struct TouchPoint{ | |
Vec2f pos; | |
TouchPoint(){} | |
TouchPoint(const Vec2f &_pos){ | |
pos.set(_pos); | |
} | |
}; | |
typedef std::map<uint32_t, TouchPoint>::iterator TouchPointIter; | |
TouchMgr(){} | |
TouchMgr(AppCocoaTouch *app); | |
bool onTouchesBegan(TouchEvent e); | |
std::map<uint32_t, TouchPoint> active_pnts; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment