Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/GamePlayer/common')
-rw-r--r--source/gameengine/GamePlayer/common/CMakeLists.txt75
-rw-r--r--source/gameengine/GamePlayer/common/GPC_Canvas.cpp168
-rw-r--r--source/gameengine/GamePlayer/common/GPC_Canvas.h147
-rw-r--r--source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp128
-rw-r--r--source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h90
-rw-r--r--source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp214
-rw-r--r--source/gameengine/GamePlayer/common/GPC_MouseDevice.h103
7 files changed, 0 insertions, 925 deletions
diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt
deleted file mode 100644
index e6c980de566..00000000000
--- a/source/gameengine/GamePlayer/common/CMakeLists.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
- .
- ../ghost
- ../../BlenderRoutines
- ../../Converter
- ../../Expressions
- ../../GameLogic
- ../../Ketsji
- ../../Network
- ../../Network/LoopBackNetwork
- ../../Physics/common
- ../../Rasterizer
- ../../Rasterizer/RAS_OpenGLRasterizer
- ../../SceneGraph
- ../../../blender
- ../../../blender/blenfont
- ../../../blender/blenkernel
- ../../../blender/blenlib
- ../../../blender/blenloader
- ../../../blender/gpu
- ../../../blender/imbuf
- ../../../blender/makesdna
- ../../../../intern/container
- ../../../../intern/ghost
- ../../../../intern/glew-mx
- ../../../../intern/guardedalloc
- ../../../../intern/string
-)
-
-set(INC_SYS
- ../../../../intern/moto/include
- ${GLEW_INCLUDE_PATH}
- ${PYTHON_INCLUDE_DIRS}
- ${PNG_INCLUDE_DIRS}
- ${ZLIB_INCLUDE_DIRS}
-)
-
-set(SRC
- GPC_Canvas.cpp
- GPC_KeyboardDevice.cpp
- GPC_MouseDevice.cpp
-
- GPC_Canvas.h
- GPC_KeyboardDevice.h
- GPC_MouseDevice.h
-)
-
-add_definitions(${GL_DEFINITIONS})
-
-blender_add_lib_nolist(ge_player_common "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
deleted file mode 100644
index 1ab64c592a4..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GamePlayer/common/GPC_Canvas.cpp
- * \ingroup player
- */
-
-
-#include "RAS_IPolygonMaterial.h"
-#include "GPC_Canvas.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_image.h"
-#include "MEM_guardedalloc.h"
-
-
-GPC_Canvas::GPC_Canvas(
- int width,
- int height
-) :
- m_width(width),
- m_height(height)
-{
- // initialize area so that it's available for game logic on frame 1 (ImageViewport)
- m_displayarea.m_x1 = 0;
- m_displayarea.m_y1 = 0;
- m_displayarea.m_x2 = width;
- m_displayarea.m_y2 = height;
- m_frame = 1;
-
- glGetIntegerv(GL_VIEWPORT, (GLint*)m_viewport);
-}
-
-
-GPC_Canvas::~GPC_Canvas()
-{
-}
-
-
-void GPC_Canvas::Resize(int width, int height)
-{
- m_width = width;
- m_height = height;
-
- // initialize area so that it's available for game logic on frame 1 (ImageViewport)
- m_displayarea.m_x1 = 0;
- m_displayarea.m_y1 = 0;
- m_displayarea.m_x2 = width;
- m_displayarea.m_y2 = height;
-}
-
-
-void GPC_Canvas::ClearColor(float r, float g, float b, float a)
-{
- ::glClearColor(r,g,b,a);
-}
-
-void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2)
-{
- /* x1 and y1 are the min pixel coordinate (e.g. 0)
- x2 and y2 are the max pixel coordinate
- the width,height is calculated including both pixels
- therefore: max - min + 1
- */
-
- /* XXX, nasty, this needs to go somewhere else,
- * but where... definitely need to clean up this
- * whole canvas/rendertools mess.
- */
- glEnable(GL_SCISSOR_TEST);
-
- m_viewport[0] = x1;
- m_viewport[1] = y1;
- m_viewport[2] = x2-x1 + 1;
- m_viewport[3] = y2-y1 + 1;
-
- glViewport(x1,y1,x2-x1 + 1,y2-y1 + 1);
- glScissor(x1,y1,x2-x1 + 1,y2-y1 + 1);
-}
-
-void GPC_Canvas::UpdateViewPort(int x1, int y1, int x2, int y2)
-{
- m_viewport[0] = x1;
- m_viewport[1] = y1;
- m_viewport[2] = x2;
- m_viewport[3] = y2;
-}
-
-const int *GPC_Canvas::GetViewPort()
-{
-#ifdef DEBUG
- // If we're in a debug build, we might as well make sure our values don't differ
- // from what the gpu thinks we have. This could lead to nasty, hard to find bugs.
- int viewport[4];
- glGetIntegerv(GL_VIEWPORT, viewport);
- assert(viewport[0] == m_viewport[0]);
- assert(viewport[1] == m_viewport[1]);
- assert(viewport[2] == m_viewport[2]);
- assert(viewport[3] == m_viewport[3]);
-#endif
-
- return m_viewport;
-}
-
-void GPC_Canvas::ClearBuffer(
- int type
-) {
-
- int ogltype = 0;
- if (type & RAS_ICanvas::COLOR_BUFFER )
- ogltype |= GL_COLOR_BUFFER_BIT;
- if (type & RAS_ICanvas::DEPTH_BUFFER )
- ogltype |= GL_DEPTH_BUFFER_BIT;
-
- ::glClear(ogltype);
-}
-
- void
-GPC_Canvas::
-MakeScreenShot(
- const char* filename
-) {
- // copy image data
- unsigned int dumpsx = GetWidth();
- unsigned int dumpsy = GetHeight();
- unsigned int *pixels = (unsigned int *)MEM_mallocN(sizeof(int) * dumpsx * dumpsy, "pixels");
-
- if (!pixels) {
- std::cout << "Cannot allocate pixels array" << std::endl;
- return;
- }
-
- glReadPixels(0, 0, dumpsx, dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
-
- // initialize image file format data
- ImageFormatData *im_format = (ImageFormatData *)MEM_mallocN(sizeof(ImageFormatData), "im_format");
- BKE_imformat_defaults(im_format);
-
- /* save_screenshot() frees dumprect and im_format */
- save_screenshot(filename, dumpsx, dumpsy, pixels, im_format);
-}
-
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h
deleted file mode 100644
index 615e3eaaf9e..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file GPC_Canvas.h
- * \ingroup player
- */
-
-#ifndef __GPC_CANVAS_H__
-#define __GPC_CANVAS_H__
-
-#include "RAS_ICanvas.h"
-#include "RAS_Rect.h"
-
-#ifdef WIN32
-# pragma warning (disable:4786) // suppress stl-MSVC debug info warning
-# include <windows.h>
-#endif /* WIN32 */
-
-#include "GPU_glew.h"
-
-#include <map>
-
-
-class GPC_Canvas : public RAS_ICanvas
-{
-protected:
-
- /** Width of the context. */
- int m_width;
- /** Height of the context. */
- int m_height;
- /** Rect that defines the area used for rendering,
- * relative to the context */
- RAS_Rect m_displayarea;
-
- int m_viewport[4];
-
-public:
-
- GPC_Canvas(int width, int height);
-
- virtual ~GPC_Canvas();
-
- void Resize(int width, int height);
-
- virtual void ResizeWindow(int width, int height) {}
-
- virtual void GetDisplayDimensions(int &width, int &height) {}
-
- /**
- * \section Methods inherited from abstract base class RAS_ICanvas.
- */
-
- int
- GetWidth(
- ) const {
- return m_width;
- }
-
- int
- GetHeight(
- ) const {
- return m_height;
- }
-
- const
- RAS_Rect &
- GetDisplayArea(
- ) const {
- return m_displayarea;
- };
-
- void
- SetDisplayArea(
- RAS_Rect *rect
- ) {
- m_displayarea= *rect;
- };
-
- RAS_Rect &
- GetWindowArea(
- ) {
- return m_displayarea;
- }
-
- void
- BeginFrame(
- ) {};
-
- /**
- * Draws overlay banners and progress bars.
- */
- void
- EndFrame(
- ) {};
-
- void SetViewPort(int x1, int y1, int x2, int y2);
- void UpdateViewPort(int x1, int y1, int x2, int y2);
- const int *GetViewPort();
-
- void ClearColor(float r, float g, float b, float a);
-
- /**
- * \section Methods inherited from abstract base class RAS_ICanvas.
- * Semantics are not yet honored.
- */
-
- void SetMouseState(RAS_MouseState mousestate)
- {
- // not yet
- }
-
- void SetMousePosition(int x, int y)
- {
- // not yet
- }
-
- virtual void MakeScreenShot(const char* filename);
-
- void ClearBuffer(int type);
-};
-
-#endif /* __GPC_CANVAS_H__ */
diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp
deleted file mode 100644
index a48540e2bdb..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp
- * \ingroup player
- */
-
-
-#include "GPC_KeyboardDevice.h"
-
-#include <cstdlib>
-
-/**
- * NextFrame toggles currentTable with previousTable,
- * and copies relevant event information from previous to current table
- * (pressed keys need to be remembered).
- */
-void GPC_KeyboardDevice::NextFrame()
-{
- SCA_IInputDevice::NextFrame();
-
- // Now convert justpressed key events into regular (active) keyevents
- int previousTable = 1-m_currentTable;
- for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++)
- {
- SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][keyevent];
- if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
- oldevent.m_status == SCA_InputEvent::KX_ACTIVE )
- {
- m_eventStatusTables[m_currentTable][keyevent] = oldevent;
- m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_ACTIVE;
- //m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
- }
- }
-}
-
-
-
-/**
- * ConvertBPEvent translates Windows keyboard events into ketsji kbd events.
- * Extra event information is stored, like ramp-mode (just released/pressed)
- */
-bool GPC_KeyboardDevice::ConvertEvent(int incode, int val, unsigned int unicode)
-{
- bool result = false;
-
- // convert event
- KX_EnumInputs kxevent = this->ToNative(incode);
-
- // only process it, if it's a key
- if (kxevent >= KX_BEGINKEY && kxevent <= KX_ENDKEY)
- {
- int previousTable = 1-m_currentTable;
-
- if (val > 0)
- {
- if (kxevent == SCA_IInputDevice::KX_ESCKEY && val != 0 && !m_hookesc)
- result = true;
-
- // todo: convert val ??
- m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //???
- m_eventStatusTables[m_currentTable][kxevent].m_unicode = unicode ;
-
- switch (m_eventStatusTables[previousTable][kxevent].m_status)
- {
- case SCA_InputEvent::KX_JUSTACTIVATED:
- case SCA_InputEvent::KX_ACTIVE:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
- break;
- }
-
- case SCA_InputEvent::KX_NO_INPUTSTATUS:
- default:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
- }
- }
-
- } else
- {
-
- switch (m_eventStatusTables[previousTable][kxevent].m_status)
- {
- case SCA_InputEvent::KX_JUSTACTIVATED:
- case SCA_InputEvent::KX_ACTIVE:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED;
- break;
- }
- default:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
- }
- }
- }
- }
- return result;
-}
-
-void GPC_KeyboardDevice::HookEscape()
-{
- m_hookesc = true;
-}
diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
deleted file mode 100644
index dc517b6ec25..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file GPC_KeyboardDevice.h
- * \ingroup player
- */
-
-#ifndef __GPC_KEYBOARDDEVICE_H__
-#define __GPC_KEYBOARDDEVICE_H__
-
-#ifdef WIN32
-#pragma warning (disable:4786)
-#endif /* WIN32 */
-
-#include "SCA_IInputDevice.h"
-
-#include <map>
-
-
-/**
- * System independent implementation of SCA_IInputDevice.
- * System dependent keyboard devices need only to inherit this class
- * and fill the m_reverseKeyTranslateTable key translation map.
- * \see SCA_IInputDevice
- */
-
-class GPC_KeyboardDevice : public SCA_IInputDevice
-{
-protected:
-
- /**
- * This map converts system dependent keyboard codes into Ketsji codes.
- * System dependent keyboard codes are stored as ints.
- */
- std::map<int, KX_EnumInputs> m_reverseKeyTranslateTable;
- short m_exitkey;
-
-public:
- bool m_hookesc;
- GPC_KeyboardDevice()
- : m_hookesc(false)
- {
- }
-
- virtual ~GPC_KeyboardDevice(void)
- {
- }
-
- virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
- {
- return false;
- }
-
- virtual void NextFrame();
-
- virtual KX_EnumInputs ToNative(int incode)
- {
- return m_reverseKeyTranslateTable[incode];
- }
-
- virtual bool ConvertEvent(int incode, int val, unsigned int unicode);
-
- virtual void HookEscape();
-};
-
-#endif /* __GPC_KEYBOARDDEVICE_H__ */
diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp
deleted file mode 100644
index df388d4f5db..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GamePlayer/common/GPC_MouseDevice.cpp
- * \ingroup player
- */
-
-
-#include "GPC_MouseDevice.h"
-
-GPC_MouseDevice::GPC_MouseDevice()
-{
-
-}
-GPC_MouseDevice::~GPC_MouseDevice()
-{
-
-}
-
-/**
- * IsPressed gives boolean information about mouse status, true if pressed, false if not.
- */
-bool GPC_MouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
-{
- const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode];
- bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
- inevent.m_status == SCA_InputEvent::KX_ACTIVE);
- return pressed;
-}
-
-
-/**
- * NextFrame toggles currentTable with previousTable,
- * and copies relevant event information from previous to current table
- * (pressed keys need to be remembered).
- */
-void GPC_MouseDevice::NextFrame()
-{
- SCA_IInputDevice::NextFrame();
-
- // Convert just pressed events into regular (active) events
- int previousTable = 1-m_currentTable;
- for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS; mouseevent++) {
- SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mouseevent];
- if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
- oldevent.m_status == SCA_InputEvent::KX_ACTIVE)
- {
- m_eventStatusTables[m_currentTable][mouseevent] = oldevent;
- m_eventStatusTables[m_currentTable][mouseevent].m_status = SCA_InputEvent::KX_ACTIVE;
- }
- }
- for (int mousemove= KX_ENDMOUSEBUTTONS; mousemove< KX_ENDMOUSE; mousemove++) {
- SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mousemove];
- m_eventStatusTables[m_currentTable][mousemove] = oldevent;
- if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
- oldevent.m_status == SCA_InputEvent::KX_ACTIVE)
- {
- m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_JUSTRELEASED;
- }
- else {
- if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) {
- m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
- }
- }
- }
-}
-
-
-bool GPC_MouseDevice::ConvertButtonEvent(TButtonId button, bool isDown)
-{
- bool result = false;
-
- switch (button)
- {
- case buttonLeft:
- result = ConvertEvent(KX_LEFTMOUSE, isDown, 0);
- break;
- case buttonMiddle:
- result = ConvertEvent(KX_MIDDLEMOUSE, isDown, 0);
- break;
- case buttonRight:
- result = ConvertEvent(KX_RIGHTMOUSE, isDown, 0);
- break;
- case buttonWheelUp:
- result = ConvertEvent(KX_WHEELUPMOUSE, isDown, 0);
- break;
- case buttonWheelDown:
- result = ConvertEvent(KX_WHEELDOWNMOUSE, isDown, 0);
- break;
- default:
- // Should not happen!
- break;
- }
-
- return result;
-}
-
-/**
- * Splits combined button and x,y cursor move events into separate Ketsji
- * x and y move and button events.
- */
-bool GPC_MouseDevice::ConvertButtonEvent(TButtonId button, bool isDown, int x, int y)
-{
- // First update state tables for cursor move.
- bool result = ConvertMoveEvent(x, y);
-
- // Now update for button state.
- if (result) {
- result = ConvertButtonEvent(button, isDown);
- }
-
- return result;
-}
-
-/**
- * Splits combined x,y move into separate Ketsji x and y move events.
- */
-bool GPC_MouseDevice::ConvertMoveEvent(int x, int y)
-{
- bool result;
-
- // Convert to local coordinates?
- result = ConvertEvent(KX_MOUSEX, x, 0);
- if (result) {
- result = ConvertEvent(KX_MOUSEY, y, 0);
- }
-
- return result;
-}
-
-
-bool GPC_MouseDevice::ConvertEvent(KX_EnumInputs kxevent, int eventval, unsigned int unicode)
-{
- bool result = true;
-
- // Only process it, if it's a mouse event
- if (kxevent > KX_BEGINMOUSE && kxevent < KX_ENDMOUSE) {
- int previousTable = 1-m_currentTable;
-
- if (eventval > 0) {
- m_eventStatusTables[m_currentTable][kxevent].m_eventval = eventval;
-
- switch (m_eventStatusTables[previousTable][kxevent].m_status)
- {
- case SCA_InputEvent::KX_ACTIVE:
- case SCA_InputEvent::KX_JUSTACTIVATED:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
- break;
- }
- case SCA_InputEvent::KX_JUSTRELEASED:
- {
- if ( kxevent > KX_BEGINMOUSEBUTTONS && kxevent < KX_ENDMOUSEBUTTONS)
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
- } else
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
-
- }
- break;
- }
- default:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
- }
- }
-
- }
- else {
- switch (m_eventStatusTables[previousTable][kxevent].m_status)
- {
- case SCA_InputEvent::KX_JUSTACTIVATED:
- case SCA_InputEvent::KX_ACTIVE:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED;
- break;
- }
- default:
- {
- m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
- }
- }
- }
- }
- else {
- result = false;
- }
- return result;
-}
diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
deleted file mode 100644
index 24922197723..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file GPC_MouseDevice.h
- * \ingroup player
- */
-
-#ifndef __GPC_MOUSEDEVICE_H__
-#define __GPC_MOUSEDEVICE_H__
-
-#ifdef WIN32
-#pragma warning (disable:4786)
-#endif /* WIN32 */
-
-#include "SCA_IInputDevice.h"
-
-
-/**
- * Generic Ketsji mouse device.
- * \see SCA_IInputDevice
- */
-class GPC_MouseDevice : public SCA_IInputDevice
-{
-public:
- /**
- * Button identifier.
- */
- typedef enum {
- buttonLeft,
- buttonMiddle,
- buttonRight,
- buttonWheelUp,
- buttonWheelDown
- } TButtonId;
-
- GPC_MouseDevice();
- virtual ~GPC_MouseDevice(void);
-
- virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
- virtual void NextFrame();
-
- /**
- * Call this routine to update the mouse device when a button state changes.
- * \param button Which button state changes.
- * \param isDown The new state of the button.
- * \return Indication as to whether the event was processed.
- */
- virtual bool ConvertButtonEvent(TButtonId button, bool isDown);
-
- /**
- * Call this routine to update the mouse device when a button state and
- * cursor position changes at the same time (e.g. in Win32 messages).
- * \param button Which button state changes.
- * \param isDown The new state of the button.
- * \param x Position x-coordinate of the cursor at the time of the state change.
- * \param y Position y-coordinate of the cursor at the time of the state change.
- * \return Indication as to whether the event was processed.
- */
- virtual bool ConvertButtonEvent(TButtonId button, bool isDown, int x, int y);
-
- /**
- * Call this routine to update the mouse device when the cursor has moved.
- * \param x Position x-coordinate of the cursor.
- * \param y Position y-coordinate of the cursor.
- * \return Indication as to whether the event was processed.
- */
- virtual bool ConvertMoveEvent(int x, int y);
-
-protected:
- /**
- * This routine converts a single mouse event to a Ketsji mouse event.
- * \param kxevent Ketsji event code.
- * \param eventval Value for this event.
- * \return Indication as to whether the event was processed.
- */
- virtual bool ConvertEvent(KX_EnumInputs kxevent, int eventval, unsigned int unicode);
-};
-
-#endif /* __GPC_MOUSEDEVICE_H__ */