本文整理汇总了C++中common::EventManager::getKeymapper方法的典型用法代码示例。如果您正苦于以下问题:C++ EventManager::getKeymapper方法的具体用法?C++ EventManager::getKeymapper怎么用?C++ EventManager::getKeymapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::EventManager
的用法示例。
在下文中一共展示了EventManager::getKeymapper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runLoop
void GuiManager::runLoop() {
Dialog *activeDialog = getTopDialog();
bool didSaveState = false;
int button;
uint32 time;
if (activeDialog == 0)
return;
if (!_stateIsSaved) {
saveState();
_theme->enable();
didSaveState = true;
_useStdCursor = !_theme->ownCursor();
if (_useStdCursor)
setupCursor();
// _theme->refresh();
_redrawStatus = kRedrawFull;
redraw();
}
Common::EventManager *eventMan = _system->getEventManager();
uint32 lastRedraw = 0;
const uint32 waitTime = 1000 / 45;
#ifdef ENABLE_KEYMAPPER
// Due to circular reference with event manager and GUI
// we cannot init keymap on the GUI creation. Thus, let's
// try to do it on every launch, checking whether the
// map is already existing
initKeymap();
eventMan->getKeymapper()->pushKeymap("gui");
#endif
while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
redraw();
// Don't "tickle" the dialog until the theme has had a chance
// to re-allocate buffers in case of a scaler change.
activeDialog->handleTickle();
if (_useStdCursor)
animateCursor();
// _theme->updateScreen();
// _system->updateScreen();
if (lastRedraw + waitTime < _system->getMillis()) {
_theme->updateScreen();
_system->updateScreen();
lastRedraw = _system->getMillis();
}
Common::Event event;
while (eventMan->pollEvent(event)) {
// The top dialog can change during the event loop. In that case, flush all the
// dialog-related events since they were probably generated while the old dialog
// was still visible, and therefore not intended for the new one.
//
// This hopefully fixes strange behaviour/crashes with pop-up widgets. (Most easily
// triggered in 3x mode or when running ScummVM under Valgrind.)
if (activeDialog != getTopDialog() && event.type != Common::EVENT_SCREEN_CHANGED)
continue;
Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y);
if (lastRedraw + waitTime < _system->getMillis()) {
_theme->updateScreen();
_system->updateScreen();
lastRedraw = _system->getMillis();
}
switch (event.type) {
case Common::EVENT_KEYDOWN:
activeDialog->handleKeyDown(event.kbd);
break;
case Common::EVENT_KEYUP:
activeDialog->handleKeyUp(event.kbd);
break;
case Common::EVENT_MOUSEMOVE:
activeDialog->handleMouseMoved(mouse.x, mouse.y, 0);
break;
// We don't distinguish between mousebuttons (for now at least)
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
button = (event.type == Common::EVENT_LBUTTONDOWN ? 1 : 2);
time = _system->getMillis();
if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay)
&& ABS(_lastClick.x - event.mouse.x) < 3
&& ABS(_lastClick.y - event.mouse.y) < 3) {
_lastClick.count++;
} else {
_lastClick.x = event.mouse.x;
_lastClick.y = event.mouse.y;
_lastClick.count = 1;
//.........这里部分代码省略.........