本文整理汇总了C++中KeyMap::addHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyMap::addHandler方法的具体用法?C++ KeyMap::addHandler怎么用?C++ KeyMap::addHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyMap
的用法示例。
在下文中一共展示了KeyMap::addHandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// *******************************************************
// init_keys(): Define any extra keyboard shortcuts here
virtual void init_keys()
{
keys.addHandler ( 'w', 0, Callback<Animation>( &Animation::forward , this ) );
keys.addHandler ( 'a', 0, Callback<Animation>( &Animation::left , this ) );
keys.addHandler ( 's', 0, Callback<Animation>( &Animation::back , this ) );
keys.addHandler ( 'd', 0, Callback<Animation>( &Animation::right , this ) );
keys.addHandler ( ' ', 0, Callback<Animation>( &Animation::up , this ) );
keys.addHandler ( 'z', 0, Callback<Animation>( &Animation::down , this ) );
keys.addHandler ( 'w', GLUT_Port::RELEASE, Callback<Animation>( &Animation::stopZ , this ) );
keys.addHandler ( 'a', GLUT_Port::RELEASE, Callback<Animation>( &Animation::stopX , this ) );
keys.addHandler ( 's', GLUT_Port::RELEASE, Callback<Animation>( &Animation::stopZ , this ) );
keys.addHandler ( 'd', GLUT_Port::RELEASE, Callback<Animation>( &Animation::stopX , this ) );
keys.addHandler ( ' ', GLUT_Port::RELEASE, Callback<Animation>( &Animation::stopY , this ) );
keys.addHandler ( 'z', GLUT_Port::RELEASE, Callback<Animation>( &Animation::stopY , this ) );
keys.addHandler ( '.', 0, Callback<Animation>( &Animation::roll_left , this ) );
keys.addHandler ( ',', 0, Callback<Animation>( &Animation::roll_right , this ) );
keys.addHandler ( 'r', 0, Callback<Animation>( &Animation::reset , this ) );
keys.addHandler ( 'f', 0, Callback<Animation>( &Animation::toggleLooking , this ) );
keys.addHandler ( 'n', GLUT_Port::ALT, Callback<Animation>( &Animation::toggleColorNormals , this ) );
keys.addHandler ( 'g', GLUT_Port::ALT, Callback<Animation>( &Animation::toggleGouraud , this ) );
keys.addHandler ( 's', GLUT_Port::ALT, Callback<Animation>( &Animation::toggleSolid , this ) );
keys.addHandler ( 'a', GLUT_Port::ALT, Callback<Animation>( &Animation::toggleAnimate , this ) );
update_controls< Animation >( keys );
}