diff options
author | johndoe123 | 2014-03-10 17:49:08 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-07-20 06:43:33 +0000 |
commit | a06895ad594c7dd8b56bbb96993fa7af4b4e2d59 (patch) | |
tree | 5c587d91b33e77cffa3c9bd2d1f51d6557da594d | |
parent | 5833ceda4b7e6eaf77ef5c51f7a47c1c7f92add1 (diff) | |
download | scummvm-rg350-a06895ad594c7dd8b56bbb96993fa7af4b4e2d59.tar.gz scummvm-rg350-a06895ad594c7dd8b56bbb96993fa7af4b4e2d59.tar.bz2 scummvm-rg350-a06895ad594c7dd8b56bbb96993fa7af4b4e2d59.zip |
ILLUSIONS: Start with Camera and Input classes
-rw-r--r-- | engines/illusions/camera.cpp | 31 | ||||
-rw-r--r-- | engines/illusions/camera.h | 39 | ||||
-rw-r--r-- | engines/illusions/illusions.cpp | 2 | ||||
-rw-r--r-- | engines/illusions/input.cpp | 93 | ||||
-rw-r--r-- | engines/illusions/input.h | 53 | ||||
-rw-r--r-- | engines/illusions/module.mk | 2 |
6 files changed, 220 insertions, 0 deletions
diff --git a/engines/illusions/camera.cpp b/engines/illusions/camera.cpp new file mode 100644 index 0000000000..5f8b2a0e19 --- /dev/null +++ b/engines/illusions/camera.cpp @@ -0,0 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#include "illusions/camera.h" + +namespace Illusions { + +Common::Point Camera::getCurrentPan() { + return _currPan; +} + +} // End of namespace Illusions diff --git a/engines/illusions/camera.h b/engines/illusions/camera.h new file mode 100644 index 0000000000..d55ab8e33b --- /dev/null +++ b/engines/illusions/camera.h @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#ifndef ILLUSIONS_CAMERA_H +#define ILLUSIONS_CAMERA_H + +#include "common/rect.h" + +namespace Illusions { + +class Camera { +public: + Common::Point getCurrentPan(); +protected: + Common::Point _currPan; +}; + +} // End of namespace Illusions + +#endif // ILLUSIONS_CAMERA_H diff --git a/engines/illusions/illusions.cpp b/engines/illusions/illusions.cpp index d0e5b59fa7..07983030c0 100644 --- a/engines/illusions/illusions.cpp +++ b/engines/illusions/illusions.cpp @@ -23,7 +23,9 @@ #include "illusions/illusions.h" #include "illusions/resourcesystem.h" #include "illusions/backgroundresource.h" +#include "illusions/camera.h" #include "illusions/graphics.h" +#include "illusions/input.h" #include "audio/audiostream.h" #include "common/config-manager.h" diff --git a/engines/illusions/input.cpp b/engines/illusions/input.cpp new file mode 100644 index 0000000000..fd922eca0d --- /dev/null +++ b/engines/illusions/input.cpp @@ -0,0 +1,93 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#include "illusions/input.h" + +namespace Illusions { + +Input::Input() { + _buttonStates = 0; + _newButtons = 0; + // TODO? _buttonsDown = 0; + // TODO? _unk6 = 0; + _enabledButtons = 0xFFFF; + _cursorPos.x = 0; + _cursorPos.y = 0; + _prevCursorPos.x = 0; + _prevCursorPos.y = 0; + // TODO Not sure if this is still needed newTimer(40, 0, 0, Input_onTimer); +} + +void Input::processEvent(Common::Event event) { + // TODO +} + +bool Input::pollButton(uint buttons) { + if (lookButtonStates(buttons)) { + _buttonStates &= ~buttons; + return true; + } + return false; +} + +bool Input::lookButtonStates(uint buttons) { + return (buttons & (_buttonStates & _enabledButtons)) != 0; +} + +bool Input::lookNewButtons(uint buttons) { + return (buttons & (_newButtons & _enabledButtons)) != 0; +} + +void Input::setButtonState(uint buttons) { + _buttonStates |= _enabledButtons & buttons; +} + +void Input::discardButtons(uint buttons) { + _buttonStates &= ~buttons; +} + +void Input::activateButton(uint buttons) { + _enabledButtons |= buttons; + _buttonStates &= ~buttons; +} + +void Input::deactivateButton(uint buttons) { + _enabledButtons &= ~buttons; +} + +Common::Point Input::getCursorPosition() { + return _cursorPos; +} + +void Input::setCursorPosition(Common::Point mousePos) { + _prevCursorPos = _cursorPos = mousePos; +} + +Common::Point Input::getCursorDelta() { + Common::Point deltaPos; + deltaPos.x = _prevCursorPos.x - _cursorPos.x; + deltaPos.y = _prevCursorPos.y - _cursorPos.y; + _prevCursorPos = _cursorPos; + return deltaPos; +} + +} // End of namespace Illusions diff --git a/engines/illusions/input.h b/engines/illusions/input.h new file mode 100644 index 0000000000..700d9ed644 --- /dev/null +++ b/engines/illusions/input.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#ifndef ILLUSIONS_INPUT_H +#define ILLUSIONS_INPUT_H + +#include "common/events.h" +#include "common/rect.h" + +namespace Illusions { + +class Input { +public: + Input(); + void processEvent(Common::Event event); + bool pollButton(uint buttons); + bool lookButtonStates(uint buttons); + bool lookNewButtons(uint buttons); + void setButtonState(uint buttons); + void discardButtons(uint buttons); + void activateButton(uint buttons); + void deactivateButton(uint buttons); + Common::Point getCursorPosition(); + void setCursorPosition(Common::Point mousePos); + Common::Point getCursorDelta(); +protected: + uint _buttonStates, _newButtons; + uint _enabledButtons; + Common::Point _cursorPos, _prevCursorPos; +}; + +} // End of namespace Illusions + +#endif // ILLUSIONS_INPUT_H diff --git a/engines/illusions/module.mk b/engines/illusions/module.mk index 1799409f5c..bfe521b49d 100644 --- a/engines/illusions/module.mk +++ b/engines/illusions/module.mk @@ -2,9 +2,11 @@ MODULE := engines/illusions MODULE_OBJS := \ backgroundresource.o \ + camera.o \ detection.o \ graphics.o \ illusions.o \ + input.o \ resourcesystem.o # This module can be built as a plugin |