本文整理汇总了C++中EventHandler::createEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ EventHandler::createEvent方法的具体用法?C++ EventHandler::createEvent怎么用?C++ EventHandler::createEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventHandler
的用法示例。
在下文中一共展示了EventHandler::createEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testEventHandler
void testEventHandler() {
EventHandler *handler = new EventHandler();
//handler->createEvent(&testObjectTOP, 0);
EventHandle *handle1 = handler->createEvent(&testObjectMID, 2);
handle1->setRecurrences(6); // "Times" to happen
handle1->setPeriod(100); // period in milliseconds
EventHandle *handle = handler->createEvent(&testObjectBOT, 1);
handle->setRecurrences(3);
handle->setPeriod(100);
// add a single event
EventHandle *handlex = handler->createEvent(&testObjectSingle, 0);
handlex->setRecurrences(200);
handlex->setPeriod(10);
handlex->arg1 = (void*)"aaa";
// slower single event
EventHandle *handlex2 = handler->createEvent(&testObjectSingle, 0);
handlex2->setRecurrences(5);
handlex2->setPeriod(1000);
handlex2->arg1 = (void*)"bbb";
while(!handler->isEmpty()) {
handler->handleEvents();
}
}