本文整理汇总了C++中EventHandler::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ EventHandler::connect方法的具体用法?C++ EventHandler::connect怎么用?C++ EventHandler::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventHandler
的用法示例。
在下文中一共展示了EventHandler::connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeNode
void TutorialApp::makeNode()
{
#if defined( CINDER_COCOA_TOUCH )
const float dMax = 220.0f;
const float d = randFloat( 28.0f, dMax );
float r = 11.0f;
#else
const float dMax = 400.0f;
const float d = randFloat( 50.0f, dMax );
float r = 20.0f;
#endif
r += ( 1.0f - ( d / dMax ) ) * r * 2.0f;
UiTree& node = mUiTree.createAndReturnChild()
.collisionType( UiTree::CollisionType_Circle )
.data( UiData()
.color( randColor() )
.distance( d )
.speed( randFloat( -1.0f, 1.0f ) )
)
.enable()
.scale( vec2( r ) );
/*
* To improve performance and stability of your app
*/
mIdBatchMap[ node.getId() ] = randBatch();
/*
* While inline anonymous functions are useful for
* quick sketching, it's better to use an event handler
* instance for callbacks. It routes everything back into
* fewer places and helps organize your code.
*/
mEventHandler.connect( node );
}