From d56f5a3bc43dd978244d17902e993704da8ace5e Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Sun, 5 Jun 2016 20:55:29 +0200 Subject: MACVENTURE: Add empty event loop --- engines/macventure/macventure.cpp | 40 ++++++++++++++++++++++++++++++--------- engines/macventure/macventure.h | 6 +++++- 2 files changed, 36 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index a031513f3d..8cf6ba01cd 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -20,8 +20,7 @@ * */ -#include "common/scummsys.h" - +#include "common/system.h" #include "common/debug-channels.h" #include "common/debug.h" #include "common/error.h" @@ -52,24 +51,47 @@ MacVentureEngine::~MacVentureEngine() { Common::Error MacVentureEngine::run() { debug("MacVenture::MacVentureEngine::init()"); - initGraphics(kScreenWidth, kScreenHeight, true); - - //_screen.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); - - //_wm = new Graphics::MacWindowManager(); - //_wm->setScreen(&_screen); + initGraphics(kScreenWidth, kScreenHeight, true); - // Create debugger console. It requires GFX to be initialized _debugger = new Console(this); // Additional setup. debug("MacVentureEngine::init"); + _screen.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); + + _wm = new Graphics::MacWindowManager(); + _wm->setScreen(&_screen); + + // Your main even loop should be (invoked from) here. debug("MacVentureEngine::go: Hello, World!"); + _shouldQuit = false; + while (!_shouldQuit) { + processEvents(); + + debug("Ping"); + + g_system->updateScreen(); + g_system->delayMillis(50); + } return Common::kNoError; } +void MacVentureEngine::processEvents() { + Common::Event event; + + while (_eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_QUIT: + _shouldQuit = true; + break; + default: + break; + } + } +} + } // End of namespace MacVenture diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h index 39574943c7..ab29eedea7 100644 --- a/engines/macventure/macventure.h +++ b/engines/macventure/macventure.h @@ -59,6 +59,9 @@ public: virtual Common::Error run(); +private: + void processEvents(); + private: const ADGameDescription *_gameDescription; Common::RandomSource *_rnd; @@ -66,8 +69,9 @@ private: Console *_debugger; Graphics::MacWindowManager *_wm; - Graphics::ManagedSurface _screen; + + bool _shouldQuit; }; -- cgit v1.2.3