本文整理汇总了C++中common::EventManager类的典型用法代码示例。如果您正苦于以下问题:C++ EventManager类的具体用法?C++ EventManager怎么用?C++ EventManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: handleEvents
void BladeRunnerEngine::handleEvents() {
if (shouldQuit()) {
_gameIsRunning = false;
return;
}
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYUP:
handleKeyUp(event);
break;
case Common::EVENT_KEYDOWN:
handleKeyDown(event);
break;
case Common::EVENT_LBUTTONUP:
handleMouseAction(event.mouse.x, event.mouse.y, true, false);
break;
case Common::EVENT_RBUTTONUP:
case Common::EVENT_MBUTTONUP:
handleMouseAction(event.mouse.x, event.mouse.y, false, false);
break;
case Common::EVENT_LBUTTONDOWN:
handleMouseAction(event.mouse.x, event.mouse.y, true, true);
break;
case Common::EVENT_RBUTTONDOWN:
case Common::EVENT_MBUTTONDOWN:
handleMouseAction(event.mouse.x, event.mouse.y, false, true);
break;
default:
; // nothing to do
}
}
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:35,代码来源:bladerunner.cpp
示例2: showMainMenu
TestExitStatus EventTests::showMainMenu() {
Testsuite::clearScreen();
Common::String info = "Testing Main Menu events.\n "
"Main Menu event is normally trigerred by user pressing (Ctrl + f5).\n"
"Click 'resume'(the topmost button) to continue testbed.";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Main Menu\n");
return kTestSkipped;
}
Common::EventManager *eventMan = g_system->getEventManager();
Common::Event mainMenuEvent;
mainMenuEvent.type = Common::EVENT_MAINMENU;
eventMan->pushEvent(mainMenuEvent);
TestExitStatus passed = kTestPassed;
if (Testsuite::handleInteractiveInput("Were you able to see a main menu widget?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Event MAINMENU failed");
passed = kTestFailed;
}
return passed;
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:25,代码来源:events.cpp
示例3: keystrokeToChar
char EventTests::keystrokeToChar() {
Common::EventManager *eventMan = g_system->getEventManager();
bool quitLoop = false;
Common::Event event;
// handle all keybd events
while (!quitLoop) {
while (eventMan->pollEvent(event)) {
// Quit if explicitly requested!
if (Engine::shouldQuit()) {
return 0;
}
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
return 0;
}
for (int i = 0; i < ARRAYSIZE(keyCodeLUT); i++) {
if (event.kbd.keycode == keyCodeLUT[i].code) {
return keyCodeLUT[i].value;
}
}
break;
default:
break; // Ignore other events
}
}
}
return 0;
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:32,代码来源:events.cpp
示例4: processVideoEvents
void VideoPlayer::processVideoEvents(Common::List<Common::Event> &stopEvents) {
Common::Event curEvent;
Common::EventManager *eventMan = g_system->getEventManager();
// Process events, and skip video if esc is pressed
while (eventMan->pollEvent(curEvent)) {
if (curEvent.type == Common::EVENT_RTL || curEvent.type == Common::EVENT_QUIT) {
_skipVideo = true;
}
for (Common::List<Common::Event>::const_iterator iter = stopEvents.begin(); iter != stopEvents.end(); iter++) {
if (curEvent.type == iter->type) {
if (iter->type == Common::EVENT_KEYDOWN || iter->type == Common::EVENT_KEYUP) {
if (curEvent.kbd.keycode == iter->kbd.keycode) {
_skipVideo = true;
break;
}
} else {
_skipVideo = true;
break;
}
}
}
}
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:25,代码来源:video_player.cpp
示例5: escDelay
bool Intro::escDelay(uint32 msecs) {
Common::EventManager *eventMan = _system->getEventManager();
Common::Event event;
if (_relDelay == 0) // first call, init with system time
_relDelay = (int32)_system->getMillis();
_relDelay += msecs; // now wait until _system->getMillis() >= _relDelay
int32 nDelay = 0;
do {
while (eventMan->pollEvent(event)) {
if (event.type == Common::EVENT_KEYDOWN) {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
return false;
} else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL) {
return false;
}
}
nDelay = _relDelay - _system->getMillis();
if (nDelay < 0)
nDelay = 0;
else if (nDelay > 20)
nDelay = 20;
_system->delayMillis(nDelay);
_skyScreen->processSequence();
_system->updateScreen();
} while (nDelay == 20);
return true;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:33,代码来源:intro.cpp
示例6: waitForMusicToPlay
void MidiTests::waitForMusicToPlay(MidiParser *parser) {
Common::EventManager *eventMan = g_system->getEventManager();
bool quitLoop = false;
Common::Event event;
CursorMan.showMouse(true);
while (!quitLoop) {
while (eventMan->pollEvent(event)) {
// Quit if explicitly requested!
if (Engine::shouldQuit()) {
return;
}
if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_RBUTTONDOWN) {
quitLoop = true;
} else {
Testsuite::writeOnScreen("Playing Midi Music, Click to end", Common::Point(0, 100));
if (!parser->isPlaying()) {
quitLoop = true;
}
}
}
}
CursorMan.showMouse(false);
return;
}
开发者ID:Termimad,项目名称:scummvm,代码行数:26,代码来源:midi.cpp
示例7: handleNextFrame
void MoviePlayer::handleNextFrame() {
Common::Event event;
Common::EventManager *eventMan = _vm->_system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
_leftButtonDown = true;
_rightButtonDown = true;
} else if (event.kbd.keycode == Common::KEYCODE_PAUSE) {
_vm->pause();
}
break;
case Common::EVENT_LBUTTONDOWN:
_leftButtonDown = true;
break;
case Common::EVENT_RBUTTONDOWN:
_rightButtonDown = true;
break;
case Common::EVENT_LBUTTONUP:
_leftButtonDown = false;
break;
case Common::EVENT_RBUTTONUP:
_rightButtonDown = false;
break;
default:
break;
}
}
if (_leftButtonDown && _rightButtonDown && !_vm->getBitFlag(41)) {
_skipMovie = true;
_mixer->stopHandle(_bgSound);
}
}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:35,代码来源:animation.cpp
示例8: mainLoop
void NeverhoodEngine::mainLoop() {
uint32 nextFrameTime = 0;
while (!shouldQuit()) {
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) {
// Open debugger console
_console->attach();
continue;
}
_gameModule->handleKeyDown(event.kbd.keycode);
_gameModule->handleAsciiKey(event.kbd.ascii);
break;
case Common::EVENT_KEYUP:
break;
case Common::EVENT_MOUSEMOVE:
_mouseX = event.mouse.x;
_mouseY = event.mouse.y;
_gameModule->handleMouseMove(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
_gameModule->handleMouseDown(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
_gameModule->handleMouseUp(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_WHEELUP:
_gameModule->handleWheelUp();
break;
case Common::EVENT_WHEELDOWN:
_gameModule->handleWheelDown();
break;
default:
break;
}
}
if (_system->getMillis() >= nextFrameTime) {
_gameModule->checkRequests();
_gameModule->handleUpdate();
_gameModule->draw();
_console->onFrame();
_screen->update();
if (_updateSound)
_soundMan->update();
nextFrameTime = _screen->getNextFrameTime();
};
_audioResourceMan->updateMusic();
_system->updateScreen();
_system->delayMillis(10);
}
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:58,代码来源:neverhood.cpp
示例9: use
void Journal::use() {
BobSlot *joe = _vm->graphics()->bob(0);
_prevJoeX = joe->x;
_prevJoeY = joe->y;
_panelMode = PM_NORMAL;
_system = g_system;
_panelTextCount = 0;
memset(_panelTextY, 0, sizeof(_panelTextY));
memset(&_textField, 0, sizeof(_textField));
memset(_saveDescriptions, 0, sizeof(_saveDescriptions));
_vm->findGameStateDescriptions(_saveDescriptions);
setup();
redraw();
update();
_vm->display()->palFadeIn(ROOM_JOURNAL);
_quitMode = QM_LOOP;
while (_quitMode == QM_LOOP) {
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
handleKeyDown(event.kbd.ascii, event.kbd.keycode);
break;
case Common::EVENT_LBUTTONDOWN:
handleMouseDown(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_WHEELUP:
handleMouseWheel(-1);
break;
case Common::EVENT_WHEELDOWN:
handleMouseWheel(1);
break;
case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return;
default:
break;
}
}
_system->delayMillis(20);
_system->updateScreen();
}
_vm->writeOptionSettings();
_vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1);
_vm->graphics()->putCameraOnBob(0);
if (_quitMode == QM_CONTINUE) {
continueGame();
}
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:57,代码来源:journal.cpp
示例10: updateEvents
void DrasculaEngine::updateEvents() {
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
updateMusic();
#ifdef _WIN32_WCE
if (eventMan->pollEvent(event)) {
#else
while (eventMan->pollEvent(event)) {
#endif
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
// Start the debugger
getDebugger()->attach();
getDebugger()->onFrame();
}
addKeyToBuffer(event.kbd);
break;
case Common::EVENT_KEYUP:
break;
case Common::EVENT_MOUSEMOVE:
_mouseX = event.mouse.x;
_mouseY = event.mouse.y;
break;
case Common::EVENT_LBUTTONDOWN:
_leftMouseButton = 1;
break;
case Common::EVENT_LBUTTONUP:
_leftMouseButton = 0;
break;
case Common::EVENT_RBUTTONDOWN:
// We changed semantic and react only on button up event
break;
case Common::EVENT_RBUTTONUP:
_rightMouseButton = 1;
break;
default:
break;
}
}
}
void DrasculaEngine::delay(int ms) {
uint32 end = _system->getMillis() + ms * 2; // originally was 1
do {
_system->delayMillis(10);
updateEvents();
_system->updateScreen();
} while (_system->getMillis() < end && !shouldQuit());
}
开发者ID:DieInGame,项目名称:scummvm,代码行数:53,代码来源:drascula.cpp
示例11: handleEvents
void MadeEngine::handleEvents() {
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
// NOTE: Don't reset _eventNum to 0 here or no events will get through to the scripts.
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_MOUSEMOVE:
_eventMouseX = event.mouse.x;
_eventMouseY = event.mouse.y;
break;
case Common::EVENT_LBUTTONDOWN:
_eventNum = 2;
break;
case Common::EVENT_LBUTTONUP:
_eventNum = 1;
break;
case Common::EVENT_RBUTTONDOWN:
_eventNum = 4;
break;
case Common::EVENT_RBUTTONUP:
_eventNum = 3;
break;
case Common::EVENT_KEYDOWN:
_eventKey = event.kbd.ascii;
// For unknown reasons, the game accepts ASCII code
// 9 as backspace
if (_eventKey == Common::KEYCODE_BACKSPACE)
_eventKey = 9;
_eventNum = 5;
break;
default:
break;
}
}
AudioCD.updateCD();
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:49,代码来源:made.cpp
示例12: manageEvents
void manageEvents() {
Common::EventManager *eventMan = g_system->getEventManager();
uint32 nextFrame = g_system->getMillis() + g_cine->getTimerDelay();
do {
Common::Event event;
while (eventMan->pollEvent(event)) {
processEvent(event);
}
g_system->updateScreen();
g_system->delayMillis(20);
} while (g_system->getMillis() < nextFrame);
mouseData.left = mouseLeft;
mouseData.right = mouseRight;
}
开发者ID:CatalystG,项目名称:scummvm,代码行数:16,代码来源:main_loop.cpp
示例13: mainLoop
void NeverhoodEngine::mainLoop() {
uint32 nextFrameTime = 0;
while (!shouldQuit()) {
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
_gameModule->handleKeyDown(event.kbd.keycode);
_gameModule->handleAsciiKey(event.kbd.ascii);
break;
case Common::EVENT_KEYUP:
break;
case Common::EVENT_MOUSEMOVE:
_mouseX = event.mouse.x;
_mouseY = event.mouse.y;
_gameModule->handleMouseMove(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
_gameModule->handleMouseDown(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
_gameModule->handleMouseUp(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_QUIT:
_system->quit();
break;
default:
break;
}
}
if (_system->getMillis() >= nextFrameTime) {
_gameModule->checkRequests();
_gameModule->handleUpdate();
_gameModule->draw();
_screen->update();
nextFrameTime = _screen->getNextFrameTime();
};
_soundMan->update();
_audioResourceMan->updateMusic();
_system->updateScreen();
_system->delayMillis(10);
}
}
开发者ID:alcherk,项目名称:scummvm,代码行数:46,代码来源:neverhood.cpp
示例14: mainLoop
void VirtualKeyboardGUI::mainLoop() {
Common::EventManager *eventMan = _system->getEventManager();
while (_displaying) {
if (_kbd->_keyQueue.hasStringChanged())
updateDisplay();
animateCaret();
animateCursor();
redraw();
_system->updateScreen();
Common::Event event;
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_LBUTTONDOWN:
if (_kbdBound.contains(event.mouse)) {
_kbd->handleMouseDown(event.mouse.x - _kbdBound.left,
event.mouse.y - _kbdBound.top);
}
break;
case Common::EVENT_LBUTTONUP:
if (_kbdBound.contains(event.mouse)) {
_kbd->handleMouseUp(event.mouse.x - _kbdBound.left,
event.mouse.y - _kbdBound.top);
}
break;
case Common::EVENT_MOUSEMOVE:
if (_drag)
move(event.mouse.x - _dragPoint.x,
event.mouse.y - _dragPoint.y);
break;
case Common::EVENT_SCREEN_CHANGED:
screenChanged();
break;
case Common::EVENT_QUIT:
_system->quit();
return;
default:
break;
}
}
// Delay for a moment
_system->delayMillis(10);
}
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:44,代码来源:virtual-keyboard-gui.cpp
示例15: play
// TODO: this method will probably go away and be integrated in the main loop
void Animation::play() {
Common::EventManager *eventMan = g_system->getEventManager();
while (!hasEnded() && !Engine::shouldQuit()) {
process();
if (_changed) {
// Create a temporary surface to merge the overlay with the background
Graphics::Surface *s = new Graphics::Surface;
s->create(640, 480, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
draw(s);
// XXX: Update the screen
g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
// Free the temporary surface
s->free();
delete s;
_changed = false;
}
g_system->updateScreen();
//FIXME: implement subtitles
g_system->delayMillis(20);
// Handle right-click to interrupt animations
Common::Event ev = Common::Event();
while (eventMan->pollEvent(ev)) {
if (ev.type == Common::EVENT_RBUTTONUP) {
// Stop audio
if (_audio)
_audio->finish();
// TODO start LNK file sound?
return;
}
}
}
}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:42,代码来源:animation.cpp
示例16: handleInput
bool MoviePlayer::handleInput() {
Common::Event event;
Common::EventManager *eventMan = g_system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
return false;
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
return false;
case Common::EVENT_QUIT:
_vm->quitGame();
return false;
default:
break;
}
}
return !_vm->shouldQuit();
}
开发者ID:mokerjoke,项目名称:scummvm,代码行数:21,代码来源:movie.cpp
示例17: showSplashScreen
void CineEngine::showSplashScreen() {
Common::File file;
if (!file.open("sony.lbm"))
return;
Image::IFFDecoder decoder;
if (!decoder.loadStream(file))
return;
const Graphics::Surface *surface = decoder.getSurface();
if (surface->getWidth() == 640 && surface->getHeight() == 480) {
initGraphics(640, 480, true);
const byte *palette = decoder.getPalette();
int paletteColorCount = decoder.getPaletteColorCount();
g_system->getPaletteManager()->setPalette(palette, 0, paletteColorCount);
g_system->copyRectToScreen(surface->getPixels(), 640, 0, 0, 640, 480);
g_system->updateScreen();
Common::EventManager *eventMan = g_system->getEventManager();
bool done = false;
uint32 now = g_system->getMillis();
while (!done && g_system->getMillis() - now < 2000) {
Common::Event event;
while (eventMan->pollEvent(event)) {
if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
done = true;
break;
}
if (shouldQuit())
done = true;
}
}
}
decoder.destroy();
}
开发者ID:project-cabal,项目名称:cabal,代码行数:40,代码来源:cine.cpp
示例18: handleEvents
void MenuSystem::handleEvents() {
Common::Event event;
Common::EventManager *eventMan = _vm->_system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
handleKeyDown(event.kbd);
break;
case Common::EVENT_QUIT:
_running = false;
break;
case Common::EVENT_MOUSEMOVE:
handleMouseMove(event.mouse.x, event.mouse.y);
break;
case Common::EVENT_LBUTTONUP:
handleMouseClick(event.mouse.x, event.mouse.y);
break;
default:
break;
}
}
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:22,代码来源:menu.cpp
示例19: handleInput
bool MoviePlayer::handleInput() {
Common::Event event;
Common::EventManager *eventMan = g_system->getEventManager();
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
return false;
if (event.kbd.keycode == Common::KEYCODE_F10) {
// TODO: The original would bring up a stripped down
// main menu dialog, without the save/restore options.
}
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
return false;
case Common::EVENT_QUIT:
return false;
default:
break;
}
}
return !_vm->shouldQuit();
}
开发者ID:olegtc,项目名称:scummvm,代码行数:24,代码来源:movie.cpp
示例20: shouldQuit
bool Engine::shouldQuit() {
Common::EventManager *eventMan = g_system->getEventManager();
return (eventMan->shouldQuit() || eventMan->shouldRTL());
}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:4,代码来源:engine.cpp
注:本文中的common::EventManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论