Skip to content

Instantly share code, notes, and snippets.

@notlion
Created October 12, 2010 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notlion/621595 to your computer and use it in GitHub Desktop.
Save notlion/621595 to your computer and use it in GitHub Desktop.
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;
}
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