本文整理汇总了C++中In::zero方法的典型用法代码示例。如果您正苦于以下问题:C++ In::zero方法的具体用法?C++ In::zero怎么用?C++ In::zero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类In
的用法示例。
在下文中一共展示了In::zero方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: poll
bool Input::poll(In &in)
{
in.zero();
if(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT) in.type = In::QUIT;
#ifdef FG_PC
else if(event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
{
in.x = event.button.x;
in.y = event.button.y;
in = mapIn(in);
in.type = In::DOWN;
}
else if(event.type == SDL_MOUSEBUTTONUP && event.button.button == SDL_BUTTON_LEFT)
{
in.x = event.button.x;
in.y = event.button.y;
in = mapIn(in);
in.type = In::UP;
}
else if(event.type == SDL_MOUSEMOTION && (event.motion.state & SDL_BUTTON_LMASK))
{
in.x = event.motion.x;
in.y = event.motion.y;
in = mapIn(in);
in.type = In::MOVE;
}
#elif defined FG_ANDROID
else if(event.type == SDL_FINGERDOWN)
{
in.x = event.tfinger.x*graphics->trueWinWidth();
in.y = event.tfinger.y*graphics->trueWinHeight();
in = mapIn(in);
in.type = In::DOWN;
}
else if(event.type == SDL_FINGERUP)
{
in.x = event.tfinger.x*graphics->trueWinWidth();
in.y = event.tfinger.y*graphics->trueWinHeight();
in = mapIn(in);
in.type = In::UP;
}
else if(event.type == SDL_FINGERMOTION)
{
in.x = event.tfinger.x*graphics->trueWinWidth();
in.y = event.tfinger.y*graphics->trueWinHeight();
in = mapIn(in);
in.type = In::MOVE;
}
#endif
return true;
}
return false;
}