diff --git a/.gitignore b/.gitignore index a7b57f3d..4ed594f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ -x86/ x64/ Debug/ Release/ -prebuilt/ # vs2010 ipch/ diff --git a/project/vs2017/Easy2D.sln b/project/Easy2D.sln similarity index 62% rename from project/vs2017/Easy2D.sln rename to project/Easy2D.sln index cbc86ae5..8d9ecab1 100644 --- a/project/vs2017/Easy2D.sln +++ b/project/Easy2D.sln @@ -1,28 +1,38 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2009 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "HelloWorld\HelloWorld.vcxproj", "{3561A359-F9FD-48AB-A977-34E7E568BC8E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D\Easy2D.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 Debug|Win32 = Debug|Win32 - Release|x64 = Release|x64 + Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.ActiveCfg = Debug|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Build.0 = Debug|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Deploy.0 = Debug|x64 {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.ActiveCfg = Debug|Win32 {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.Build.0 = Debug|Win32 {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.Deploy.0 = Debug|Win32 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.ActiveCfg = Release|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.Build.0 = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.ActiveCfg = Debug|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Build.0 = Debug|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Deploy.0 = Debug|x64 {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|Win32.ActiveCfg = Release|Win32 {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|Win32.Build.0 = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.ActiveCfg = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.Build.0 = Release|x64 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Debug|Win32.ActiveCfg = Debug|Win32 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Debug|Win32.Build.0 = Debug|Win32 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Debug|x64.ActiveCfg = Debug|x64 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Debug|x64.Build.0 = Debug|x64 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Release|Win32.ActiveCfg = Release|Win32 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Release|Win32.Build.0 = Release|Win32 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Release|x64.ActiveCfg = Release|x64 + {3561A359-F9FD-48AB-A977-34E7E568BC8E}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/project/vs2013/Easy2D.vcxproj b/project/Easy2D/Easy2D.vcxproj similarity index 82% rename from project/vs2013/Easy2D.vcxproj rename to project/Easy2D/Easy2D.vcxproj index ebc74304..1c9388ff 100644 --- a/project/vs2013/Easy2D.vcxproj +++ b/project/Easy2D/Easy2D.vcxproj @@ -1,23 +1,5 @@ - + - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - @@ -135,36 +117,49 @@ + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + - {91DBDFCC-4083-427C-AAAD-55715118DB26} - Win32Proj - Win32Project1 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF} + Easy2D StaticLibrary true - v120 Unicode StaticLibrary true - v120 Unicode StaticLibrary false - v120 - false + true Unicode StaticLibrary false - v120 - false + true Unicode @@ -184,74 +179,58 @@ - $(SolutionDir)x86\ - $(Configuration)\x86\ - Easy2Ddw + $(ProjectDir)$(Configuration)\ + $(ProjectDir)$(Configuration)\ + easy2dd - $(Configuration)\$(Platform)\ - Easy2Ddw - $(SolutionDir)$(Platform)\ + $(ProjectDir)$(Configuration)\ + $(ProjectDir)$(Configuration)\ + easy2dd - $(SolutionDir)x86\ - $(Configuration)\x86\ - Easy2Dw + $(ProjectDir)$(Configuration)\ + $(ProjectDir)$(Configuration)\ + easy2d - $(Configuration)\$(Platform)\ - Easy2Dw - $(SolutionDir)$(Platform)\ + $(ProjectDir)$(Configuration)\ + $(ProjectDir)$(Configuration)\ + easy2d - NotUsing Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - false - None - false true - Windows + Console true - NotUsing Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - false - None - false true - Windows + Console true Level3 - - MaxSpeed - - + true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - false - None + false true - true - Windows + Console true true true @@ -260,20 +239,14 @@ Level3 - - MaxSpeed - - + true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - false - None + false true - true - Windows + Console true true true diff --git a/project/vs2017/Easy2D.vcxproj.filters b/project/Easy2D/Easy2D.vcxproj.filters similarity index 99% rename from project/vs2017/Easy2D.vcxproj.filters rename to project/Easy2D/Easy2D.vcxproj.filters index c7d0b63c..0453e1d6 100644 --- a/project/vs2017/Easy2D.vcxproj.filters +++ b/project/Easy2D/Easy2D.vcxproj.filters @@ -1,5 +1,19 @@ - + + + + {896bdedf-6e82-449b-9b6e-0bc69f3699b1} + + + {80bc6386-2b70-4bae-993c-649a55163a1b} + + + {68eac919-ee87-4030-a033-c251731928f5} + + + {07b6d541-4a1b-472a-aae0-daf9d082fe84} + + @@ -204,20 +218,6 @@ math - - - {896bdedf-6e82-449b-9b6e-0bc69f3699b1} - - - {80bc6386-2b70-4bae-993c-649a55163a1b} - - - {68eac919-ee87-4030-a033-c251731928f5} - - - {07b6d541-4a1b-472a-aae0-daf9d082fe84} - - core diff --git a/project/HelloWorld/HelloWorld.vcxproj b/project/HelloWorld/HelloWorld.vcxproj new file mode 100644 index 00000000..937b78f8 --- /dev/null +++ b/project/HelloWorld/HelloWorld.vcxproj @@ -0,0 +1,153 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {3561A359-F9FD-48AB-A977-34E7E568BC8E} + HelloWorld + + + + Application + true + Unicode + + + Application + false + true + Unicode + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ../../src + + + true + Console + + + + + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ../../src + + + true + Console + + + + + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ../../src + + + true + true + true + Console + + + + + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ../../src + + + true + true + true + Console + + + + + + + + {ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf} + + + + + + \ No newline at end of file diff --git a/project/HelloWorld/HelloWorld.vcxproj.filters b/project/HelloWorld/HelloWorld.vcxproj.filters new file mode 100644 index 00000000..4327830c --- /dev/null +++ b/project/HelloWorld/HelloWorld.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/project/HelloWorld/main.cpp b/project/HelloWorld/main.cpp new file mode 100644 index 00000000..ed22128b --- /dev/null +++ b/project/HelloWorld/main.cpp @@ -0,0 +1,52 @@ +// Copyright (C) 2019 Nomango + +#include "easy2d.h" + +const int WINDOW_WIDTH = 640; +const int WINDOW_HEIGHT = 480; + +class MainScene + : public easy2d::Scene +{ +public: + MainScene() + { + // ´´½¨ÎÄ×Ö½Úµã + easy2d::TextPtr text = new easy2d::Text(L"Hello Easy2D!"); + // Ð޸ĽڵãλÖà + text->SetPosition(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2); + // Ð޸Ľڵãêµã, ʹ½ÚµãÔÚÆÁÄ»ÉϾÓÖÐ + text->SetAnchor(0.5, 0.5); + // Ìí¼Óµ½³¡¾°ÖÐ + this->AddChild(text); + } +}; + +int main() +{ + try + { + // ´´½¨ Easy2D ³ÌÐòʵÀý + easy2d::Application app; + + // ´´½¨³õʼ»¯Ñ¡Ïî + easy2d::Options options; + // ÉèÖô°¿Ú¿í¸ß + options.width = WINDOW_WIDTH; + options.height = WINDOW_HEIGHT; + // ³õʼ»¯ app + app.Init(options); + + // ´´½¨³¡¾°²¢½øÈë + easy2d::ScenePtr scene = new MainScene; + app.EnterScene(scene); + + // ÔËÐÐ + app.Run(); + } + catch (std::exception& e) + { + ::MessageBoxA(nullptr, e.what(), "An exception has occurred!", MB_ICONERROR | MB_TASKMODAL); + } + return 0; +} diff --git a/project/vs2013/Easy2D.sln b/project/vs2013/Easy2D.sln deleted file mode 100644 index e4046ff9..00000000 --- a/project/vs2013/Easy2D.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D.vcxproj", "{91DBDFCC-4083-427C-AAAD-55715118DB26}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Debug|Win32.ActiveCfg = Debug|Win32 - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Debug|Win32.Build.0 = Debug|Win32 - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Debug|x64.ActiveCfg = Debug|x64 - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Debug|x64.Build.0 = Debug|x64 - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Release|Win32.ActiveCfg = Release|Win32 - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Release|Win32.Build.0 = Release|Win32 - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Release|x64.ActiveCfg = Release|x64 - {91DBDFCC-4083-427C-AAAD-55715118DB26}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/project/vs2013/Easy2D.vcxproj.filters b/project/vs2013/Easy2D.vcxproj.filters deleted file mode 100644 index c7d0b63c..00000000 --- a/project/vs2013/Easy2D.vcxproj.filters +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - math - - - math - - - utils - - - utils - - - utils - - - utils - - - utils - - - ui - - - ui - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - utils - - - core - - - core - - - math - - - core - - - core - - - core - - - math - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - utils - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - - - {896bdedf-6e82-449b-9b6e-0bc69f3699b1} - - - {80bc6386-2b70-4bae-993c-649a55163a1b} - - - {68eac919-ee87-4030-a033-c251731928f5} - - - {07b6d541-4a1b-472a-aae0-daf9d082fe84} - - - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - utils - - - utils - - - utils - - - utils - - - utils - - - ui - - - ui - - - core - - - core - - - core - - - core - - - utils - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - utils - - - core - - - core - - - math - - - \ No newline at end of file diff --git a/project/vs2015/Easy2D.sln b/project/vs2015/Easy2D.sln deleted file mode 100644 index b1f7408b..00000000 --- a/project/vs2015/Easy2D.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|Win32 = Debug|Win32 - Release|x64 = Release|x64 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.ActiveCfg = Debug|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Build.0 = Debug|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Deploy.0 = Debug|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.ActiveCfg = Debug|Win32 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.Build.0 = Debug|Win32 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.ActiveCfg = Release|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.Build.0 = Release|x64 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|Win32.ActiveCfg = Release|Win32 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {FAC2BE2F-19AF-477A-8DC6-4645E66868A4} - EndGlobalSection -EndGlobal diff --git a/project/vs2015/Easy2D.vcxproj b/project/vs2015/Easy2D.vcxproj deleted file mode 100644 index 545da6a1..00000000 --- a/project/vs2015/Easy2D.vcxproj +++ /dev/null @@ -1,317 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF} - Win32Proj - Easy2D - 8.1 - - - - StaticLibrary - true - Unicode - v140 - - - StaticLibrary - false - false - Unicode - v140 - - - StaticLibrary - true - Unicode - v140 - - - StaticLibrary - false - false - Unicode - v140 - - - - - - - - - - - - - - - - - - - - - true - Easy2Ddw - $(SolutionDir)x86\ - $(Configuration)\x86\ - - - true - Easy2Ddw - $(SolutionDir)$(Platform)\ - $(Configuration)\$(Platform)\ - - - false - Easy2Dw - $(SolutionDir)x86\ - $(Configuration)\x86\ - - - false - Easy2Dw - $(SolutionDir)$(Platform)\ - $(Configuration)\$(Platform)\ - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - false - true - - - Console - true - - - - - - - - - - - false - - - - - NotUsing - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - false - true - - - Console - true - - - - - - - - - - - NotUsing - Level3 - MaxSpeed - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - true - true - - - Console - true - true - true - - - - - - - - - - - - - NotUsing - Level3 - MaxSpeed - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - true - true - - - Console - true - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/project/vs2015/Easy2D.vcxproj.filters b/project/vs2015/Easy2D.vcxproj.filters deleted file mode 100644 index c7d0b63c..00000000 --- a/project/vs2015/Easy2D.vcxproj.filters +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - math - - - math - - - utils - - - utils - - - utils - - - utils - - - utils - - - ui - - - ui - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - utils - - - core - - - core - - - math - - - core - - - core - - - core - - - math - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - utils - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - - - {896bdedf-6e82-449b-9b6e-0bc69f3699b1} - - - {80bc6386-2b70-4bae-993c-649a55163a1b} - - - {68eac919-ee87-4030-a033-c251731928f5} - - - {07b6d541-4a1b-472a-aae0-daf9d082fe84} - - - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - math - - - utils - - - utils - - - utils - - - utils - - - utils - - - ui - - - ui - - - core - - - core - - - core - - - core - - - utils - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - utils - - - core - - - core - - - math - - - \ No newline at end of file diff --git a/project/vs2017/Easy2D.vcxproj b/project/vs2017/Easy2D.vcxproj deleted file mode 100644 index 0c41e53f..00000000 --- a/project/vs2017/Easy2D.vcxproj +++ /dev/null @@ -1,325 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15.0 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF} - Win32Proj - Easy2D - - - - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - StaticLibrary - true - Unicode - v141 - - - StaticLibrary - false - false - Unicode - v141 - - - StaticLibrary - true - Unicode - v141 - - - StaticLibrary - false - false - Unicode - v141 - - - - - - - - - - - - - - - - - - - - - true - Easy2Ddw - $(SolutionDir)x86\ - $(Configuration)\x86\ - - - true - Easy2Ddw - $(SolutionDir)$(Platform)\ - $(Configuration)\$(Platform)\ - - - false - Easy2Dw - $(SolutionDir)x86\ - $(Configuration)\x86\ - - - false - Easy2Dw - $(SolutionDir)$(Platform)\ - $(Configuration)\$(Platform)\ - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - false - true - - - Console - true - - - - - - - - - - - false - - - - - NotUsing - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - false - true - - - Console - true - - - - - - - - - - - NotUsing - Level3 - MaxSpeed - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - true - true - - - Console - true - true - true - - - - - - - - - - - - - NotUsing - Level3 - MaxSpeed - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - None - true - true - - - Console - true - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/src/core/Action.hpp b/src/core/Action.hpp index 12c68558..bba02328 100644 --- a/src/core/Action.hpp +++ b/src/core/Action.hpp @@ -79,10 +79,11 @@ namespace easy2d this->Reset(); } - virtual void Init(Node* target) { initialized_ = true; } + virtual void Init(Node* target) { E2D_NOT_USED(target); initialized_ = true; } virtual void Update(Node* target, Duration dt) { + E2D_NOT_USED(dt); if (!initialized_) { Init(target); diff --git a/src/core/Application.cpp b/src/core/Application.cpp index 9a694fad..270e5eea 100644 --- a/src/core/Application.cpp +++ b/src/core/Application.cpp @@ -55,12 +55,15 @@ namespace easy2d debug_ = options.debug; // show console if debug mode enabled - HWND console = ::GetConsoleWindow(); - if (debug_ && !console) + if (debug_ && !::GetConsoleWindow()) { - if (::AllocConsole()) + if (!::AllocConsole()) { - console = ::GetConsoleWindow(); + logs::Warningln(L"AllocConsole failed"); + } + else + { + HWND console = ::GetConsoleWindow(); FILE * dummy; freopen_s(&dummy, "CONOUT$", "w+t", stdout); freopen_s(&dummy, "CONIN$", "r+t", stdin); @@ -73,19 +76,14 @@ namespace easy2d std::wcin.clear(); std::cerr.clear(); std::wcerr.clear(); - } - } - else if (!debug_ && console) - { - ::ShowWindow(console, SW_HIDE); - console = nullptr; - } - // disable the close button of console - if (console) - { - HMENU hmenu = ::GetSystemMenu(console, FALSE); - ::RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND); + // disable the close button of console + if (console) + { + HMENU hmenu = ::GetSystemMenu(console, FALSE); + ::RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND); + } + } } ThrowIfFailed( @@ -131,7 +129,7 @@ namespace easy2d ::ImmAssociateContext(hwnd, nullptr); // use Application instance in message loop - ::SetWindowLongPtr(hwnd, GWLP_USERDATA, PtrToUlong(this)); + ::SetWindowLongPtr(hwnd, GWLP_USERDATA, LONG_PTR(this)); } void Application::Run() @@ -259,7 +257,9 @@ namespace easy2d LRESULT CALLBACK Application::WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - Application * app = reinterpret_cast(::GetWindowLongW(hwnd, GWLP_USERDATA)); + Application * app = reinterpret_cast( + static_cast(::GetWindowLongPtrW(hwnd, GWLP_USERDATA)) + ); if (!app) return ::DefWindowProcW(hwnd, msg, wparam, lparam); diff --git a/src/core/DebugNode.cpp b/src/core/DebugNode.cpp index b3cc221f..68afe96f 100644 --- a/src/core/DebugNode.cpp +++ b/src/core/DebugNode.cpp @@ -82,6 +82,8 @@ namespace easy2d void DebugNode::OnUpdate(Duration dt) { + E2D_NOT_USED(dt); + try { frame_time_.push_back(time::Now()); diff --git a/src/core/Input.cpp b/src/core/Input.cpp index 748d9b55..bf6aa753 100644 --- a/src/core/Input.cpp +++ b/src/core/Input.cpp @@ -40,6 +40,8 @@ namespace easy2d HRESULT Input::Init(HWND hwnd, bool debug) { + E2D_NOT_USED(debug); + E2D_LOG(L"Initing input device"); hwnd_ = hwnd; diff --git a/src/core/IntrusiveList.hpp b/src/core/IntrusiveList.hpp index 9a9e0a1f..543f581a 100644 --- a/src/core/IntrusiveList.hpp +++ b/src/core/IntrusiveList.hpp @@ -172,8 +172,7 @@ namespace easy2d T tmp = first_; while (tmp != child) { - if (tmp == last_) - E2D_ASSERT(false && "The node to be removed is not in this list"); + E2D_ASSERT((tmp != last_) && "The node to be removed is not in this list"); tmp = tmp->next_; } #endif diff --git a/src/core/Node.cpp b/src/core/Node.cpp index 2a984ca7..b35a6236 100644 --- a/src/core/Node.cpp +++ b/src/core/Node.cpp @@ -280,7 +280,8 @@ namespace easy2d if (sibling && sibling->GetZOrder() > zorder) { - while (sibling = sibling->PrevItem().Get()) + sibling = sibling->PrevItem().Get(); + while (sibling) { if (sibling->GetZOrder() <= zorder) break; diff --git a/src/core/Node.h b/src/core/Node.h index ed9ac65a..ce949e0e 100644 --- a/src/core/Node.h +++ b/src/core/Node.h @@ -50,7 +50,7 @@ namespace easy2d Node(); // ¸üнڵã - virtual void OnUpdate(Duration dt) {} + virtual void OnUpdate(Duration dt) { E2D_NOT_USED(dt); } // äÖȾ½Úµã virtual void OnRender() {} diff --git a/src/core/TextRenderer.cpp b/src/core/TextRenderer.cpp index fb086521..f4a43f00 100644 --- a/src/core/TextRenderer.cpp +++ b/src/core/TextRenderer.cpp @@ -85,6 +85,11 @@ namespace easy2d __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, IUnknown* clientDrawingEffect) { + E2D_NOT_USED(clientDrawingContext); + E2D_NOT_USED(measuringMode); + E2D_NOT_USED(glyphRunDescription); + E2D_NOT_USED(clientDrawingEffect); + HRESULT hr = S_OK; ID2D1PathGeometry* pPathGeometry = nullptr; @@ -171,6 +176,9 @@ namespace easy2d __in DWRITE_UNDERLINE const* underline, IUnknown* clientDrawingEffect) { + E2D_NOT_USED(clientDrawingContext); + E2D_NOT_USED(clientDrawingEffect); + HRESULT hr; D2D1_RECT_F rect = D2D1::RectF( @@ -237,6 +245,9 @@ namespace easy2d __in DWRITE_STRIKETHROUGH const* strikethrough, IUnknown* clientDrawingEffect) { + E2D_NOT_USED(clientDrawingContext); + E2D_NOT_USED(clientDrawingEffect); + HRESULT hr; D2D1_RECT_F rect = D2D1::RectF( @@ -305,6 +316,13 @@ namespace easy2d BOOL IsRightToLeft, IUnknown* clientDrawingEffect) { + E2D_NOT_USED(clientDrawingContext); + E2D_NOT_USED(originX); + E2D_NOT_USED(originY); + E2D_NOT_USED(inlineObject); + E2D_NOT_USED(IsSideways); + E2D_NOT_USED(IsRightToLeft); + E2D_NOT_USED(clientDrawingEffect); return E_NOTIMPL; } @@ -330,6 +348,8 @@ namespace easy2d __maybenull void* clientDrawingContext, __out BOOL* isDisabled) { + E2D_NOT_USED(clientDrawingContext); + *isDisabled = FALSE; return S_OK; } @@ -338,6 +358,8 @@ namespace easy2d __maybenull void* clientDrawingContext, __out DWRITE_MATRIX* transform) { + E2D_NOT_USED(clientDrawingContext); + pRT_->GetTransform(reinterpret_cast(transform)); return S_OK; } @@ -346,6 +368,8 @@ namespace easy2d __maybenull void* clientDrawingContext, __out FLOAT* pixelsPerDip) { + E2D_NOT_USED(clientDrawingContext); + float x, yUnused; pRT_->GetDpi(&x, &yUnused); diff --git a/src/core/audio.cpp b/src/core/audio.cpp index 23357ad7..8893d180 100644 --- a/src/core/audio.cpp +++ b/src/core/audio.cpp @@ -184,6 +184,8 @@ namespace easy2d HRESULT Audio::Init(bool debug) { + E2D_NOT_USED(debug); + E2D_LOG(L"Initing audio device"); HRESULT hr = modules::MediaFoundation::Get().MFStartup(MF_VERSION, MFSTARTUP_FULL); diff --git a/src/core/macros.h b/src/core/macros.h index 007e1938..0b30f46b 100644 --- a/src/core/macros.h +++ b/src/core/macros.h @@ -82,7 +82,7 @@ #include // C++ RunTime Header Files -#include +#include #include #include #include @@ -99,8 +99,12 @@ #ifndef E2D_ASSERT # ifdef E2D_DEBUG -# define E2D_ASSERT(expr) if (!(expr)) { ::OutputDebugStringA("[easy2d] Assert failed: " #expr "\n"); abort(); } +# define E2D_ASSERT(expr) assert(expr) # else # define E2D_ASSERT __noop # endif #endif + +#ifndef E2D_NOT_USED +# define E2D_NOT_USED(var) ((void)var); +#endif diff --git a/src/core/time.cpp b/src/core/time.cpp index 4edef49d..47c859ff 100644 --- a/src/core/time.cpp +++ b/src/core/time.cpp @@ -36,35 +36,35 @@ namespace easy2d } TimePoint::TimePoint(long dur) - : dur(dur) + : dur_(dur) { } const TimePoint TimePoint::operator+(const Duration & dur) const { - return TimePoint{ (dur + dur).Milliseconds() }; + return TimePoint{ dur_ + dur.Milliseconds() }; } const TimePoint TimePoint::operator-(const Duration & dur) const { - return TimePoint{ (dur - dur).Milliseconds() }; + return TimePoint{ dur_ - dur.Milliseconds() }; } TimePoint & TimePoint::operator+=(const Duration & other) { - dur += other.Milliseconds(); + dur_ += other.Milliseconds(); return (*this); } TimePoint & TimePoint::operator-=(const Duration &other) { - dur -= other.Milliseconds(); + dur_ -= other.Milliseconds(); return (*this); } const Duration TimePoint::operator-(const TimePoint & other) const { - return Duration(dur - other.dur); + return Duration(dur_ - other.dur_); } diff --git a/src/core/time.h b/src/core/time.h index 1e9ec81f..12a20dde 100644 --- a/src/core/time.h +++ b/src/core/time.h @@ -130,7 +130,7 @@ namespace easy2d TimePoint(long); // ÊÇ·ñÊÇÁãʱ - inline bool IsZero() const { return dur == 0; } + inline bool IsZero() const { return dur_ == 0; } const TimePoint operator + (const Duration &) const; const TimePoint operator - (const Duration &) const; @@ -141,7 +141,7 @@ namespace easy2d const Duration operator - (const TimePoint &) const; private: - long dur; + long dur_; }; // »ñÈ¡µ±Ç°Ê±¼ä diff --git a/src/core/window.cpp b/src/core/window.cpp index a86b01ab..b02d8f7d 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -65,6 +65,8 @@ namespace easy2d HRESULT Window::Init(String title, int width, int height, LPCWSTR icon, bool fullscreen, WNDPROC proc, bool debug) { + E2D_NOT_USED(debug); + E2D_LOG(L"Creating window"); HINSTANCE hinst = GetModuleHandleW(nullptr); diff --git a/src/easy2d.h b/src/easy2d.h index d1bdb858..35a16c20 100644 --- a/src/easy2d.h +++ b/src/easy2d.h @@ -112,10 +112,3 @@ #include "ui/Button.h" #include "ui/Menu.h" - - -#if defined(DEBUG) || defined(_DEBUG) -# pragma comment(lib, "Easy2Ddw.lib") -#else -# pragma comment(lib, "Easy2Dw.lib") -#endif diff --git a/src/utils/Transcoder.cpp b/src/utils/Transcoder.cpp index c3385ee1..27929cd4 100644 --- a/src/utils/Transcoder.cpp +++ b/src/utils/Transcoder.cpp @@ -68,7 +68,6 @@ namespace easy2d HRESULT Transcoder::LoadMediaResource(Resource const& res, BYTE** wave_data, UINT32* wave_data_size) { HRESULT hr = S_OK; - HINSTANCE hinstance = GetModuleHandle(nullptr); IntrusivePtr stream; IntrusivePtr byte_stream; @@ -135,7 +134,7 @@ namespace easy2d if (SUCCEEDED(hr)) { hr = reader->SetCurrentMediaType( - MF_SOURCE_READER_FIRST_AUDIO_STREAM, + (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, partial_type.Get() ); @@ -145,7 +144,7 @@ namespace easy2d if (SUCCEEDED(hr)) { hr = reader->GetCurrentMediaType( - MF_SOURCE_READER_FIRST_AUDIO_STREAM, + (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM, &uncompressed_type ); } @@ -154,7 +153,7 @@ namespace easy2d if (SUCCEEDED(hr)) { hr = reader->SetStreamSelection( - MF_SOURCE_READER_FIRST_AUDIO_STREAM, + (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM, true ); } @@ -167,7 +166,7 @@ namespace easy2d uncompressed_type.Get(), &wave_format_, &size, - MFWaveFormatExConvertFlag_Normal + (DWORD)MFWaveFormatExConvertFlag_Normal ); } @@ -178,7 +177,7 @@ namespace easy2d PropVariantInit(&prop); hr = reader->GetPresentationAttribute( - MF_SOURCE_READER_MEDIASOURCE, + (DWORD)MF_SOURCE_READER_MEDIASOURCE, MF_PD_DURATION, &prop ); @@ -186,7 +185,7 @@ namespace easy2d LONGLONG duration = prop.uhVal.QuadPart; max_stream_size = static_cast( (duration * wave_format_->nAvgBytesPerSec) / 10000000 + 1 - ); + ); PropVariantClear(&prop); } @@ -210,7 +209,7 @@ namespace easy2d while (true) { hr = reader->ReadSample( - MF_SOURCE_READER_FIRST_AUDIO_STREAM, + (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, nullptr, &flags,