Integrate touch related development. (#90)

* * Add BuildActionIntention crap

* * Set Client and World projects to use MP compilation

* asd

* * Use the new BuildActionIntention to break and place blocks.

* * Reverse engineer the IArea system.

* * Copy break logic from survival into creative conditionally

* * Reverse IBuildInput and MouseHandler
* Replace the new relative paths in the client project with $(MC_ROOT) again

* * Reverse Multitouch, MouseDevice

* * Reverse a bunch of auxiliary classes for input.

* * Use CustomInputHolder instead of holding inputs manually.

* * Reverse a whole BUNCH of things!

* * Add feedback textures to the gitignore.

* * D-pad now renders! Also loads of other work.

* * More Stuff

* * Finish touch control bug fixing.

* * Finalize work.

* * One last thing..

* * Add a "cramped" mode to the options screen and start menu.

* * Oh, forgot to do something
This commit is contained in:
iProgramInCpp
2023-11-02 00:49:11 +02:00
committed by GitHub
parent 98d6b4e5e8
commit 60b21356a1
87 changed files with 3439 additions and 916 deletions

View File

@@ -11,6 +11,8 @@
#include <sstream>
#include <shlobj.h>
#include "GameMods.hpp"
#include "AppPlatform_win32.hpp"
#include "LoggerWin32.hpp"
@@ -190,6 +192,11 @@ Texture AppPlatform_win32::loadTexture(const std::string& str, bool b)
return Texture(width, height, img2, 1, 0);
}
bool AppPlatform_win32::isTouchscreen()
{
return false;
}
bool AppPlatform_win32::hasFileSystemAccess()
{
return true;
@@ -317,36 +324,36 @@ void AppPlatform_win32::updateFocused(bool focused)
setMouseGrabbed(m_bGrabbedMouse);
}
Mouse::ButtonType AppPlatform_win32::GetMouseButtonType(UINT iMsg)
MouseButtonType AppPlatform_win32::GetMouseButtonType(UINT iMsg)
{
switch (iMsg)
{
case WM_LBUTTONUP:
case WM_LBUTTONDOWN:
return Mouse::ButtonType::LEFT;
return BUTTON_LEFT;
case WM_RBUTTONUP:
case WM_RBUTTONDOWN:
return Mouse::ButtonType::RIGHT;
return BUTTON_RIGHT;
case WM_MBUTTONUP:
case WM_MBUTTONDOWN:
return Mouse::ButtonType::MIDDLE;
return BUTTON_MIDDLE;
case WM_MOUSEWHEEL:
return Mouse::ButtonType::SCROLLWHEEL;
return BUTTON_SCROLLWHEEL;
default:
return Mouse::ButtonType::NONE;
return BUTTON_NONE;
}
}
Mouse::ButtonState AppPlatform_win32::GetMouseButtonState(UINT iMsg, WPARAM wParam)
bool AppPlatform_win32::GetMouseButtonState(UINT iMsg, WPARAM wParam)
{
Mouse::ButtonState result;
bool result;
switch (iMsg)
{
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
result = Mouse::ButtonState::DOWN;
result = true;
break;
case WM_MOUSEWHEEL:
{
@@ -354,17 +361,17 @@ Mouse::ButtonState AppPlatform_win32::GetMouseButtonState(UINT iMsg, WPARAM wPar
if (wheelDelta > 0)
{
// "A positive value indicates that the wheel was rotated forward, away from the user."
result = Mouse::ButtonState::UP;
result = false;
}
else
{
// "A negative value indicates that the wheel was rotated backward, toward the user."
result = Mouse::ButtonState::DOWN;
result = true;
}
break;
}
default:
result = Mouse::ButtonState::UP;
result = false;
break;
}

View File

@@ -37,6 +37,9 @@ public:
std::string getDateString(int time) override;
Texture loadTexture(const std::string& str, bool b) override;
// From v0.1.1. Also add these to determine touch screen use within the game.
bool isTouchscreen() override;
// Also add these to allow proper turning within the game.
void recenterMouse() override;
void setMouseGrabbed(bool b) override;
@@ -57,8 +60,8 @@ public:
const char* const getWindowTitle() const { return m_WindowTitle; }
SoundSystem* const getSoundSystem() const override { return m_pSoundSystem; }
static Mouse::ButtonType GetMouseButtonType(UINT iMsg);
static Mouse::ButtonState GetMouseButtonState(UINT iMsg, WPARAM wParam);
static MouseButtonType GetMouseButtonType(UINT iMsg);
static bool GetMouseButtonState(UINT iMsg, WPARAM wParam);
static Keyboard::KeyState GetKeyState(UINT iMsg);
private:

View File

@@ -15,6 +15,8 @@
#include "client/app/App.hpp"
#include "client/app/NinecraftApp.hpp"
#include "client/player/input/Multitouch.hpp"
#include "AppPlatform_win32.hpp"
LPCTSTR g_WindowClassName = TEXT("MCPEClass");
@@ -45,8 +47,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
case WM_MOUSEMOVE:
case WM_MOUSEWHEEL:
{
Mouse::ButtonType buttonType = AppPlatform_win32::GetMouseButtonType(iMsg);
Mouse::ButtonState buttonState = AppPlatform_win32::GetMouseButtonState(iMsg, wParam);
MouseButtonType buttonType = AppPlatform_win32::GetMouseButtonType(iMsg);
bool buttonState = AppPlatform_win32::GetMouseButtonState(iMsg, wParam);
int posX, posY;
if (iMsg == WM_MOUSEMOVE)
{
@@ -59,6 +61,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
posY = Mouse::getY();
}
Mouse::feed(buttonType, buttonState, posX, posY);
Multitouch::feed(buttonType, buttonState, posX, posY, 0);
break;
}

View File

@@ -120,6 +120,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -130,6 +131,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -142,6 +144,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -156,6 +159,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -168,6 +172,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -178,6 +183,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -190,6 +196,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -204,6 +211,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -291,6 +299,22 @@
<ClInclude Include="$(MC_ROOT)\source\client\sound\SoundEngine.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\sound\SoundRepository.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\sound\SoundSystem.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IArea.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IBuildInput.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IncludeExcludeArea.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\MouseHandler.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\PolygonArea.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\RectangleArea.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\MouseDevice.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\Multitouch.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\CustomInputHolder.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IInputHolder.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IMoveInput.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\ITouchScreenModel.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\TouchAreaModel.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\TouchInputHolder.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\TouchscreenInput_TestFps.hpp" />
<ClInclude Include="$(MC_ROOT)\source\client\player\input\UnifiedTurnBuild.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MC_ROOT)\source\client\app\App.cpp" />
@@ -371,6 +395,21 @@
<ClCompile Include="$(MC_ROOT)\source\client\sound\SoundEngine.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\sound\SoundRepository.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\sound\SoundSystem.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IBuildInput.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IncludeExcludeArea.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\MouseHandler.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\PolygonArea.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\RectangleArea.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\MouseDevice.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\Multitouch.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\CustomInputHolder.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IInputHolder.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IMoveInput.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\ITouchScreenModel.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\TouchAreaModel.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\TouchInputHolder.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\TouchscreenInput_TestFps.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\player\input\UnifiedTurnBuild.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.vcxproj">

View File

@@ -296,9 +296,6 @@
<ClInclude Include="$(MC_ROOT)\source\client\sound\SoundSystem.hpp">
<Filter>Header Files\Sound</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\GameMods.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\app\App.hpp">
<Filter>Header Files\App</Filter>
</ClInclude>
@@ -317,6 +314,57 @@
<ClInclude Include="$(MC_ROOT)\source\client\network\ClientSideNetworkHandler.hpp">
<Filter>Header Files\Network</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\RectangleArea.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\PolygonArea.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\MouseHandler.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IncludeExcludeArea.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IArea.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IBuildInput.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\Multitouch.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\MouseDevice.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\TouchAreaModel.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\ITouchScreenModel.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IInputHolder.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\IMoveInput.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\CustomInputHolder.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\GameMods.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\UnifiedTurnBuild.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\TouchscreenInput_TestFps.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\client\player\input\TouchInputHolder.hpp">
<Filter>Header Files\Player\Input</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MC_ROOT)\source\client\gui\components\AvailableGamesList.cpp">
@@ -553,5 +601,50 @@
<ClCompile Include="$(MC_ROOT)\source\client\network\ClientSideNetworkHandler.cpp">
<Filter>Source Files\Network</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IncludeExcludeArea.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\PolygonArea.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\RectangleArea.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\MouseHandler.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IBuildInput.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\Multitouch.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\MouseDevice.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\ITouchScreenModel.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\TouchAreaModel.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IMoveInput.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\IInputHolder.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\CustomInputHolder.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\UnifiedTurnBuild.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\TouchscreenInput_TestFps.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\client\player\input\TouchInputHolder.cpp">
<Filter>Source Files\Player\Input</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -247,6 +247,7 @@
<ClCompile Include="$(MC_ROOT)\source\common\Timer.cpp" />
<ClCompile Include="$(MC_ROOT)\source\common\Util.cpp" />
<ClCompile Include="$(MC_ROOT)\source\common\Utils.cpp" />
<ClCompile Include="$(MC_ROOT)\source\common\SmoothFloat.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MC_ROOT)\source\common\CThread.hpp" />
@@ -258,6 +259,7 @@
<ClInclude Include="$(MC_ROOT)\source\common\Timer.hpp" />
<ClInclude Include="$(MC_ROOT)\source\common\Util.hpp" />
<ClInclude Include="$(MC_ROOT)\source\common\Utils.hpp" />
<ClInclude Include="$(MC_ROOT)\source\common\SmoothFloat.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -35,6 +35,9 @@
<ClCompile Include="$(MC_ROOT)\source\common\Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(MC_ROOT)\source\common\SmoothFloat.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MC_ROOT)\source\common\CThread.hpp">
@@ -64,5 +67,8 @@
<ClInclude Include="$(MC_ROOT)\source\common\Utils.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(MC_ROOT)\source\common\SmoothFloat.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -115,6 +115,7 @@
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -126,6 +127,7 @@
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -139,6 +141,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -154,6 +157,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -167,6 +171,7 @@
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -178,6 +183,7 @@
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -191,6 +197,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -206,6 +213,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>