From 08c14c7ca0398d792e3a2676b1afd66666674dae Mon Sep 17 00:00:00 2001 From: Kester Maddock Date: Sun, 2 May 2004 23:45:03 +0000 Subject: Mouse Wheel Support for the Game Engine. This adds "Wheel Up" and "Wheel Down" as choices to the Mouse sensor brick. --- .../GamePlayer/ghost/GPG_Application.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source/gameengine/GamePlayer/ghost/GPG_Application.cpp') diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index c33114c423a..13848cecc62 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -228,6 +228,10 @@ bool GPG_Application::processEvent(GHOST_IEvent* event) case GHOST_kEventButtonUp: handled = handleButton(event, false); break; + + case GHOST_kEventWheel: + handled = handleWheel(event); + break; case GHOST_kEventCursorMove: handled = handleCursorMove(event); @@ -562,6 +566,24 @@ void GPG_Application::exitEngine() m_engineInitialized = false; } +bool GPG_Application::handleWheel(GHOST_IEvent* event) +{ + bool handled = false; + assert(event); + if (m_mouse) + { + GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); + GHOST_TEventWheelData* wheelData = static_cast(eventData); + GPC_MouseDevice::TButtonId button; + if (wheelData->z > 0) + button = GPC_MouseDevice::buttonWheelUp; + else + button = GPC_MouseDevice::buttonWheelDown; + m_mouse->ConvertButtonEvent(button, true); + handled = true; + } + return handled; +} bool GPG_Application::handleButton(GHOST_IEvent* event, bool isDown) { -- cgit v1.2.3