[Scummvm-git-logs] scummvm master -> cfd5d47766db93105444e900400e09b8b94da029
grisenti
noreply at scummvm.org
Tue Apr 4 21:06:35 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cfd5d47766 HPL1: remove indirection for LowLevelInput
Commit: cfd5d47766db93105444e900400e09b8b94da029
https://github.com/scummvm/scummvm/commit/cfd5d47766db93105444e900400e09b8b94da029
Author: grisenti (emanuele at grisenti.net)
Date: 2023-04-04T23:06:08+02:00
Commit Message:
HPL1: remove indirection for LowLevelInput
Changed paths:
A engines/hpl1/engine/input/LowLevelInput.cpp
R engines/hpl1/engine/impl/LowLevelInputSDL.cpp
R engines/hpl1/engine/impl/LowLevelInputSDL.h
engines/hpl1/engine/game/low_level_game_setup.cpp
engines/hpl1/engine/impl/KeyboardSDL.cpp
engines/hpl1/engine/impl/KeyboardSDL.h
engines/hpl1/engine/impl/MouseSDL.cpp
engines/hpl1/engine/impl/MouseSDL.h
engines/hpl1/engine/input/LowLevelInput.h
engines/hpl1/module.mk
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index 0a99b3c5445..e90b9cd3829 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -22,11 +22,11 @@
#include "hpl1/engine/game/low_level_game_setup.h"
#include "hpl1/engine/impl/KeyboardSDL.h"
#include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
-#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "hpl1/engine/impl/LowLevelPhysicsNewton.h"
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "hpl1/engine/impl/MouseSDL.h"
#include "hpl1/engine/impl/low_level_graphics_tgl.h"
+#include "hpl1/engine/input/LowLevelInput.h"
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/graphics.h"
@@ -48,7 +48,7 @@ static iLowLevelGraphics *createLowLevelGfx() {
LowLevelGameSetup::LowLevelGameSetup() {
_lowLevelSystem = hplNew(LowLevelSystem, ());
_lowLevelGraphics = createLowLevelGfx();
- _lowLevelInput = hplNew(cLowLevelInputSDL, (_lowLevelGraphics));
+ _lowLevelInput = hplNew(iLowLevelInput, (_lowLevelGraphics));
_lowLevelResources = hplNew(LowLevelResources, (_lowLevelGraphics));
_lowLevelSound = hplNew(cLowLevelSoundOpenAL, ());
_lowLevelPhysics = hplNew(cLowLevelPhysicsNewton, ());
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.cpp b/engines/hpl1/engine/impl/KeyboardSDL.cpp
index eb39e19fede..99dbc57eade 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.cpp
+++ b/engines/hpl1/engine/impl/KeyboardSDL.cpp
@@ -25,16 +25,16 @@
* This file is part of HPL1 Engine.
*/
-#include "hpl1/engine/impl/KeyboardSDL.h"
-
+#include "common/keyboard.h"
#include "common/system.h"
-#include "hpl1/engine/impl/LowLevelInputSDL.h"
+#include "hpl1/engine/impl/KeyboardSDL.h"
+#include "hpl1/engine/input/LowLevelInput.h"
namespace hpl {
//-----------------------------------------------------------------------
-cKeyboardSDL::cKeyboardSDL(cLowLevelInputSDL *apLowLevelInputSDL) : iKeyboard("SDL Portable Keyboard") {
+cKeyboardSDL::cKeyboardSDL(iLowLevelInput *apLowLevelInputSDL) : iKeyboard("SDL Portable Keyboard") {
_lowLevelSystem = apLowLevelInputSDL;
_downKeys.set_size(eKey_LastEnum);
diff --git a/engines/hpl1/engine/impl/KeyboardSDL.h b/engines/hpl1/engine/impl/KeyboardSDL.h
index 69e458f7ec0..89d642a3a85 100644
--- a/engines/hpl1/engine/impl/KeyboardSDL.h
+++ b/engines/hpl1/engine/impl/KeyboardSDL.h
@@ -43,11 +43,11 @@ namespace hpl {
#define MAX_KEY_PRESSES (20)
-class cLowLevelInputSDL;
+class iLowLevelInput;
class cKeyboardSDL : public iKeyboard {
public:
- cKeyboardSDL(cLowLevelInputSDL *apLowLevelInputSDL);
+ cKeyboardSDL(iLowLevelInput *apLowLevelInputSDL);
void Update();
@@ -66,7 +66,7 @@ private:
eKeyModifier _modifiers;
Common::BitArray _downKeys;
Common::Queue<cKeyPress> _pressedKeys;
- cLowLevelInputSDL *_lowLevelSystem;
+ iLowLevelInput *_lowLevelSystem;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.h b/engines/hpl1/engine/impl/LowLevelInputSDL.h
deleted file mode 100644
index 1e8a8eef1e4..00000000000
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_LOWLEVELINPUT_SDL_H
-#define HPL_LOWLEVELINPUT_SDL_H
-
-#include "common/array.h"
-#include "common/events.h"
-#include "hpl1/engine/input/LowLevelInput.h"
-
-namespace hpl {
-
-class iLowLevelGraphics;
-class iMouse;
-class iKeyboard;
-
-class cLowLevelInputSDL : public iLowLevelInput {
- friend class cKeyboardSDL;
- friend class cMouseSDL;
-
-public:
- cLowLevelInputSDL(iLowLevelGraphics *apLowLevelGraphics);
- ~cLowLevelInputSDL();
-
- void LockInput(bool abX);
-
- void BeginInputUpdate();
- void EndInputUpdate();
-
- iMouse *CreateMouse();
- iKeyboard *CreateKeyboard();
-
-private:
- Common::Array<Common::Event> _events;
- iLowLevelGraphics *_lowLevelGraphics;
-};
-
-} // namespace hpl
-
-#endif // HPL_LOWLEVELINPUT_SDL_H
diff --git a/engines/hpl1/engine/impl/MouseSDL.cpp b/engines/hpl1/engine/impl/MouseSDL.cpp
index 76e61382940..e238afe950a 100644
--- a/engines/hpl1/engine/impl/MouseSDL.cpp
+++ b/engines/hpl1/engine/impl/MouseSDL.cpp
@@ -25,12 +25,12 @@
* This file is part of HPL1 Engine.
*/
-#include "hpl1/engine/impl/MouseSDL.h"
#include "common/bitarray.h"
#include "common/events.h"
#include "hpl1/engine/graphics/LowLevelGraphics.h"
-#include "hpl1/engine/impl/LowLevelInputSDL.h"
+#include "hpl1/engine/impl/MouseSDL.h"
#include "hpl1/engine/input/InputTypes.h"
+#include "hpl1/engine/input/LowLevelInput.h"
namespace hpl {
@@ -40,7 +40,7 @@ namespace hpl {
//-----------------------------------------------------------------------
-cMouseSDL::cMouseSDL(cLowLevelInputSDL *apLowLevelInputSDL, iLowLevelGraphics *apLowLevelGraphics) : iMouse("SDL Portable Mouse") {
+cMouseSDL::cMouseSDL(iLowLevelInput *apLowLevelInputSDL, iLowLevelGraphics *apLowLevelGraphics) : iMouse("SDL Portable Mouse") {
mfMaxPercent = 0.7f;
mfMinPercent = 0.1f;
mlBufferSize = 6;
diff --git a/engines/hpl1/engine/impl/MouseSDL.h b/engines/hpl1/engine/impl/MouseSDL.h
index 6069e5b82eb..15eb1c6651f 100644
--- a/engines/hpl1/engine/impl/MouseSDL.h
+++ b/engines/hpl1/engine/impl/MouseSDL.h
@@ -38,11 +38,11 @@ struct Event;
namespace hpl {
class iLowLevelGraphics;
-class cLowLevelInputSDL;
+class iLowLevelInput;
class cMouseSDL : public iMouse {
public:
- cMouseSDL(cLowLevelInputSDL *apLowLevelInputSDL, iLowLevelGraphics *apLowLevelGraphics);
+ cMouseSDL(iLowLevelInput *apLowLevelInputSDL, iLowLevelGraphics *apLowLevelGraphics);
bool ButtonIsDown(eMButton);
@@ -80,7 +80,7 @@ private:
float mfMaxPercent;
float mfMinPercent;
int mlBufferSize;
- cLowLevelInputSDL *_lowLevelInputSDL;
+ iLowLevelInput *_lowLevelInputSDL;
iLowLevelGraphics *_lowLevelGraphics;
};
diff --git a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp b/engines/hpl1/engine/input/LowLevelInput.cpp
similarity index 81%
rename from engines/hpl1/engine/impl/LowLevelInputSDL.cpp
rename to engines/hpl1/engine/input/LowLevelInput.cpp
index 952a98d9ca4..32de3d5eb4f 100644
--- a/engines/hpl1/engine/impl/LowLevelInputSDL.cpp
+++ b/engines/hpl1/engine/input/LowLevelInput.cpp
@@ -25,36 +25,31 @@
* This file is part of HPL1 Engine.
*/
-#include "hpl1/engine/impl/LowLevelInputSDL.h"
#include "common/events.h"
#include "common/system.h"
#include "hpl1/engine/impl/KeyboardSDL.h"
#include "hpl1/engine/impl/MouseSDL.h"
+#include "hpl1/engine/input/LowLevelInput.h"
#include "hpl1/engine/system/low_level_system.h"
namespace hpl {
//-----------------------------------------------------------------------
-cLowLevelInputSDL::cLowLevelInputSDL(iLowLevelGraphics *apLowLevelGraphics) {
+iLowLevelInput::iLowLevelInput(iLowLevelGraphics *apLowLevelGraphics) {
_lowLevelGraphics = apLowLevelGraphics;
LockInput(true);
}
//-----------------------------------------------------------------------
-cLowLevelInputSDL::~cLowLevelInputSDL() {
-}
-
-//-----------------------------------------------------------------------
-
-void cLowLevelInputSDL::LockInput(bool abX) {
+void iLowLevelInput::LockInput(bool abX) {
g_system->lockMouse(abX);
}
//-----------------------------------------------------------------------
-void cLowLevelInputSDL::BeginInputUpdate() {
+void iLowLevelInput::BeginInputUpdate() {
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
_events.push_back(event);
@@ -63,19 +58,19 @@ void cLowLevelInputSDL::BeginInputUpdate() {
//-----------------------------------------------------------------------
-void cLowLevelInputSDL::EndInputUpdate() {
+void iLowLevelInput::EndInputUpdate() {
_events.clear();
}
//-----------------------------------------------------------------------
-iMouse *cLowLevelInputSDL::CreateMouse() {
+iMouse *iLowLevelInput::CreateMouse() {
return hplNew(cMouseSDL, (this, _lowLevelGraphics));
}
//-----------------------------------------------------------------------
-iKeyboard *cLowLevelInputSDL::CreateKeyboard() {
+iKeyboard *iLowLevelInput::CreateKeyboard() {
return hplNew(cKeyboardSDL, (this));
}
diff --git a/engines/hpl1/engine/input/LowLevelInput.h b/engines/hpl1/engine/input/LowLevelInput.h
index 956c6aa83e3..632e09c244a 100644
--- a/engines/hpl1/engine/input/LowLevelInput.h
+++ b/engines/hpl1/engine/input/LowLevelInput.h
@@ -28,32 +28,42 @@
#ifndef HPL_LOWLEVELINPUT_H
#define HPL_LOWLEVELINPUT_H
+#include "common/array.h"
+#include "common/events.h"
+
namespace hpl {
class iMouse;
class iKeyboard;
+class iLowLevelGraphics;
class iLowLevelInput {
-public:
- virtual ~iLowLevelInput() {}
+ friend class cKeyboardSDL;
+ friend class cMouseSDL;
+public:
+ iLowLevelInput(iLowLevelGraphics *graphics);
/**
* Lock all input to current window.
* \param abX
* \return
*/
- virtual void LockInput(bool abX) = 0;
+ void LockInput(bool abX);
/**
* Called by cInput
*/
- virtual void BeginInputUpdate() = 0;
+ void BeginInputUpdate();
/**
* called by cInput
*/
- virtual void EndInputUpdate() = 0;
+ void EndInputUpdate();
+
+ iMouse *CreateMouse();
+ iKeyboard *CreateKeyboard();
- virtual iMouse *CreateMouse() = 0;
- virtual iKeyboard *CreateKeyboard() = 0;
+private:
+ Common::Array<Common::Event> _events;
+ iLowLevelGraphics *_lowLevelGraphics;
};
} // namespace hpl
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index dba26c179ee..a288ab53f74 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -95,7 +95,6 @@ MODULE_OBJS := \
engine/impl/CollideShapeNewton.o \
engine/impl/KeyboardSDL.o \
engine/impl/LowLevelGraphicsSDL.o \
- engine/impl/LowLevelInputSDL.o \
engine/impl/LowLevelPhysicsNewton.o \
engine/impl/LowLevelSoundOpenAL.o \
engine/impl/MeshLoaderCollada.o \
@@ -131,6 +130,7 @@ MODULE_OBJS := \
engine/input/Input.o \
engine/input/InputDevice.o \
engine/input/Keyboard.o \
+ engine/input/LowLevelInput.o \
engine/input/Mouse.o \
engine/math/BoundingVolume.o \
engine/math/Frustum.o \
More information about the Scummvm-git-logs
mailing list