diff options
-rw-r--r-- | Client/Project/VisualStudio/PND.sln | 10 | ||||
-rw-r--r-- | Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj | 130 | ||||
-rw-r--r-- | Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.filters | 2 | ||||
-rw-r--r-- | Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.user | 4 | ||||
-rw-r--r-- | Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj | 6 | ||||
-rw-r--r-- | Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj.filters | 6 | ||||
-rw-r--r-- | Client/Source/Phy2DLite/Settings.h | 52 | ||||
-rw-r--r-- | Client/Source/Phy2DLite/Tests/test.cpp (renamed from Client/Source/Phy2DLite/Tests/test_p2d.cpp) | 27 | ||||
-rw-r--r-- | Client/ThirdParty/fpm/include/fpm/fixed.hpp | 7 |
9 files changed, 62 insertions, 182 deletions
diff --git a/Client/Project/VisualStudio/PND.sln b/Client/Project/VisualStudio/PND.sln index 1fa5f6b..66ce8a7 100644 --- a/Client/Project/VisualStudio/PND.sln +++ b/Client/Project/VisualStudio/PND.sln @@ -17,8 +17,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sand2D", "Sand2D\Sand2D.vcx EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EntityViewer", "EntityViewer\EntityViewer.vcxproj", "{648C7FE7-9EF4-4D6D-8701-93F1821EB758}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PND_Editor", "PND_Editor\PND_Editor.vcxproj", "{88176848-F65A-4533-9022-22814A801CBC}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PND_LIB", "PND_LIB\PND_LIB.vcxproj", "{07536C61-3069-46C4-B5F5-782A36B92DD8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{69D9F6A1-FE05-4A58-B87C-E62A6C69BE8F}"
@@ -83,14 +81,6 @@ Global {648C7FE7-9EF4-4D6D-8701-93F1821EB758}.Release|x64.Build.0 = Release|x64
{648C7FE7-9EF4-4D6D-8701-93F1821EB758}.Release|x86.ActiveCfg = Release|Win32
{648C7FE7-9EF4-4D6D-8701-93F1821EB758}.Release|x86.Build.0 = Release|Win32
- {88176848-F65A-4533-9022-22814A801CBC}.Debug|x64.ActiveCfg = Debug|x64
- {88176848-F65A-4533-9022-22814A801CBC}.Debug|x64.Build.0 = Debug|x64
- {88176848-F65A-4533-9022-22814A801CBC}.Debug|x86.ActiveCfg = Debug|Win32
- {88176848-F65A-4533-9022-22814A801CBC}.Debug|x86.Build.0 = Debug|Win32
- {88176848-F65A-4533-9022-22814A801CBC}.Release|x64.ActiveCfg = Release|x64
- {88176848-F65A-4533-9022-22814A801CBC}.Release|x64.Build.0 = Release|x64
- {88176848-F65A-4533-9022-22814A801CBC}.Release|x86.ActiveCfg = Release|Win32
- {88176848-F65A-4533-9022-22814A801CBC}.Release|x86.Build.0 = Release|Win32
{07536C61-3069-46C4-B5F5-782A36B92DD8}.Debug|x64.ActiveCfg = Debug|x64
{07536C61-3069-46C4-B5F5-782A36B92DD8}.Debug|x64.Build.0 = Debug|x64
{07536C61-3069-46C4-B5F5-782A36B92DD8}.Debug|x86.ActiveCfg = Debug|Win32
diff --git a/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj b/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj deleted file mode 100644 index 8490866..0000000 --- a/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj +++ /dev/null @@ -1,130 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCProjectVersion>15.0</VCProjectVersion>
- <ProjectGuid>{88176848-F65A-4533-9022-22814A801CBC}</ProjectGuid>
- <RootNamespace>PNDEditor</RootNamespace>
- <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v141</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v141</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v141</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v141</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup />
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <ConformanceMode>true</ConformanceMode>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.filters b/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.filters deleted file mode 100644 index ef1ebf5..0000000 --- a/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.filters +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
\ No newline at end of file diff --git a/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.user b/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.user deleted file mode 100644 index 6e2aec7..0000000 --- a/Client/Project/VisualStudio/PND_Editor/PND_Editor.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup />
-</Project>
\ No newline at end of file diff --git a/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj b/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj index ca77c33..633276d 100644 --- a/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj +++ b/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj @@ -81,12 +81,12 @@ <Optimization>Disabled</Optimization>
<SDLCheck>false</SDLCheck>
<ConformanceMode>true</ConformanceMode>
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\ThirdParty;$(SolutionDir)..\..\ThirdParty\imgui;$(SolutionDir)..\..\ThirdParty\SDL2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\ThirdParty;$(SolutionDir)..\..\ThirdParty\imgui;$(SolutionDir)..\..\ThirdParty\SDL2;D:\boost_1_77_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
- <AdditionalLibraryDirectories>$(ProjectDir)..\..\..\ThirdParty\SDL2\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(ProjectDir)..\..\..\ThirdParty\SDL2\lib\x64;D:\boost_1_77_0\bin\$(PlatformTarget)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
@@ -143,7 +143,7 @@ <ClCompile Include="..\..\..\Source\Phy2DLite\Joint.cpp" />
<ClCompile Include="..\..\..\Source\Phy2DLite\Math.cpp" />
<ClCompile Include="..\..\..\Source\Phy2DLite\Tests\test_math.cpp" />
- <ClCompile Include="..\..\..\Source\Phy2DLite\Tests\test_p2d.cpp" />
+ <ClCompile Include="..\..\..\Source\Phy2DLite\Tests\test.cpp" />
<ClCompile Include="..\..\..\Source\Phy2DLite\World.cpp" />
<ClCompile Include="..\..\..\ThirdParty\glad\glad.c" />
<ClCompile Include="..\..\..\ThirdParty\imgui\backends\imgui_impl_opengl2.cpp" />
diff --git a/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj.filters b/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj.filters index a3de50b..bfba900 100644 --- a/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj.filters +++ b/Client/Project/VisualStudio/Phy2Dlite/Phy2Dlite.vcxproj.filters @@ -10,9 +10,6 @@ <ClCompile Include="..\..\..\Source\Phy2DLite\Tests\test_math.cpp">
<Filter>Tests</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\Source\Phy2DLite\Tests\test_p2d.cpp">
- <Filter>Tests</Filter>
- </ClCompile>
<ClCompile Include="..\..\..\ThirdParty\glad\glad.c">
<Filter>Libs\glad</Filter>
</ClCompile>
@@ -61,6 +58,9 @@ <ClCompile Include="..\..\..\ThirdParty\libfixmath\libfixmath\uint32.c">
<Filter>Libs\libfixmath</Filter>
</ClCompile>
+ <ClCompile Include="..\..\..\Source\Phy2DLite\Tests\test.cpp">
+ <Filter>Tests</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\Source\Phy2DLite\Arbiter.h" />
diff --git a/Client/Source/Phy2DLite/Settings.h b/Client/Source/Phy2DLite/Settings.h index e50646c..73639ef 100644 --- a/Client/Source/Phy2DLite/Settings.h +++ b/Client/Source/Phy2DLite/Settings.h @@ -11,6 +11,32 @@ #elif NUMBER_ALIAS == NUMBER_FPM
#include "fpm/include/fpm/fixed.hpp"
#include "fpm/include/fpm/math.hpp"
+#endif
+
+namespace Phy2D
+{
+
+#if NUMBER_ALIAS == NUMBER_FLOAT
+
+typedef float number;
+#define NUMBER_MAX (FLT_MAX)
+#define NUMBER_MIN (FLT_MIN)
+#define SQRT(a) (sqrt((a)))
+#define SIN(a) (sin((a)))
+#define COS(a) (cos((a)))
+
+#elif NUMBER_ALIAS == NUMBER_LIBFIX
+
+// ͬʱһ¶¨Òª¿ªÆôÄÚÁªº¯ÊýÀ©Õ¹£¬·ñÔòÖ´ÐÐЧÂÊ»á·Ç³£µÍ
+typedef Fix16 number;
+#define NUMBER_MAX (fix16_maximum)
+#define NUMBER_MIN (fix16_minimum)
+#define SQRT(a) ((a).sqrt())
+#define SIN(a) ((a).sin())
+#define COS(a) ((a).cos())
+#define PI (fix16_pi)
+
+#elif NUMBER_ALIAS == NUMBER_FPM
template <typename T> struct Limits {}; @@ -57,32 +83,6 @@ struct Limits<fpm::fixed_8_24> static constexpr fpm::fixed_8_24 max() noexcept { return fpm::fixed_8_24::from_raw_value(2147483647); } }; -#endif
-
-namespace Phy2D
-{
-
-#if NUMBER_ALIAS == NUMBER_FLOAT
-
-typedef float number;
-#define NUMBER_MAX (FLT_MAX)
-#define NUMBER_MIN (FLT_MIN)
-#define SQRT(a) (sqrt((a)))
-#define SIN(a) (sin((a)))
-#define COS(a) (cos((a)))
-
-#elif NUMBER_ALIAS == NUMBER_LIBFIX
-
-// ͬʱһ¶¨Òª¿ªÆôÄÚÁªº¯ÊýÀ©Õ¹£¬·ñÔòÖ´ÐÐЧÂÊ»á·Ç³£µÍ
-typedef Fix16 number;
-#define NUMBER_MAX (fix16_maximum)
-#define NUMBER_MIN (fix16_minimum)
-#define SQRT(a) ((a).sqrt())
-#define SIN(a) ((a).sin())
-#define COS(a) ((a).cos())
-
-#elif NUMBER_ALIAS == NUMBER_FPM
-
typedef fpm::fixed_16_16 number;
#define NUMBER_MAX (Limits<number>::max())
#define NUMBER_MIN (Limits<number>::min())
diff --git a/Client/Source/Phy2DLite/Tests/test_p2d.cpp b/Client/Source/Phy2DLite/Tests/test.cpp index 69737f6..6456b75 100644 --- a/Client/Source/Phy2DLite/Tests/test_p2d.cpp +++ b/Client/Source/Phy2DLite/Tests/test.cpp @@ -454,15 +454,17 @@ static void Demo9(Body* b, Joint* j) } } -static void InitDemo() +void(*demos[])(Body* b, Joint* j) = { Demo1, Demo2, Demo3, Demo4, Demo5, Demo6, Demo7, Demo8, Demo9 }; + +static void InitDemo(int index) { world.Clear(); numBodies = 0; numJoints = 0; bomb = NULL; - demoIndex = 0; - Demo5(bodies, joints); + demoIndex = index; + demos[index](bodies, joints); } int main(int argc, char **argv) {
@@ -545,7 +547,7 @@ int main(int argc, char **argv) { glOrtho(-zoom, zoom, -zoom / aspect + pan_y, zoom / aspect + pan_y, -1.0, 1.0); }
- InitDemo();
+ InitDemo(5);
// Main loop
bool done = false;
@@ -568,6 +570,23 @@ int main(int argc, char **argv) { done = true;
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
done = true;
+ if (event.type == SDL_KEYDOWN)
+ {
+ switch (event.key.keysym.sym)
+ {
+ case SDLK_1:
+ case SDLK_2:
+ case SDLK_3:
+ case SDLK_4:
+ case SDLK_5:
+ case SDLK_6:
+ case SDLK_7:
+ case SDLK_8:
+ case SDLK_9:
+ InitDemo(event.key.keysym.sym - SDLK_1);
+ break;
+ }
+ }
}
// Start the Dear ImGui frame
diff --git a/Client/ThirdParty/fpm/include/fpm/fixed.hpp b/Client/ThirdParty/fpm/include/fpm/fixed.hpp index b900dd0..c52116b 100644 --- a/Client/ThirdParty/fpm/include/fpm/fixed.hpp +++ b/Client/ThirdParty/fpm/include/fpm/fixed.hpp @@ -204,6 +204,13 @@ namespace fpm return fixed<B, I, F>(x) += y; } + template <typename B, typename I, unsigned int F, typename T> + constexpr inline fixed<B, I, F> operator+(const fixed<B, I, F>& x, T y) noexcept + { + fixed<B, I, F> r = y; + return fixed<B, I, F>(x) += r; + } + template <typename B, typename I, unsigned int F, typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr> constexpr inline fixed<B, I, F> operator+(const fixed<B, I, F>& x, T y) noexcept { |