diff --git a/.gitignore b/.gitignore index 86bb91a8..e3c6c268 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,14 @@ # ignore all files in the /Easy2D/** directory -Easy2D/Win32/ -Easy2D/x64/ -/Win32/ -/x64/ +Win32/ +x64/ Debug/ Release/ -backup/ + +# vs2010 +ipch/ +*.opensdf +*.sdf + +*.user *.lnk .vs \ No newline at end of file diff --git a/ConsoleDemo/ConsoleDemo.vcxproj b/ConsoleDemo/ConsoleDemo.vcxproj deleted file mode 100644 index 25bf8a2f..00000000 --- a/ConsoleDemo/ConsoleDemo.vcxproj +++ /dev/null @@ -1,164 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {70931955-FE2D-4A50-93C6-6955A730B0FE} - Win32Proj - ConsoleDemo - 10.0.16299.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(MSBuildProjectDirectory)\..\Win32;$(LibraryPath) - - - true - - - false - - - false - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - - - Level3 - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - Level3 - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - \ No newline at end of file diff --git a/ConsoleDemo/ConsoleDemo.vcxproj.filters b/ConsoleDemo/ConsoleDemo.vcxproj.filters deleted file mode 100644 index 203a71c4..00000000 --- a/ConsoleDemo/ConsoleDemo.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - 源文件 - - - \ No newline at end of file diff --git a/ConsoleDemo/DeclareDPIAware.manifest b/ConsoleDemo/DeclareDPIAware.manifest deleted file mode 100644 index 5dea26f9..00000000 --- a/ConsoleDemo/DeclareDPIAware.manifest +++ /dev/null @@ -1,7 +0,0 @@ - - - - true - - - \ No newline at end of file diff --git a/ConsoleDemo/elyse.png b/ConsoleDemo/elyse.png deleted file mode 100644 index 7efa0f78..00000000 Binary files a/ConsoleDemo/elyse.png and /dev/null differ diff --git a/ConsoleDemo/main.cpp b/ConsoleDemo/main.cpp deleted file mode 100644 index 24e05be8..00000000 --- a/ConsoleDemo/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -class Scene2 : - public EScene -{ -public: - Scene2() - { - auto text = new EText(L"԰ť"); - auto text2 = new EText(L"԰ť", L"", 22, EColor::BLUE); - auto button = new EButton(text, text2, text); - button->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2); - button->setCallback([]() { - EApp::backScene(new ETransitionScaleEmerge(1, ETransitionScaleEmerge::ENTER)); - }); - this->add(button); - } -}; - -class Scene : - public EScene -{ -public: - Scene() - { - /*auto sprite = new ESprite(L"test2.png"); - auto button = new EButton(sprite); - button->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2); - button->setCallback([]() { - EApp::enterScene(new Scene2(), new ETransitionScaleEmerge(1, ETransitionScaleEmerge::ENTER)); - }); - this->add(button);*/ - auto sprite = new ESprite(L"test2.png"); - sprite->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2); - this->add(sprite); - - sprite->runAction(new EActionLoop(new EActionRotateBy(1, 60))); - } -}; -#include -int main() -{ - EApp app; - - if (app.init(L"Easy2D Demo", 640, 480)) - { - app.showConsole(); - for (int i = 0; i < 20; i++) - { - std::cout << ERandom::between(1, 3) << std::endl; - } - ENode::setDefaultPiovt(0.5f, 0.5f); - - auto scene = new Scene(); - app.enterScene(scene); - - app.run(); - } - - return 0; -} diff --git a/ConsoleDemo/test.png b/ConsoleDemo/test.png deleted file mode 100644 index 23b60462..00000000 Binary files a/ConsoleDemo/test.png and /dev/null differ diff --git a/ConsoleDemo/test2.png b/ConsoleDemo/test2.png deleted file mode 100644 index 383c0629..00000000 Binary files a/ConsoleDemo/test2.png and /dev/null differ diff --git a/Demo/Demo.vcxproj b/Demo/Demo.vcxproj deleted file mode 100644 index a61d8f52..00000000 --- a/Demo/Demo.vcxproj +++ /dev/null @@ -1,156 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C} - Win32Proj - Demo - 10.0.16299.0 - - - - Application - true - Unicode - v141 - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(MSBuildProjectDirectory)\..\Win32;$(LibraryPath) - - - true - - - false - - - false - - - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - - - Level3 - Disabled - _DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - - - Level3 - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - Level3 - MaxSpeed - true - true - NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - - - \ No newline at end of file diff --git a/Demo/Demo.vcxproj.filters b/Demo/Demo.vcxproj.filters deleted file mode 100644 index 203a71c4..00000000 --- a/Demo/Demo.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - 源文件 - - - \ No newline at end of file diff --git a/Demo/Demo.vcxproj.user b/Demo/Demo.vcxproj.user deleted file mode 100644 index be250787..00000000 --- a/Demo/Demo.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Demo/atlas.png b/Demo/atlas.png deleted file mode 100644 index 05e5ce16..00000000 Binary files a/Demo/atlas.png and /dev/null differ diff --git a/Demo/main.cpp b/Demo/main.cpp deleted file mode 100644 index 8ffc99f0..00000000 --- a/Demo/main.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include "..\Easy2D\easy2d.h" -#include - -int WINAPI WinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow -) -{ - if (!EApp::init(L"Demo", 250, 150)) - return -1; - - wchar_t str[] = L"1245"; - EString str2 = L"1243"; - - EString str3; - str + str2; - str3 = str + str2; - - auto scene = new EScene(); - EApp::enterScene(scene); - - for (int i = 0; i < 25; i++) - { - auto sprite = new ESprite(L"test.png"); - sprite->setScale(0.5f); - sprite->setPos(ERandom::between(0, EApp::getWidth()), ERandom::between(0, EApp::getHeight())); - scene->add(sprite); - } - - //auto scene = new EScene(); - //scene->retain(); - - //auto text = new EText(L"IJIJIJIJIJIJIJ", L""); - //text->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2); - ////text->setWordWrapping(true); - ////text->setWordWrappingWidth(130); - //text->setRotation(40); - //text->runAction(new EActionLoop(new EActionTwo(new EActionFadeOut(1), new EActionFadeIn(1)))); - //scene->add(text); - - //auto listener = new EListenerKeyboardPress([=]() { - // if (EKeyboardMsg::getKeyValue() == EKeyboardMsg::KEY::SPACE) - // { - // EApp::backScene(new ETransitionMove(0.5f, ETransitionMove::DOWN)); - // } - //}); - //listener->bindWith(scene); - - //auto scene2 = new EScene(); - - //auto bird = new ESprite(L"atlas.png", 5, 982, 34, 24); - //auto animation = new EAnimation(); - //animation->addFrame(new ESpriteFrame(L"atlas.png", 5, 982, 34, 24)); - //animation->addFrame(new ESpriteFrame(L"atlas.png", 61, 982, 34, 24)); - //animation->addFrame(new ESpriteFrame(L"atlas.png", 117, 982, 34, 24)); - //animation->addFrame(new ESpriteFrame(L"atlas.png", 61, 982, 34, 24)); - //bird->runAction(new EActionLoop(animation)); - //bird->setPivot(0.5f, 0.5f); - //bird->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2); - //scene2->add(bird); - - //auto btnStart = new ESprite(L"atlas.png", 702, 234, 116, 70); - //auto btnStartSelected = new ESprite(L"atlas.png", 702, 234, 116, 70); - //btnStartSelected->setPosY(5); - //auto button = new EButton(btnStart, btnStartSelected, [=] { - // /*if (EApp::isPaused()) - // { - // EApp::resume(); - // } - // else - // { - // EApp::pause(); - // }*/ - // EApp::enterScene(scene, new ETransitionMove(1, ETransitionMove::RIGHT)); - //}); - //button->setPivot(0.5f, 0.5f); - //button->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2 + 100); - //scene2->add(button); - - //EMusicUtils::playMusic(L"music.wav", -1); - - ///*scene2->runAction(new EActionSequence(5, - // new EActionCallback([]() { EMusicUtils::playMusic(L"music.wav", -1); }), - // new EActionDelay(3), - // new EActionCallback([]() { EMusicUtils::pauseMusic(L"music.wav"); }), - // new EActionDelay(10), - // new EActionCallback([]() { EMusicUtils::resumeMusic(L"music.wav"); })));*/ - - //EApp::enterScene(scene2, new ETransitionMove(1, ETransitionMove::UP)); - - return EApp::run(); -} diff --git a/Demo/music.wav b/Demo/music.wav deleted file mode 100644 index 9b991a4b..00000000 Binary files a/Demo/music.wav and /dev/null differ diff --git a/Demo/short.wav b/Demo/short.wav deleted file mode 100644 index 76da7877..00000000 Binary files a/Demo/short.wav and /dev/null differ diff --git a/Demo/test.png b/Demo/test.png deleted file mode 100644 index a9ddbade..00000000 Binary files a/Demo/test.png and /dev/null differ diff --git a/Demo/test2.png b/Demo/test2.png deleted file mode 100644 index 23b60462..00000000 Binary files a/Demo/test2.png and /dev/null differ diff --git a/Easy2D.sln b/Easy2D.sln deleted file mode 100644 index 22fa8a42..00000000 --- a/Easy2D.sln +++ /dev/null @@ -1,53 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D\Easy2D.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo\Demo.vcxproj", "{9D85A92F-BCCE-4EF0-BAD3-601C0086661C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleDemo", "ConsoleDemo\ConsoleDemo.vcxproj", "{70931955-FE2D-4A50-93C6-6955A730B0FE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - 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|x86.ActiveCfg = Debug|Win32 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x86.Build.0 = Debug|Win32 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x86.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}.Release|x86.ActiveCfg = Release|Win32 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x86.Build.0 = Release|Win32 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Debug|x64.ActiveCfg = Debug|x64 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Debug|x64.Build.0 = Debug|x64 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Debug|x86.ActiveCfg = Debug|Win32 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Debug|x86.Build.0 = Debug|Win32 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Release|x64.ActiveCfg = Release|x64 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Release|x64.Build.0 = Release|x64 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Release|x86.ActiveCfg = Release|Win32 - {9D85A92F-BCCE-4EF0-BAD3-601C0086661C}.Release|x86.Build.0 = Release|Win32 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Debug|x64.ActiveCfg = Debug|x64 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Debug|x64.Build.0 = Debug|x64 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Debug|x86.ActiveCfg = Debug|Win32 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Debug|x86.Build.0 = Debug|Win32 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Release|x64.ActiveCfg = Release|x64 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Release|x64.Build.0 = Release|x64 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Release|x86.ActiveCfg = Release|Win32 - {70931955-FE2D-4A50-93C6-6955A730B0FE}.Release|x86.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/Easy2D/Easy2D.vcxproj.user b/Easy2D/Easy2D.vcxproj.user deleted file mode 100644 index be250787..00000000 --- a/Easy2D/Easy2D.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Easy2D/Action/EAction.cpp b/core/Action/EAction.cpp similarity index 96% rename from Easy2D/Action/EAction.cpp rename to core/Action/EAction.cpp index 8bbf106e..13ee312d 100644 --- a/Easy2D/Action/EAction.cpp +++ b/core/Action/EAction.cpp @@ -50,7 +50,7 @@ void e2d::EAction::stop() void e2d::EAction::setInterval(LONGLONG milliSeconds) { // öʱ - m_nAnimationInterval = milliSeconds; + SetInterval(m_nAnimationInterval, milliSeconds); } void e2d::EAction::setTarget(ENode * node) diff --git a/Easy2D/Action/EActionCallback.cpp b/core/Action/EActionCallback.cpp similarity index 100% rename from Easy2D/Action/EActionCallback.cpp rename to core/Action/EActionCallback.cpp diff --git a/Easy2D/Action/EActionDelay.cpp b/core/Action/EActionDelay.cpp similarity index 64% rename from Easy2D/Action/EActionDelay.cpp rename to core/Action/EActionDelay.cpp index 856db795..67254fa4 100644 --- a/Easy2D/Action/EActionDelay.cpp +++ b/core/Action/EActionDelay.cpp @@ -3,12 +3,12 @@ e2d::EActionDelay::EActionDelay(float duration) { - setInterval(LONGLONG(duration * 1000)); + setInterval(static_cast(duration * 1000)); } e2d::EActionDelay * e2d::EActionDelay::clone() const { - return new EActionDelay(m_nAnimationInterval / 1000.0f); + return new EActionDelay(static_cast(ToMilliseconds(m_nAnimationInterval.QuadPart)) / 1000.0f); } void e2d::EActionDelay::_init() @@ -20,7 +20,7 @@ void e2d::EActionDelay::_update() { EAction::_update(); // жʱǷ㹻 - if (GetInterval(m_tLast) > m_nAnimationInterval) + if (IsIntervalFull(m_tLast, m_nAnimationInterval)) { this->stop(); } diff --git a/Easy2D/Action/EActionGradual.cpp b/core/Action/EActionGradual.cpp similarity index 70% rename from Easy2D/Action/EActionGradual.cpp rename to core/Action/EActionGradual.cpp index 5ff45ebf..029ad789 100644 --- a/Easy2D/Action/EActionGradual.cpp +++ b/core/Action/EActionGradual.cpp @@ -17,7 +17,7 @@ void e2d::EActionGradual::_init() { EAction::_init(); } - +#include bool e2d::EActionGradual::_isDelayEnough() { // жʱǷ㹻 @@ -27,11 +27,12 @@ bool e2d::EActionGradual::_isDelayEnough() return true; } - if (GetInterval(m_tLast) > m_nAnimationInterval) + if (IsIntervalFull(m_tLast, m_nAnimationInterval)) { // ¼¼ʱ - m_tLast += milliseconds(m_nAnimationInterval); - m_fDuration += static_cast(m_nAnimationInterval); + m_tLast.QuadPart += m_nAnimationInterval.QuadPart; + m_fDuration += static_cast(ToMilliseconds(m_nAnimationInterval.QuadPart)); + std::cout << ToMilliseconds(m_nAnimationInterval.QuadPart) << std::endl; // 㶯 m_fRateOfProgress = m_fDuration / m_fTotalDuration; return true; diff --git a/Easy2D/Action/EActionLoop.cpp b/core/Action/EActionLoop.cpp similarity index 100% rename from Easy2D/Action/EActionLoop.cpp rename to core/Action/EActionLoop.cpp diff --git a/Easy2D/Action/EActionMoveBy.cpp b/core/Action/EActionMoveBy.cpp similarity index 100% rename from Easy2D/Action/EActionMoveBy.cpp rename to core/Action/EActionMoveBy.cpp diff --git a/Easy2D/Action/EActionMoveTo.cpp b/core/Action/EActionMoveTo.cpp similarity index 100% rename from Easy2D/Action/EActionMoveTo.cpp rename to core/Action/EActionMoveTo.cpp diff --git a/Easy2D/Action/EActionOpacityBy.cpp b/core/Action/EActionOpacityBy.cpp similarity index 100% rename from Easy2D/Action/EActionOpacityBy.cpp rename to core/Action/EActionOpacityBy.cpp diff --git a/Easy2D/Action/EActionOpacityTo.cpp b/core/Action/EActionOpacityTo.cpp similarity index 100% rename from Easy2D/Action/EActionOpacityTo.cpp rename to core/Action/EActionOpacityTo.cpp diff --git a/Easy2D/Action/EActionRotateBy.cpp b/core/Action/EActionRotateBy.cpp similarity index 100% rename from Easy2D/Action/EActionRotateBy.cpp rename to core/Action/EActionRotateBy.cpp diff --git a/Easy2D/Action/EActionRotateTo.cpp b/core/Action/EActionRotateTo.cpp similarity index 100% rename from Easy2D/Action/EActionRotateTo.cpp rename to core/Action/EActionRotateTo.cpp diff --git a/Easy2D/Action/EActionScaleBy.cpp b/core/Action/EActionScaleBy.cpp similarity index 100% rename from Easy2D/Action/EActionScaleBy.cpp rename to core/Action/EActionScaleBy.cpp diff --git a/Easy2D/Action/EActionScaleTo.cpp b/core/Action/EActionScaleTo.cpp similarity index 100% rename from Easy2D/Action/EActionScaleTo.cpp rename to core/Action/EActionScaleTo.cpp diff --git a/Easy2D/Action/EActionSequence.cpp b/core/Action/EActionSequence.cpp similarity index 67% rename from Easy2D/Action/EActionSequence.cpp rename to core/Action/EActionSequence.cpp index 7ad50209..e2771639 100644 --- a/Easy2D/Action/EActionSequence.cpp +++ b/core/Action/EActionSequence.cpp @@ -21,9 +21,9 @@ e2d::EActionSequence::EActionSequence(int number, EAction * action1, ...) : e2d::EActionSequence::~EActionSequence() { - for (auto action : m_vActions) + for (auto action = m_vActions.begin(); action != m_vActions.end(); action++) { - SafeRelease(&action); + SafeRelease(&(*action)); } } @@ -33,9 +33,9 @@ void e2d::EActionSequence::_init() // жĿ if (m_pTarget) { - for (auto action : m_vActions) + for (auto action = m_vActions.begin(); action != m_vActions.end(); action++) { - action->setTarget(m_pTarget); + (*action)->setTarget(m_pTarget); } } // ʼһ @@ -66,18 +66,18 @@ void e2d::EActionSequence::_update() void e2d::EActionSequence::_reset() { EAction::_reset(); - for (auto action : m_vActions) + for (auto action = m_vActions.begin(); action != m_vActions.end(); action++) { - action->_reset(); + (*action)->_reset(); } m_nActionIndex = 0; } void e2d::EActionSequence::_resetTime() { - for (auto action : m_vActions) + for (auto action = m_vActions.begin(); action != m_vActions.end(); action++) { - action->_resetTime(); + (*action)->_resetTime(); } } @@ -93,9 +93,9 @@ void e2d::EActionSequence::addAction(EAction * action) e2d::EActionSequence * e2d::EActionSequence::clone() const { auto a = new EActionSequence(); - for (auto action : m_vActions) + for (auto action = m_vActions.begin(); action != m_vActions.end(); action++) { - a->addAction(action->clone()); + a->addAction((*action)->clone()); } return a; } @@ -103,15 +103,15 @@ e2d::EActionSequence * e2d::EActionSequence::clone() const e2d::EActionSequence * e2d::EActionSequence::reverse(bool actionReverse) const { auto a = new EActionSequence(); - for (auto action : a->m_vActions) + for (auto action = m_vActions.begin(); action != m_vActions.end(); action++) { if (actionReverse) { - a->addAction(action->reverse()); + a->addAction((*action)->reverse()); } else { - a->addAction(action->clone()); + a->addAction((*action)->clone()); } } // ˳ diff --git a/Easy2D/Action/EActionTwo.cpp b/core/Action/EActionTwo.cpp similarity index 100% rename from Easy2D/Action/EActionTwo.cpp rename to core/Action/EActionTwo.cpp diff --git a/Easy2D/Action/EActionTwoAtSameTime.cpp b/core/Action/EActionTwoAtSameTime.cpp similarity index 100% rename from Easy2D/Action/EActionTwoAtSameTime.cpp rename to core/Action/EActionTwoAtSameTime.cpp diff --git a/Easy2D/Action/EAnimation.cpp b/core/Action/EAnimation.cpp similarity index 75% rename from Easy2D/Action/EAnimation.cpp rename to core/Action/EAnimation.cpp index f8cc4e66..42f752b3 100644 --- a/Easy2D/Action/EAnimation.cpp +++ b/core/Action/EAnimation.cpp @@ -17,9 +17,9 @@ e2d::EAnimation::EAnimation(LONGLONG frameDelay) : e2d::EAnimation::~EAnimation() { - for (auto frame : m_vFrames) + for (auto frame = m_vFrames.begin(); frame != m_vFrames.end(); frame++) { - SafeRelease(&frame); + SafeRelease(&(*frame)); } } @@ -39,10 +39,10 @@ void e2d::EAnimation::_update() } // жʱǷ㹻 - while (GetInterval(m_tLast) > m_nAnimationInterval) + while (IsIntervalFull(m_tLast, m_nAnimationInterval)) { // ¼¼ʱ - m_tLast += milliseconds(m_nAnimationInterval); + m_tLast.QuadPart += m_nAnimationInterval.QuadPart; // ؾ֡ reinterpret_cast(m_pTarget)->loadFrom(m_vFrames[m_nFrameIndex]); m_nFrameIndex++; @@ -72,10 +72,10 @@ void e2d::EAnimation::addFrame(ESpriteFrame * frame) e2d::EAnimation * e2d::EAnimation::clone() const { - auto a = new EAnimation(this->m_nAnimationInterval); - for (auto f : m_vFrames) + auto a = new EAnimation(ToMilliseconds(m_nAnimationInterval.QuadPart)); + for (auto frame = m_vFrames.begin(); frame != m_vFrames.end(); frame++) { - a->addFrame(f); + a->addFrame((*frame)); } return a; } diff --git a/Easy2D/Base/EApp.cpp b/core/Base/EApp.cpp similarity index 90% rename from Easy2D/Base/EApp.cpp rename to core/Base/EApp.cpp index 1647a675..1026359d 100644 --- a/Easy2D/Base/EApp.cpp +++ b/core/Base/EApp.cpp @@ -5,12 +5,10 @@ #include "..\etransitions.h" #include "..\etools.h" #include -#include #include #pragma comment (lib ,"imm32.lib") - -using namespace std::this_thread; -using namespace std::chrono; +#include +#pragma comment(lib, "winmm.lib") // Ψһʵָ @@ -18,7 +16,7 @@ static e2d::EApp * s_pInstance = nullptr; // ջ static std::stack s_SceneStack; // Ϸʼʱ -static steady_clock::time_point s_tStart; +static LARGE_INTEGER s_tStart; e2d::EApp::EApp() @@ -26,12 +24,19 @@ e2d::EApp::EApp() , m_bPaused(false) , m_bManualPaused(false) , m_bShowConsole(false) - , m_nAnimationInterval(17LL) + , m_nAnimationInterval() , m_ClearColor(EColor::BLACK) , m_pTransition(nullptr) , m_pCurrentScene(nullptr) , m_pNextScene(nullptr) { + CoInitialize(NULL); + + // ȡʱƵ + LARGE_INTEGER tFreq; + QueryPerformanceFrequency(&tFreq); + // Ĭ֡Ϊ 60 + m_nAnimationInterval.QuadPart = static_cast(1.0 / 60 * tFreq.QuadPart); } e2d::EApp::~EApp() @@ -41,6 +46,7 @@ e2d::EApp::~EApp() SafeReleaseInterface(&GetFactory()); SafeReleaseInterface(&GetImagingFactory()); SafeReleaseInterface(&GetDirectWriteFactory()); + CoUninitialize(); } e2d::EApp * e2d::EApp::getInstance() @@ -49,19 +55,18 @@ e2d::EApp * e2d::EApp::getInstance() { s_pInstance = new EApp(); } - return s_pInstance; // ȡ EApp Ψһʵ + return s_pInstance; } bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, const EWindowStyle &wStyle /* = nullptr */) { - CoInitialize(NULL); - + EApp * pApp = EApp::getInstance(); HRESULT hr; // 洰ʽ - EApp::getInstance()->m_WindowStyle = wStyle; + pApp->m_WindowStyle = wStyle; // 洰 - EApp::getInstance()->m_sTitle = title; + pApp->m_sTitle = title; // עᴰ WNDCLASSEX wcex = { sizeof(WNDCLASSEX) }; @@ -177,8 +182,24 @@ int e2d::EApp::run() SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } + // ʱ + LONG nWait = 0L; + // ʱ + LONGLONG nInterval; + // һ֡ʱ + LARGE_INTEGER tLast; + // ʱƵ + LARGE_INTEGER tFreq; + + // ޸ʱ侫 + timeBeginPeriod(1); + // ȡʱƵ + QueryPerformanceFrequency(&tFreq); + // ˢµǰʱ + QueryPerformanceCounter(&GetNow()); // ¼ʼʱ - s_tStart = steady_clock::now(); + s_tStart = GetNow(); + tLast = GetNow(); // Ϣ MSG msg; @@ -190,14 +211,38 @@ int e2d::EApp::run() TranslateMessage(&msg); DispatchMessage(&msg); } - // ִѭ - pApp->_mainLoop(); + + // ˢµǰʱ + QueryPerformanceCounter(&GetNow()); + // ʱ + nInterval = GetNow().QuadPart - tLast.QuadPart; + // жϼʱǷ㹻 + if (nInterval >= pApp->m_nAnimationInterval.QuadPart) + { + // ¼ǰʱ + tLast.QuadPart += pApp->m_nAnimationInterval.QuadPart; + // Ϸ + pApp->_update(); + // ˢϷ + pApp->_render(); + } + else + { + // ʱ + nWait = static_cast(ToMilliseconds(pApp->m_nAnimationInterval.QuadPart - nInterval) - 1LL); + // ̣߳ͷ CPU ռ + if (nWait > 1L) + { + Sleep(nWait); + } + } } // رտ̨ EApp::showConsole(false); + // ʱ侫 + timeEndPeriod(1); - CoUninitialize(); return 0; } @@ -289,41 +334,6 @@ bool e2d::EApp::onCloseWindow() return true; } -void e2d::EApp::_mainLoop() -{ - // ʱ - static LONGLONG nWaitMS = 0L; - // ʱ - static LONGLONG nInterval; - // һ֡ʱ - static steady_clock::time_point tLast = steady_clock::now(); - - // ˢµǰʱ - GetNow() = steady_clock::now(); - // ʱ - nInterval = GetInterval(tLast); - // жϼʱǷ㹻 - if (nInterval >= m_nAnimationInterval) - { - // ¼ǰʱ - tLast += microseconds(m_nAnimationInterval); - // Ϸ - _update(); - // ˢϷ - _render(); - } - else - { - // ʱ - nWaitMS = m_nAnimationInterval - nInterval - 1; - // ̣߳ͷ CPU ռ - if (nWaitMS > 1LL) - { - sleep_for(milliseconds(nWaitMS)); - } - } -} - void e2d::EApp::_update() { if (isPaused()) @@ -512,7 +522,11 @@ void e2d::EApp::clearScene() void e2d::EApp::setFPS(UINT32 fps) { fps = min(max(fps, 30), 120); - s_pInstance->m_nAnimationInterval = 1000 / fps; + + // ȡʱƵ + LARGE_INTEGER tFreq; + QueryPerformanceFrequency(&tFreq); + EApp::getInstance()->m_nAnimationInterval.QuadPart = static_cast(1.0 / fps * tFreq.QuadPart); } e2d::EScene * e2d::EApp::getCurrentScene() @@ -570,7 +584,7 @@ e2d::EWindowStyle e2d::EApp::getWindowStyle() LONGLONG e2d::EApp::getTotalDurationFromStart() { - return GetInterval(s_tStart); + return (s_tStart.QuadPart - GetNow().QuadPart) * 1000LL / GetFreq().QuadPart; } void e2d::EApp::hideWindow() @@ -614,7 +628,7 @@ void e2d::EApp::_enterNextScene() void e2d::EApp::_updateTime() { // ˢµǰʱ - GetNow() = steady_clock::now(); + QueryPerformanceCounter(&GetNow()); // öͶʱ EActionManager::_resetAllActions(); ETimerManager::_resetAllTimers(); diff --git a/Easy2D/Base/EScene.cpp b/core/Base/EScene.cpp similarity index 100% rename from Easy2D/Base/EScene.cpp rename to core/Base/EScene.cpp diff --git a/Easy2D/Common/EFont.cpp b/core/Common/EFont.cpp similarity index 92% rename from Easy2D/Common/EFont.cpp rename to core/Common/EFont.cpp index 21775b3f..fe722cc7 100644 --- a/Easy2D/Common/EFont.cpp +++ b/core/Common/EFont.cpp @@ -12,7 +12,12 @@ e2d::EFont::EFont() } e2d::EFont::EFont(EString fontFamily, float fontSize /* = 22 */, UINT32 color /* = EColor::WHITE */, UINT32 fontWeight, bool italic /* = false */) - : EFont() + : m_pTextFormat(nullptr) + , m_Color(EColor::WHITE) + , m_fFontSize(22) + , m_FontWeight(EFontWeight::REGULAR) + , m_bItalic(false) + , m_bRecreateNeeded(true) { this->setFamily(fontFamily); this->setSize(fontSize); diff --git a/Easy2D/Common/EObject.cpp b/core/Common/EObject.cpp similarity index 100% rename from Easy2D/Common/EObject.cpp rename to core/Common/EObject.cpp diff --git a/Easy2D/Common/ESpriteFrame.cpp b/core/Common/ESpriteFrame.cpp similarity index 75% rename from Easy2D/Common/ESpriteFrame.cpp rename to core/Common/ESpriteFrame.cpp index d4d61043..347fae78 100644 --- a/Easy2D/Common/ESpriteFrame.cpp +++ b/core/Common/ESpriteFrame.cpp @@ -10,39 +10,63 @@ e2d::ESpriteFrame::ESpriteFrame() } e2d::ESpriteFrame::ESpriteFrame(ETexture * texture) - : ESpriteFrame() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_fSourceClipWidth(0) + , m_fSourceClipHeight(0) + , m_pTexture(nullptr) { _setTexture(texture); } e2d::ESpriteFrame::ESpriteFrame(const EString & imageFileName) - : ESpriteFrame() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_fSourceClipWidth(0) + , m_fSourceClipHeight(0) + , m_pTexture(nullptr) { _setTexture(new ETexture(imageFileName)); } e2d::ESpriteFrame::ESpriteFrame(LPCTSTR resourceName, LPCTSTR resourceType) - : ESpriteFrame() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_fSourceClipWidth(0) + , m_fSourceClipHeight(0) + , m_pTexture(nullptr) { _setTexture(new ETexture(resourceName, resourceType)); } e2d::ESpriteFrame::ESpriteFrame(ETexture * texture, float x, float y, float width, float height) - : ESpriteFrame() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_fSourceClipWidth(0) + , m_fSourceClipHeight(0) + , m_pTexture(nullptr) { _setTexture(texture); _clipTexture(x, y, width, height); } e2d::ESpriteFrame::ESpriteFrame(const EString & imageFileName, float x, float y, float width, float height) - : ESpriteFrame() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_fSourceClipWidth(0) + , m_fSourceClipHeight(0) + , m_pTexture(nullptr) { _setTexture(new ETexture(imageFileName)); _clipTexture(x, y, width, height); } e2d::ESpriteFrame::ESpriteFrame(LPCTSTR resourceName, LPCTSTR resourceType, float x, float y, float width, float height) - : ESpriteFrame() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_fSourceClipWidth(0) + , m_fSourceClipHeight(0) + , m_pTexture(nullptr) { _setTexture(new ETexture(resourceName, resourceType)); _clipTexture(x, y, width, height); diff --git a/Easy2D/Common/EString.cpp b/core/Common/EString.cpp similarity index 99% rename from Easy2D/Common/EString.cpp rename to core/Common/EString.cpp index ea29e761..c02b12aa 100644 --- a/Easy2D/Common/EString.cpp +++ b/core/Common/EString.cpp @@ -6,7 +6,8 @@ using namespace e2d; EString::EString() { _size = 0; - _string = nullptr; + _string = new wchar_t[1]; + _string[0] = 0; } e2d::EString::EString(const wchar_t ch) diff --git a/Easy2D/Common/ETexture.cpp b/core/Common/ETexture.cpp similarity index 96% rename from Easy2D/Common/ETexture.cpp rename to core/Common/ETexture.cpp index c064f90c..e8e94b37 100644 --- a/Easy2D/Common/ETexture.cpp +++ b/core/Common/ETexture.cpp @@ -337,13 +337,13 @@ bool e2d::ETexture::preload(LPCTSTR resourceName, LPCTSTR resourceType) void e2d::ETexture::clearCache() { - for (auto child : s_mBitmapsFromFile) + for (auto child = s_mBitmapsFromFile.begin(); child != s_mBitmapsFromFile.end(); child++) { - SafeReleaseInterface(&child.second); + SafeReleaseInterface(&(*child).second); } - for (auto child : s_mBitmapsFromResource) + for (auto child = s_mBitmapsFromFile.begin(); child != s_mBitmapsFromFile.end(); child++) { - SafeReleaseInterface(&child.second); + SafeReleaseInterface(&(*child).second); } s_mBitmapsFromFile.clear(); s_mBitmapsFromResource.clear(); diff --git a/Easy2D/Geometry/ECircle.cpp b/core/Geometry/ECircle.cpp similarity index 94% rename from Easy2D/Geometry/ECircle.cpp rename to core/Geometry/ECircle.cpp index 15ea3ad4..b6cc178f 100644 --- a/Easy2D/Geometry/ECircle.cpp +++ b/core/Geometry/ECircle.cpp @@ -8,13 +8,13 @@ e2d::ECircle::ECircle() } e2d::ECircle::ECircle(EPoint center, float radius) - : ECircle() + : m_pD2dCircle(nullptr) { this->_setCircle(center, radius); } e2d::ECircle::ECircle(ENode * node) - : ECircle() + : m_pD2dCircle(nullptr) { float minSide = min(node->getRealWidth(), node->getRealHeight()); this->_setCircle( diff --git a/Easy2D/Geometry/EEllipse.cpp b/core/Geometry/EEllipse.cpp similarity index 94% rename from Easy2D/Geometry/EEllipse.cpp rename to core/Geometry/EEllipse.cpp index feb3e740..264b600d 100644 --- a/Easy2D/Geometry/EEllipse.cpp +++ b/core/Geometry/EEllipse.cpp @@ -8,13 +8,13 @@ e2d::EEllipse::EEllipse() } e2d::EEllipse::EEllipse(EPoint center, float radiusX, float radiusY) - : EEllipse() + : m_pD2dEllipse(nullptr) { this->_setEllipse(center, radiusX, radiusY); } e2d::EEllipse::EEllipse(ENode * node) - : EEllipse() + : m_pD2dEllipse(nullptr) { this->_setEllipse( EPoint( diff --git a/Easy2D/Geometry/EGeometry.cpp b/core/Geometry/EGeometry.cpp similarity index 97% rename from Easy2D/Geometry/EGeometry.cpp rename to core/Geometry/EGeometry.cpp index 236062c6..daaab97f 100644 --- a/Easy2D/Geometry/EGeometry.cpp +++ b/core/Geometry/EGeometry.cpp @@ -91,7 +91,7 @@ e2d::EPhysicsMsg::INTERSECT_RELATION e2d::EGeometry::_intersectWith(EGeometry * return EPhysicsMsg::INTERSECT_RELATION(relation); } - return EPhysicsMsg::INTERSECT_RELATION::UNKNOWN; + return EPhysicsMsg::UNKNOWN; } void e2d::EGeometry::_transform() diff --git a/Easy2D/Geometry/ERectangle.cpp b/core/Geometry/ERectangle.cpp similarity index 93% rename from Easy2D/Geometry/ERectangle.cpp rename to core/Geometry/ERectangle.cpp index b8152447..ef7143ab 100644 --- a/Easy2D/Geometry/ERectangle.cpp +++ b/core/Geometry/ERectangle.cpp @@ -8,13 +8,13 @@ e2d::ERectangle::ERectangle() } e2d::ERectangle::ERectangle(float x, float y, float width, float height) - : ERectangle() + : m_pD2dRectangle(nullptr) { this->_setRect(x, y, x + width, y + height); } e2d::ERectangle::ERectangle(ENode * node) - : ERectangle() + : m_pD2dRectangle(nullptr) { this->_setRect( 0, diff --git a/Easy2D/Listener/EListener.cpp b/core/Listener/EListener.cpp similarity index 92% rename from Easy2D/Listener/EListener.cpp rename to core/Listener/EListener.cpp index 12db408b..8d2ddb0f 100644 --- a/Easy2D/Listener/EListener.cpp +++ b/core/Listener/EListener.cpp @@ -10,7 +10,10 @@ e2d::EListener::EListener() } e2d::EListener::EListener(const EString & name) - : EListener() + : m_bRunning(false) + , m_bAlways(false) + , m_pParentNode(nullptr) + , m_bSwallow(false) { m_sName = name; } diff --git a/Easy2D/Listener/EListenerKeyboard.cpp b/core/Listener/EListenerKeyboard.cpp similarity index 100% rename from Easy2D/Listener/EListenerKeyboard.cpp rename to core/Listener/EListenerKeyboard.cpp diff --git a/Easy2D/Listener/EListenerKeyboardPress.cpp b/core/Listener/EListenerKeyboardPress.cpp similarity index 89% rename from Easy2D/Listener/EListenerKeyboardPress.cpp rename to core/Listener/EListenerKeyboardPress.cpp index c0454d86..096f0faa 100644 --- a/Easy2D/Listener/EListenerKeyboardPress.cpp +++ b/core/Listener/EListenerKeyboardPress.cpp @@ -22,7 +22,7 @@ e2d::EListenerKeyboardPress::EListenerKeyboardPress(const EString & name, const void e2d::EListenerKeyboardPress::_callOn() { - if (EKeyboardMsg::getMsg() == EKeyboardMsg::KEYBOARD_MSG::KEY_DOWN) + if (EKeyboardMsg::getMsg() == EKeyboardMsg::KEY_DOWN) { if (m_Callback) { diff --git a/Easy2D/Listener/EListenerMouse.cpp b/core/Listener/EListenerMouse.cpp similarity index 100% rename from Easy2D/Listener/EListenerMouse.cpp rename to core/Listener/EListenerMouse.cpp diff --git a/Easy2D/Listener/EListenerMouseClick.cpp b/core/Listener/EListenerMouseClick.cpp similarity index 100% rename from Easy2D/Listener/EListenerMouseClick.cpp rename to core/Listener/EListenerMouseClick.cpp diff --git a/Easy2D/Listener/EListenerMouseDoubleClick.cpp b/core/Listener/EListenerMouseDoubleClick.cpp similarity index 100% rename from Easy2D/Listener/EListenerMouseDoubleClick.cpp rename to core/Listener/EListenerMouseDoubleClick.cpp diff --git a/Easy2D/Listener/EListenerMouseDrag.cpp b/core/Listener/EListenerMouseDrag.cpp similarity index 100% rename from Easy2D/Listener/EListenerMouseDrag.cpp rename to core/Listener/EListenerMouseDrag.cpp diff --git a/Easy2D/Listener/EListenerMousePress.cpp b/core/Listener/EListenerMousePress.cpp similarity index 100% rename from Easy2D/Listener/EListenerMousePress.cpp rename to core/Listener/EListenerMousePress.cpp diff --git a/Easy2D/Listener/EListenerPhysics.cpp b/core/Listener/EListenerPhysics.cpp similarity index 100% rename from Easy2D/Listener/EListenerPhysics.cpp rename to core/Listener/EListenerPhysics.cpp diff --git a/Easy2D/Listener/EListenerPhysicsCollision.cpp b/core/Listener/EListenerPhysicsCollision.cpp similarity index 100% rename from Easy2D/Listener/EListenerPhysicsCollision.cpp rename to core/Listener/EListenerPhysicsCollision.cpp diff --git a/Easy2D/Manager/EActionManager.cpp b/core/Manager/EActionManager.cpp similarity index 53% rename from Easy2D/Manager/EActionManager.cpp rename to core/Manager/EActionManager.cpp index f0e5e0f6..29d1fc84 100644 --- a/Easy2D/Manager/EActionManager.cpp +++ b/core/Manager/EActionManager.cpp @@ -21,16 +21,16 @@ void e2d::EActionManager::startAllActionsBindedWith(ENode * pTargetNode) { if (pTargetNode) { - for (const auto &action : s_vActions) + for (auto action = s_vActions.begin(); action != s_vActions.end(); action++) { - if (action->getTarget() == pTargetNode) + if ((*action)->getTarget() == pTargetNode) { - action->start(); + (*action)->start(); } } - for (const auto &child : pTargetNode->getChildren()) + for (auto child = pTargetNode->getChildren().begin(); child != pTargetNode->getChildren().end(); child++) { - EActionManager::startAllActionsBindedWith(child); + EActionManager::startAllActionsBindedWith((*child)); } } } @@ -39,16 +39,16 @@ void e2d::EActionManager::pauseAllActionsBindedWith(ENode * pTargetNode) { if (pTargetNode) { - for (const auto &action : s_vActions) + for (auto action = s_vActions.begin(); action != s_vActions.end(); action++) { - if (action->getTarget() == pTargetNode) + if ((*action)->getTarget() == pTargetNode) { - action->pause(); + (*action)->pause(); } } - for (const auto &child : pTargetNode->getChildren()) + for (auto child = pTargetNode->getChildren().begin(); child != pTargetNode->getChildren().end(); child++) { - EActionManager::pauseAllActionsBindedWith(child); + EActionManager::pauseAllActionsBindedWith((*child)); } } } @@ -57,16 +57,16 @@ void e2d::EActionManager::stopAllActionsBindedWith(ENode * pTargetNode) { if (pTargetNode) { - for (const auto &action : s_vActions) + for (auto action = s_vActions.begin(); action != s_vActions.end(); action++) { - if (action->getTarget() == pTargetNode) + if ((*action)->getTarget() == pTargetNode) { - action->stop(); + (*action)->stop(); } } - for (const auto &child : pTargetNode->getChildren()) + for (auto child = pTargetNode->getChildren().begin(); child != pTargetNode->getChildren().end(); child++) { - EActionManager::stopAllActionsBindedWith(child); + EActionManager::stopAllActionsBindedWith((*child)); } } } @@ -93,25 +93,25 @@ void e2d::EActionManager::_clearAllActionsBindedWith(ENode * pTargetNode) void e2d::EActionManager::startAllActions() { - for (auto child : EApp::getCurrentScene()->getChildren()) + for (auto child = EApp::getCurrentScene()->getChildren().begin(); child != EApp::getCurrentScene()->getChildren().end(); child++) { - EActionManager::startAllActionsBindedWith(child); + EActionManager::startAllActionsBindedWith((*child)); } } void e2d::EActionManager::pauseAllActions() { - for (auto child : EApp::getCurrentScene()->getChildren()) + for (auto child = EApp::getCurrentScene()->getChildren().begin(); child != EApp::getCurrentScene()->getChildren().end(); child++) { - EActionManager::pauseAllActionsBindedWith(child); + EActionManager::pauseAllActionsBindedWith((*child)); } } void e2d::EActionManager::stopAllActions() { - for (auto child : EApp::getCurrentScene()->getChildren()) + for (auto child = EApp::getCurrentScene()->getChildren().begin(); child != EApp::getCurrentScene()->getChildren().end(); child++) { - EActionManager::stopAllActionsBindedWith(child); + EActionManager::stopAllActionsBindedWith((*child)); } } @@ -122,9 +122,9 @@ void e2d::EActionManager::_clearManager() void e2d::EActionManager::_resetAllActions() { - for (const auto & action : s_vActions) + for (auto action = s_vActions.begin(); action != s_vActions.end(); action++) { - action->_resetTime(); + (*action)->_resetTime(); } } diff --git a/Easy2D/Manager/EMsgManager.cpp b/core/Manager/EMsgManager.cpp similarity index 77% rename from Easy2D/Manager/EMsgManager.cpp rename to core/Manager/EMsgManager.cpp index ca0f10d9..21b2cd99 100644 --- a/Easy2D/Manager/EMsgManager.cpp +++ b/core/Manager/EMsgManager.cpp @@ -110,22 +110,22 @@ void e2d::EMsgManager::bindListener(EListenerKeyboard * listener, ENode * pParen void e2d::EMsgManager::startMouseListeners(const EString & name) { - for (auto l : s_vMouseListeners) + for (auto l = s_vMouseListeners.begin(); l != s_vMouseListeners.end(); l++) { - if (l->getName() == name) + if ((*l)->getName() == name) { - l->start(); + (*l)->start(); } } } void e2d::EMsgManager::stopMouseListeners(const EString & name) { - for (auto l : s_vMouseListeners) + for (auto l = s_vMouseListeners.begin(); l != s_vMouseListeners.end(); l++) { - if (l->getName() == name) + if ((*l)->getName() == name) { - l->stop(); + (*l)->stop(); } } } @@ -151,11 +151,11 @@ void e2d::EMsgManager::delMouseListeners(const EString & name) void e2d::EMsgManager::startKeyboardListeners(const EString & name) { // Ϣ - for (auto l : s_vKeyboardListeners) + for (auto l = s_vKeyboardListeners.begin(); l != s_vKeyboardListeners.end(); l++) { - if (l->getName() == name) + if ((*l)->getName() == name) { - l->start(); + (*l)->start(); } } } @@ -163,11 +163,11 @@ void e2d::EMsgManager::startKeyboardListeners(const EString & name) void e2d::EMsgManager::stopKeyboardListeners(const EString & name) { // ֹͣϢ - for (auto l : s_vKeyboardListeners) + for (auto l = s_vKeyboardListeners.begin(); l != s_vKeyboardListeners.end(); l++) { - if (l->getName() == name) + if ((*l)->getName() == name) { - l->stop(); + (*l)->stop(); } } } @@ -202,31 +202,31 @@ void e2d::EMsgManager::stopAllMouseListenersBindedWith(EScene * pParentScene) void e2d::EMsgManager::startAllMouseListenersBindedWith(ENode * pParentNode) { - for (auto l : s_vMouseListeners) + for (auto l = s_vMouseListeners.begin(); l != s_vMouseListeners.end(); l++) { - if (l->getParentNode() == pParentNode) + if ((*l)->getParentNode() == pParentNode) { - l->start(); + (*l)->start(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - EMsgManager::startAllMouseListenersBindedWith(child); + EMsgManager::startAllMouseListenersBindedWith((*child)); } } void e2d::EMsgManager::stopAllMouseListenersBindedWith(ENode * pParentNode) { - for (auto l : s_vMouseListeners) + for (auto l = s_vMouseListeners.begin(); l != s_vMouseListeners.end(); l++) { - if (l->getParentNode() == pParentNode) + if ((*l)->getParentNode() == pParentNode) { - l->stop(); + (*l)->stop(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - EMsgManager::stopAllMouseListenersBindedWith(child); + EMsgManager::stopAllMouseListenersBindedWith((*child)); } } @@ -242,31 +242,31 @@ void e2d::EMsgManager::stopAllKeyboardListenersBindedWith(EScene * pParentScene) void e2d::EMsgManager::startAllKeyboardListenersBindedWith(ENode * pParentNode) { - for (auto l : s_vKeyboardListeners) + for (auto l = s_vKeyboardListeners.begin(); l != s_vKeyboardListeners.end(); l++) { - if (l->getParentNode() == pParentNode) + if ((*l)->getParentNode() == pParentNode) { - l->start(); + (*l)->start(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - EMsgManager::startAllKeyboardListenersBindedWith(child); + EMsgManager::startAllKeyboardListenersBindedWith((*child)); } } void e2d::EMsgManager::stopAllKeyboardListenersBindedWith(ENode * pParentNode) { - for (auto l : s_vKeyboardListeners) + for (auto l = s_vKeyboardListeners.begin(); l != s_vKeyboardListeners.end(); l++) { - if (l->getParentNode() == pParentNode) + if ((*l)->getParentNode() == pParentNode) { - l->stop(); + (*l)->stop(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - EMsgManager::stopAllKeyboardListenersBindedWith(child); + EMsgManager::stopAllKeyboardListenersBindedWith((*child)); } } diff --git a/Easy2D/Manager/EObjectManager.cpp b/core/Manager/EObjectManager.cpp similarity index 100% rename from Easy2D/Manager/EObjectManager.cpp rename to core/Manager/EObjectManager.cpp diff --git a/Easy2D/Manager/EPhysicsManager.cpp b/core/Manager/EPhysicsManager.cpp similarity index 78% rename from Easy2D/Manager/EPhysicsManager.cpp rename to core/Manager/EPhysicsManager.cpp index 70091872..8094d274 100644 --- a/Easy2D/Manager/EPhysicsManager.cpp +++ b/core/Manager/EPhysicsManager.cpp @@ -17,8 +17,9 @@ void e2d::EPhysicsManager::PhysicsGeometryProc(EGeometry * pActiveGeometry) // pActiveGeometry Ϊ EPhysicsMsg::s_pActiveGeometry = pActiveGeometry; // жϱ仯״̬ - for (auto &pPassiveGeometry : s_vGeometries) + for (UINT i = 0; i < s_vGeometries.size(); i++) { + auto pPassiveGeometry = s_vGeometries[i]; // ж if (!pPassiveGeometry->getParentNode() || (pPassiveGeometry->getParentNode()->getParentScene() != EApp::getCurrentScene())) @@ -100,7 +101,7 @@ void e2d::EPhysicsManager::_delGeometry(EGeometry * geometry) { if (geometry) { - for (size_t i = 0; i < s_vGeometries.size(); i++) + for (UINT i = 0; i < s_vGeometries.size(); i++) { if (s_vGeometries[i] == geometry) { @@ -114,22 +115,22 @@ void e2d::EPhysicsManager::_delGeometry(EGeometry * geometry) void e2d::EPhysicsManager::startListeners(const EString & name) { - for (auto listener : s_vListeners) + for (auto listener = s_vListeners.begin(); listener != s_vListeners.end(); listener++) { - if (listener->getName() == name) + if ((*listener)->getName() == name) { - listener->start(); + (*listener)->start(); } } } void e2d::EPhysicsManager::stopListeners(const EString & name) { - for (auto listener : s_vListeners) + for (auto listener = s_vListeners.begin(); listener != s_vListeners.end(); listener++) { - if (listener->getName() == name) + if ((*listener)->getName() == name) { - listener->stop(); + (*listener)->stop(); } } } @@ -163,31 +164,31 @@ void e2d::EPhysicsManager::stopAllListenersBindedWith(EScene * pParentScene) void e2d::EPhysicsManager::startAllListenersBindedWith(ENode * pParentNode) { - for (auto listener : s_vListeners) + for (auto listener = s_vListeners.begin(); listener != s_vListeners.end(); listener++) { - if (listener->getParentNode() == pParentNode) + if ((*listener)->getParentNode() == pParentNode) { - listener->start(); + (*listener)->start(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - EPhysicsManager::startAllListenersBindedWith(child); + EPhysicsManager::startAllListenersBindedWith((*child)); } } void e2d::EPhysicsManager::stopAllListenersBindedWith(ENode * pParentNode) { - for (auto listener : s_vListeners) + for (auto listener = s_vListeners.begin(); listener != s_vListeners.end(); listener++) { - if (listener->getParentNode() == pParentNode) + if ((*listener)->getParentNode() == pParentNode) { - listener->stop(); + (*listener)->stop(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - EPhysicsManager::stopAllListenersBindedWith(child); + EPhysicsManager::stopAllListenersBindedWith((*child)); } } @@ -208,7 +209,7 @@ void e2d::EPhysicsManager::_clearManager() void e2d::EPhysicsManager::_clearAllListenersBindedWith(ENode * pParentNode) { - for (size_t i = 0; i < s_vListeners.size();) + for (UINT i = 0; i < s_vListeners.size();) { auto listener = s_vListeners[i]; if (listener->getParentNode() == pParentNode) diff --git a/Easy2D/Manager/ETimerManager.cpp b/core/Manager/ETimerManager.cpp similarity index 72% rename from Easy2D/Manager/ETimerManager.cpp rename to core/Manager/ETimerManager.cpp index d4192aa1..8e02e440 100644 --- a/Easy2D/Manager/ETimerManager.cpp +++ b/core/Manager/ETimerManager.cpp @@ -47,22 +47,22 @@ void e2d::ETimerManager::bindTimer(ETimer * timer, ENode * pParentNode) void e2d::ETimerManager::startTimers(const EString & name) { - for (auto t : s_vTimers) + for (auto timer = s_vTimers.begin(); timer != s_vTimers.end(); timer++) { - if (t->getName() == name) + if ((*timer)->getName() == name) { - t->start(); + (*timer)->start(); } } } void e2d::ETimerManager::stopTimers(const EString & name) { - for (auto t : s_vTimers) + for (auto timer = s_vTimers.begin(); timer != s_vTimers.end(); timer++) { - if (t->getName() == name) + if ((*timer)->getName() == name) { - t->stop(); + (*timer)->stop(); } } } @@ -96,31 +96,31 @@ void e2d::ETimerManager::stopAllTimersBindedWith(EScene * pParentScene) void e2d::ETimerManager::startAllTimersBindedWith(ENode * pParentNode) { - for (auto t : s_vTimers) + for (auto timer = s_vTimers.begin(); timer != s_vTimers.end(); timer++) { - if (t->getParentNode() == pParentNode) + if ((*timer)->getParentNode() == pParentNode) { - t->start(); + (*timer)->start(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - ETimerManager::startAllTimersBindedWith(child); + ETimerManager::startAllTimersBindedWith((*child)); } } void e2d::ETimerManager::stopAllTimersBindedWith(ENode * pParentNode) { - for (auto t : s_vTimers) + for (auto timer = s_vTimers.begin(); timer != s_vTimers.end(); timer++) { - if (t->getParentNode() == pParentNode) + if ((*timer)->getParentNode() == pParentNode) { - t->stop(); + (*timer)->stop(); } } - for (auto child : pParentNode->getChildren()) + for (auto child = pParentNode->getChildren().begin(); child != pParentNode->getChildren().end(); child++) { - ETimerManager::stopAllTimersBindedWith(child); + ETimerManager::stopAllTimersBindedWith((*child)); } } @@ -148,9 +148,9 @@ void e2d::ETimerManager::_clearManager() void e2d::ETimerManager::_resetAllTimers() { - for (const auto & t : s_vTimers) + for (auto timer = s_vTimers.begin(); timer != s_vTimers.end(); timer++) { - t->m_tLast = GetNow(); + (*timer)->m_tLast = GetNow(); } } diff --git a/Easy2D/Msg/EKeyboardMsg.cpp b/core/Msg/EKeyboardMsg.cpp similarity index 100% rename from Easy2D/Msg/EKeyboardMsg.cpp rename to core/Msg/EKeyboardMsg.cpp diff --git a/Easy2D/Msg/EMouseMsg.cpp b/core/Msg/EMouseMsg.cpp similarity index 100% rename from Easy2D/Msg/EMouseMsg.cpp rename to core/Msg/EMouseMsg.cpp diff --git a/Easy2D/Msg/EPhysicsMsg.cpp b/core/Msg/EPhysicsMsg.cpp similarity index 90% rename from Easy2D/Msg/EPhysicsMsg.cpp rename to core/Msg/EPhysicsMsg.cpp index a9ecd51e..cfd7065b 100644 --- a/Easy2D/Msg/EPhysicsMsg.cpp +++ b/core/Msg/EPhysicsMsg.cpp @@ -1,6 +1,6 @@ #include "..\ecommon.h" -e2d::EPhysicsMsg::INTERSECT_RELATION e2d::EPhysicsMsg::s_nRelation = e2d::EPhysicsMsg::INTERSECT_RELATION::UNKNOWN; +e2d::EPhysicsMsg::INTERSECT_RELATION e2d::EPhysicsMsg::s_nRelation = e2d::EPhysicsMsg::UNKNOWN; e2d::EGeometry * e2d::EPhysicsMsg::s_pActiveGeometry = nullptr; e2d::EGeometry * e2d::EPhysicsMsg::s_pPassiveGeometry = nullptr; diff --git a/Easy2D/Node/EButton.cpp b/core/Node/EButton.cpp similarity index 81% rename from Easy2D/Node/EButton.cpp rename to core/Node/EButton.cpp index e80cde92..4dd4bc8f 100644 --- a/Easy2D/Node/EButton.cpp +++ b/core/Node/EButton.cpp @@ -5,7 +5,7 @@ e2d::EButton::EButton() : m_Callback((const BUTTON_CLICK_CALLBACK &)nullptr) - , m_eStatus(STATUS::NORMAL) + , m_eStatus(EButton::NORMAL) , m_bEnable(true) , m_bIsSelected(false) , m_pNormal(nullptr) @@ -20,14 +20,30 @@ e2d::EButton::EButton() } e2d::EButton::EButton(ENode * normal, const BUTTON_CLICK_CALLBACK & callback) - : EButton() + : m_Callback((const BUTTON_CLICK_CALLBACK &)nullptr) + , m_eStatus(EButton::NORMAL) + , m_bEnable(true) + , m_bIsSelected(false) + , m_pNormal(nullptr) + , m_pMouseover(nullptr) + , m_pSelected(nullptr) + , m_pDisabled(nullptr) + , m_pListener(nullptr) { this->setNormal(normal); this->setCallback(callback); } e2d::EButton::EButton(ENode * normal, ENode * selected, const BUTTON_CLICK_CALLBACK & callback) - : EButton() + : m_Callback((const BUTTON_CLICK_CALLBACK &)nullptr) + , m_eStatus(EButton::NORMAL) + , m_bEnable(true) + , m_bIsSelected(false) + , m_pNormal(nullptr) + , m_pMouseover(nullptr) + , m_pSelected(nullptr) + , m_pDisabled(nullptr) + , m_pListener(nullptr) { this->setNormal(normal); this->setSelected(selected); @@ -35,7 +51,15 @@ e2d::EButton::EButton(ENode * normal, ENode * selected, const BUTTON_CLICK_CALLB } e2d::EButton::EButton(ENode * normal, ENode * mouseover, ENode * selected, const BUTTON_CLICK_CALLBACK & callback) - : EButton() + : m_Callback((const BUTTON_CLICK_CALLBACK &)nullptr) + , m_eStatus(EButton::NORMAL) + , m_bEnable(true) + , m_bIsSelected(false) + , m_pNormal(nullptr) + , m_pMouseover(nullptr) + , m_pSelected(nullptr) + , m_pDisabled(nullptr) + , m_pListener(nullptr) { this->setNormal(normal); this->setMouseOver(mouseover); @@ -44,7 +68,15 @@ e2d::EButton::EButton(ENode * normal, ENode * mouseover, ENode * selected, const } e2d::EButton::EButton(ENode * normal, ENode * mouseover, ENode * selected, ENode * disabled, const BUTTON_CLICK_CALLBACK & callback) - : EButton() + : m_Callback((const BUTTON_CLICK_CALLBACK &)nullptr) + , m_eStatus(EButton::NORMAL) + , m_bEnable(true) + , m_bIsSelected(false) + , m_pNormal(nullptr) + , m_pMouseover(nullptr) + , m_pSelected(nullptr) + , m_pDisabled(nullptr) + , m_pListener(nullptr) { this->setNormal(normal); this->setMouseOver(mouseover); @@ -207,11 +239,11 @@ void e2d::EButton::_updateVisiable() if (m_bEnable) { - if (m_eStatus == STATUS::SELECTED && m_pSelected) + if (m_eStatus == EButton::SELECTED && m_pSelected) { m_pSelected->setVisiable(true); } - else if (m_eStatus == STATUS::MOUSEOVER && m_pMouseover) + else if (m_eStatus == EButton::MOUSEOVER && m_pMouseover) { m_pMouseover->setVisiable(true); } @@ -258,7 +290,7 @@ void e2d::EButton::_updateStatus() { // £λڰťʱ m_bIsSelected Ϊ true m_bIsSelected = true; - _setStatus(STATUS::SELECTED); + _setStatus(EButton::SELECTED); return; } } @@ -267,17 +299,17 @@ void e2d::EButton::_updateStatus() { if (pSelected->isPointIn(EMouseMsg::getPos())) { - _setStatus(STATUS::SELECTED); + _setStatus(EButton::SELECTED); return; } } else if (m_pNormal->isPointIn(EMouseMsg::getPos())) { - _setStatus(STATUS::MOUSEOVER); + _setStatus(EButton::MOUSEOVER); return; } - _setStatus(STATUS::NORMAL); + _setStatus(EButton::NORMAL); } } diff --git a/Easy2D/Node/EButtonToggle.cpp b/core/Node/EButtonToggle.cpp similarity index 85% rename from Easy2D/Node/EButtonToggle.cpp rename to core/Node/EButtonToggle.cpp index d8ecbfd4..f2380637 100644 --- a/Easy2D/Node/EButtonToggle.cpp +++ b/core/Node/EButtonToggle.cpp @@ -18,7 +18,16 @@ e2d::EButtonToggle::EButtonToggle() } e2d::EButtonToggle::EButtonToggle(ENode * toggleOnNormal, ENode * toggleOffNormal, const BUTTON_CLICK_CALLBACK & callback) - : EButtonToggle() + : EButton() + , m_bToggle(true) + , m_pNormalOn(nullptr) + , m_pMouseoverOn(nullptr) + , m_pSelectedOn(nullptr) + , m_pDisabledOn(nullptr) + , m_pNormalOff(nullptr) + , m_pMouseoverOff(nullptr) + , m_pSelectedOff(nullptr) + , m_pDisabledOff(nullptr) { this->setNormal(toggleOnNormal); this->setNormalOff(toggleOffNormal); @@ -26,7 +35,16 @@ e2d::EButtonToggle::EButtonToggle(ENode * toggleOnNormal, ENode * toggleOffNorma } e2d::EButtonToggle::EButtonToggle(ENode * toggleOnNormal, ENode * toggleOffNormal, ENode * toggleOnSelected, ENode * toggleOffSelected, const BUTTON_CLICK_CALLBACK & callback) - : EButtonToggle() + : EButton() + , m_bToggle(true) + , m_pNormalOn(nullptr) + , m_pMouseoverOn(nullptr) + , m_pSelectedOn(nullptr) + , m_pDisabledOn(nullptr) + , m_pNormalOff(nullptr) + , m_pMouseoverOff(nullptr) + , m_pSelectedOff(nullptr) + , m_pDisabledOff(nullptr) { this->setNormal(toggleOnNormal); this->setNormalOff(toggleOffNormal); @@ -36,7 +54,16 @@ e2d::EButtonToggle::EButtonToggle(ENode * toggleOnNormal, ENode * toggleOffNorma } e2d::EButtonToggle::EButtonToggle(ENode * toggleOnNormal, ENode * toggleOffNormal, ENode * toggleOnMouseOver, ENode * toggleOffMouseOver, ENode * toggleOnSelected, ENode * toggleOffSelected, const BUTTON_CLICK_CALLBACK & callback) - : EButtonToggle() + : EButton() + , m_bToggle(true) + , m_pNormalOn(nullptr) + , m_pMouseoverOn(nullptr) + , m_pSelectedOn(nullptr) + , m_pDisabledOn(nullptr) + , m_pNormalOff(nullptr) + , m_pMouseoverOff(nullptr) + , m_pSelectedOff(nullptr) + , m_pDisabledOff(nullptr) { this->setNormal(toggleOnNormal); this->setNormalOff(toggleOffNormal); @@ -48,7 +75,16 @@ e2d::EButtonToggle::EButtonToggle(ENode * toggleOnNormal, ENode * toggleOffNorma } e2d::EButtonToggle::EButtonToggle(ENode * toggleOnNormal, ENode * toggleOffNormal, ENode * toggleOnMouseOver, ENode * toggleOffMouseOver, ENode * toggleOnSelected, ENode * toggleOffSelected, ENode * toggleOnDisabled, ENode * toggleOffDisabled, const BUTTON_CLICK_CALLBACK & callback) - : EButtonToggle() + : EButton() + , m_bToggle(true) + , m_pNormalOn(nullptr) + , m_pMouseoverOn(nullptr) + , m_pSelectedOn(nullptr) + , m_pDisabledOn(nullptr) + , m_pNormalOff(nullptr) + , m_pMouseoverOff(nullptr) + , m_pSelectedOff(nullptr) + , m_pDisabledOff(nullptr) { this->setNormal(toggleOnNormal); this->setNormalOff(toggleOffNormal); diff --git a/Easy2D/Node/EMenu.cpp b/core/Node/EMenu.cpp similarity index 87% rename from Easy2D/Node/EMenu.cpp rename to core/Node/EMenu.cpp index ff44409b..5cbb58e7 100644 --- a/Easy2D/Node/EMenu.cpp +++ b/core/Node/EMenu.cpp @@ -7,7 +7,7 @@ e2d::EMenu::EMenu() } e2d::EMenu::EMenu(int number, EButton * button1, ...) - : EMenu() + : m_bEnable(true) { EButton ** ppButton = &button1; @@ -35,15 +35,15 @@ void e2d::EMenu::setEnable(bool enable) { m_bEnable = enable; - for (auto &button : m_vButtons) + for (auto button = m_vButtons.begin(); button != m_vButtons.end(); button++) { if (enable) { - button->m_pListener->start(); + (*button)->m_pListener->start(); } else { - button->m_pListener->stop(); + (*button)->m_pListener->stop(); } } } diff --git a/Easy2D/Node/ENode.cpp b/core/Node/ENode.cpp similarity index 87% rename from Easy2D/Node/ENode.cpp rename to core/Node/ENode.cpp index 192e337d..15e83c30 100644 --- a/Easy2D/Node/ENode.cpp +++ b/core/Node/ENode.cpp @@ -35,7 +35,26 @@ e2d::ENode::ENode() } e2d::ENode::ENode(const EString & name) - : ENode() + : m_nOrder(0) + , m_fScaleX(1.0f) + , m_fScaleY(1.0f) + , m_fRotation(0) + , m_fSkewAngleX(0) + , m_fSkewAngleY(0) + , m_fDisplayOpacity(1.0f) + , m_fRealOpacity(1.0f) + , m_fPivotX(s_fDefaultPiovtX) + , m_fPivotY(s_fDefaultPiovtY) + , m_MatriInitial(D2D1::Matrix3x2F::Identity()) + , m_MatriFinal(D2D1::Matrix3x2F::Identity()) + , m_bVisiable(true) + , m_bDisplayedInScene(false) + , m_pGeometry(nullptr) + , m_pParent(nullptr) + , m_pParentScene(nullptr) + , m_nHashName(0) + , m_bSortChildrenNeeded(false) + , m_bTransformNeeded(false) { setName(name); } @@ -48,9 +67,9 @@ e2d::ENode::~ENode() EActionManager::_clearAllActionsBindedWith(this); EPhysicsManager::_clearAllListenersBindedWith(this); EPhysicsManager::_delGeometry(m_pGeometry); - for (auto child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - SafeRelease(&child); + SafeRelease(&(*child)); } } @@ -78,8 +97,8 @@ void e2d::ENode::_update() { this->_sortChildren(); - size_t size = m_vChildren.size(); - size_t i; + UINT size = m_vChildren.size(); + UINT i; for (i = 0; i < size; i++) { auto child = m_vChildren[i]; @@ -123,9 +142,9 @@ void e2d::ENode::_drawGeometry() } // ӽڵļ״ - for (auto &child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - child->_drawGeometry(); + (*child)->_drawGeometry(); } } @@ -136,9 +155,9 @@ void e2d::ENode::_onEnter() this->m_bDisplayedInScene = true; this->onEnter(); - for (const auto &child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - child->_onEnter(); + (*child)->_onEnter(); } } } @@ -150,9 +169,9 @@ void e2d::ENode::_onExit() this->m_bDisplayedInScene = false; this->onExit(); - for (const auto &child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - child->_onExit(); + (*child)->_onExit(); } } } @@ -208,9 +227,9 @@ void e2d::ENode::_updateTransform() void e2d::ENode::_updateChildrenTransform() { - for (const auto &child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - _updateTransform(child); + _updateTransform((*child)); } } @@ -231,9 +250,9 @@ void e2d::ENode::_updateTransform(ENode * node) void e2d::ENode::_updateChildrenOpacity() { - for (const auto &child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - _updateOpacity(child); + _updateOpacity((*child)); } } @@ -578,7 +597,7 @@ std::vector& e2d::ENode::getChildren() return m_vChildren; } -size_t e2d::ENode::getChildrenCount() const +UINT e2d::ENode::getChildrenCount() const { return m_vChildren.size(); } @@ -589,11 +608,11 @@ e2d::ENode * e2d::ENode::getChild(const EString & name) unsigned int hash = name.hash(); - for (const auto& child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { // ͬƿܻͬ Hash ֵȱȽ Hash ٶ - if (child->m_nHashName == hash && child->m_sName == name) - return child; + if ((*child)->m_nHashName == hash && (*child)->m_sName == name) + return (*child); } return nullptr; } @@ -617,8 +636,8 @@ bool e2d::ENode::removeChild(ENode * child) if (child) { - size_t size = m_vChildren.size(); - for (size_t i = 0; i < size; i++) + UINT size = m_vChildren.size(); + for (UINT i = 0; i < size; i++) { if (m_vChildren[i] == child) { @@ -649,8 +668,8 @@ void e2d::ENode::removeChild(const EString & childName) // Hash ֵ unsigned int hash = childName.hash(); - size_t size = m_vChildren.size(); - for (size_t i = 0; i < size; i++) + UINT size = m_vChildren.size(); + for (UINT i = 0; i < size; i++) { auto child = m_vChildren[i]; if (child->m_nHashName == hash && child->m_sName == childName) @@ -671,10 +690,10 @@ void e2d::ENode::removeChild(const EString & childName) void e2d::ENode::clearAllChildren() { // нڵüһ - for (auto child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - child->_onExit(); - child->release(); + (*child)->_onExit(); + (*child)->release(); } // մڵ m_vChildren.clear(); @@ -733,8 +752,8 @@ bool e2d::ENode::isPointIn(EPoint point) } else { - for (const auto & child : m_vChildren) - if (child->isPointIn(point)) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) + if ((*child)->isPointIn(point)) return true; } return false; @@ -794,8 +813,8 @@ void e2d::ENode::setName(const EString & name) void e2d::ENode::_setParentScene(EScene * scene) { m_pParentScene = scene; - for (const auto &child : m_vChildren) + for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) { - child->_setParentScene(scene); + (*child)->_setParentScene(scene); } } \ No newline at end of file diff --git a/Easy2D/Node/ESprite.cpp b/core/Node/ESprite.cpp similarity index 90% rename from Easy2D/Node/ESprite.cpp rename to core/Node/ESprite.cpp index 58111bdd..5c9b836b 100644 --- a/Easy2D/Node/ESprite.cpp +++ b/core/Node/ESprite.cpp @@ -10,19 +10,25 @@ e2d::ESprite::ESprite() } e2d::ESprite::ESprite(ETexture * texture) - : ESprite() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_pTexture(nullptr) { loadFrom(texture); } e2d::ESprite::ESprite(ESpriteFrame * spriteFrame) - : ESprite() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_pTexture(nullptr) { loadFrom(spriteFrame); } e2d::ESprite::ESprite(const EString & imageFileName) - : ESprite() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_pTexture(nullptr) { loadFrom(imageFileName); } @@ -34,7 +40,9 @@ e2d::ESprite::ESprite(const EString & imageFileName, float x, float y, float wid } e2d::ESprite::ESprite(LPCTSTR resourceName, LPCTSTR resourceType) - : ESprite() + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_pTexture(nullptr) { loadFrom(resourceName, resourceType); } diff --git a/Easy2D/Node/EText.cpp b/core/Node/EText.cpp similarity index 92% rename from Easy2D/Node/EText.cpp rename to core/Node/EText.cpp index 6f002daf..e67d7fb9 100644 --- a/Easy2D/Node/EText.cpp +++ b/core/Node/EText.cpp @@ -10,20 +10,26 @@ e2d::EText::EText() } e2d::EText::EText(const EString & text) - : EText() + : m_bWordWrapping(false) + , m_pFont(nullptr) + , m_fWordWrappingWidth(0) { this->setText(text); this->setFont(new EFont()); } e2d::EText::EText(EFont * font) - : EText() + : m_bWordWrapping(false) + , m_pFont(nullptr) + , m_fWordWrappingWidth(0) { this->setFont(font); } e2d::EText::EText(const EString & text, EFont * font) - : EText() + : m_bWordWrapping(false) + , m_pFont(nullptr) + , m_fWordWrappingWidth(0) { this->setText(text); this->setFont(font); diff --git a/Easy2D/Tool/EFileUtils.cpp b/core/Tool/EFileUtils.cpp similarity index 100% rename from Easy2D/Tool/EFileUtils.cpp rename to core/Tool/EFileUtils.cpp diff --git a/Easy2D/Tool/EMusicUtils.cpp b/core/Tool/EMusicUtils.cpp similarity index 89% rename from Easy2D/Tool/EMusicUtils.cpp rename to core/Tool/EMusicUtils.cpp index 0381dddc..8ede66fb 100644 --- a/Easy2D/Tool/EMusicUtils.cpp +++ b/core/Tool/EMusicUtils.cpp @@ -127,24 +127,24 @@ bool e2d::EMusicUtils::stopMusic(const EString & musicName) void e2d::EMusicUtils::pauseAllMusics() { - for (auto& iter : getMciPlayerList()) + for (auto iter = getMciPlayerList().begin(); iter != getMciPlayerList().end(); iter++) { - iter.second->pause(); + (*iter).second->pause(); } } void e2d::EMusicUtils::resumeAllMusics() { - for (auto& iter : getMciPlayerList()) + for (auto iter = getMciPlayerList().begin(); iter != getMciPlayerList().end(); iter++) { - iter.second->resume(); + (*iter).second->resume(); } } void e2d::EMusicUtils::stopAllMusics() { - for (auto& iter : getMciPlayerList()) + for (auto iter = getMciPlayerList().begin(); iter != getMciPlayerList().end(); iter++) { - iter.second->stop(); + (*iter).second->stop(); } } diff --git a/Easy2D/Tool/ERandom.cpp b/core/Tool/ERandom.cpp similarity index 100% rename from Easy2D/Tool/ERandom.cpp rename to core/Tool/ERandom.cpp diff --git a/Easy2D/Tool/ETimer.cpp b/core/Tool/ETimer.cpp similarity index 80% rename from Easy2D/Tool/ETimer.cpp rename to core/Tool/ETimer.cpp index 51732dd5..2623f7d2 100644 --- a/Easy2D/Tool/ETimer.cpp +++ b/core/Tool/ETimer.cpp @@ -8,14 +8,20 @@ e2d::ETimer::ETimer() , m_nRunTimes(0) , m_pParentNode(nullptr) , m_Callback(nullptr) - , m_nInterval(0) - , m_nRepeatTimes(0) + , m_nInterval() + , m_nRepeatTimes(-1) , m_bAtOnce(false) { } e2d::ETimer::ETimer(const TIMER_CALLBACK & callback, int repeatTimes /* = -1 */, LONGLONG interval /* = 0 */, bool atOnce /* = false */) - : ETimer() + : m_bRunning(false) + , m_nRunTimes(0) + , m_pParentNode(nullptr) + , m_Callback(nullptr) + , m_nInterval() + , m_nRepeatTimes(-1) + , m_bAtOnce(false) { this->setCallback(callback); this->setRepeatTimes(repeatTimes); @@ -24,7 +30,13 @@ e2d::ETimer::ETimer(const TIMER_CALLBACK & callback, int repeatTimes /* = -1 */, } e2d::ETimer::ETimer(const EString & name, const TIMER_CALLBACK & callback, int repeatTimes /* = -1 */, LONGLONG interval /* = 0 */, bool atOnce /* = false */) - : ETimer() + : m_bRunning(false) + , m_nRunTimes(0) + , m_pParentNode(nullptr) + , m_Callback(nullptr) + , m_nInterval() + , m_nRepeatTimes(-1) + , m_bAtOnce(false) { this->setName(name); this->setCallback(callback); @@ -41,7 +53,7 @@ bool e2d::ETimer::isRunning() const void e2d::ETimer::start() { m_bRunning = true; - m_tLast = steady_clock::now(); + m_tLast = GetNow(); } void e2d::ETimer::stop() @@ -66,7 +78,7 @@ void e2d::ETimer::setName(const EString & name) void e2d::ETimer::setInterval(LONGLONG interval) { - m_nInterval = max(interval, 0); + SetInterval(m_nInterval, max(interval, 0)); } void e2d::ETimer::setCallback(const TIMER_CALLBACK & callback) @@ -118,12 +130,12 @@ bool e2d::ETimer::_isReady() if (m_bAtOnce && m_nRunTimes == 0) return true; - if (m_nInterval == 0) + if (m_nInterval.QuadPart == 0) return true; - if (GetInterval(m_tLast) >= m_nInterval) + if (IsIntervalFull(m_tLast, m_nInterval)) { - m_tLast += milliseconds(m_nInterval); + m_tLast.QuadPart += m_nInterval.QuadPart; return true; } } diff --git a/Easy2D/Transition/ETransition.cpp b/core/Transition/ETransition.cpp similarity index 78% rename from Easy2D/Transition/ETransition.cpp rename to core/Transition/ETransition.cpp index c11441c6..73c06de8 100644 --- a/Easy2D/Transition/ETransition.cpp +++ b/core/Transition/ETransition.cpp @@ -25,11 +25,11 @@ bool e2d::ETransition::_isDelayEnough() return true; } - if (GetInterval(m_tLast) > 15) + if (IsIntervalFull(m_tLast, m_nAnimationInterval)) { // ¼¼ʱ - m_tLast += milliseconds(15); - m_fDuration += 15; + m_tLast.QuadPart += m_nAnimationInterval.QuadPart; + m_fDuration += static_cast(ToMilliseconds(m_nAnimationInterval.QuadPart)); // 㶯 m_fRateOfProgress = m_fDuration / m_fTotalDuration; return true; @@ -45,7 +45,7 @@ void e2d::ETransition::_stop() void e2d::ETransition::_setTarget(EScene * prev, EScene * next) { - m_tLast = std::chrono::steady_clock::now(); + m_tLast = GetNow(); m_pPrevScene = prev; m_pNextScene = next; _init(); diff --git a/Easy2D/Transition/ETransitionEmerge.cpp b/core/Transition/ETransitionEmerge.cpp similarity index 100% rename from Easy2D/Transition/ETransitionEmerge.cpp rename to core/Transition/ETransitionEmerge.cpp diff --git a/Easy2D/Transition/ETransitionFade.cpp b/core/Transition/ETransitionFade.cpp similarity index 100% rename from Easy2D/Transition/ETransitionFade.cpp rename to core/Transition/ETransitionFade.cpp diff --git a/Easy2D/Transition/ETransitionMove.cpp b/core/Transition/ETransitionMove.cpp similarity index 86% rename from Easy2D/Transition/ETransitionMove.cpp rename to core/Transition/ETransitionMove.cpp index f890d361..77480756 100644 --- a/Easy2D/Transition/ETransitionMove.cpp +++ b/core/Transition/ETransitionMove.cpp @@ -23,22 +23,22 @@ void e2d::ETransitionMove::_update() void e2d::ETransitionMove::_init() { - if (m_Direct == MOVE_DIRECT::UP) + if (m_Direct == ETransitionMove::UP) { m_Vec = EVec(0, -EApp::getHeight()); m_NextPos = EPoint(0, EApp::getHeight()); } - else if (m_Direct == MOVE_DIRECT::DOWN) + else if (m_Direct == ETransitionMove::DOWN) { m_Vec = EVec(0, EApp::getHeight()); m_NextPos = EPoint(0, -EApp::getHeight()); } - else if (m_Direct == MOVE_DIRECT::LEFT) + else if (m_Direct == ETransitionMove::LEFT) { m_Vec = EVec(-EApp::getWidth(), 0); m_NextPos = EPoint(EApp::getWidth(), 0); } - else if (m_Direct == MOVE_DIRECT::RIGHT) + else if (m_Direct == ETransitionMove::RIGHT) { m_Vec = EVec(EApp::getWidth(), 0); m_NextPos = EPoint(-EApp::getWidth(), 0); diff --git a/Easy2D/Win/MciPlayer.cpp b/core/Win/MciPlayer.cpp similarity index 100% rename from Easy2D/Win/MciPlayer.cpp rename to core/Win/MciPlayer.cpp diff --git a/Easy2D/Win/MciPlayer.h b/core/Win/MciPlayer.h similarity index 100% rename from Easy2D/Win/MciPlayer.h rename to core/Win/MciPlayer.h diff --git a/Easy2D/Win/winbase.cpp b/core/Win/winbase.cpp similarity index 79% rename from Easy2D/Win/winbase.cpp rename to core/Win/winbase.cpp index 2ac0449b..297a8dc8 100644 --- a/Easy2D/Win/winbase.cpp +++ b/core/Win/winbase.cpp @@ -7,7 +7,8 @@ static ID2D1HwndRenderTarget * s_pRenderTarget = nullptr; static ID2D1SolidColorBrush * s_pSolidBrush = nullptr; static IWICImagingFactory * s_pIWICFactory = nullptr; static IDWriteFactory * s_pDWriteFactory = nullptr; -static steady_clock::time_point s_tNow; +static LARGE_INTEGER s_tNow; +static LARGE_INTEGER s_tFreq; HWND &GetHWnd() @@ -105,12 +106,31 @@ ID2D1SolidColorBrush * &GetSolidColorBrush() return s_pSolidBrush; } -steady_clock::time_point &GetNow() +LARGE_INTEGER &GetFreq() +{ + if (s_tFreq.QuadPart == 0) + { + QueryPerformanceFrequency(&s_tFreq); // ȡʱƵ + } + return s_tFreq; +} + +LARGE_INTEGER &GetNow() { return s_tNow; } -long long GetInterval(steady_clock::time_point tLast) +bool IsIntervalFull(const LARGE_INTEGER& tLast, const LARGE_INTEGER& tInterval) { - return duration_cast(s_tNow - tLast).count(); -} \ No newline at end of file + return (s_tNow.QuadPart - tLast.QuadPart) >= tInterval.QuadPart; +} + +LONGLONG ToMilliseconds(LONGLONG tLast) +{ + return tLast * 1000LL / GetFreq().QuadPart; +} + +void SetInterval(LARGE_INTEGER& nInterval, LONGLONG nIntervalMS) +{ + nInterval.QuadPart = static_cast(GetFreq().QuadPart * nIntervalMS / 1000.0); +} diff --git a/Easy2D/Win/winbase.h b/core/Win/winbase.h similarity index 71% rename from Easy2D/Win/winbase.h rename to core/Win/winbase.h index 78c1a2a5..a5c64452 100644 --- a/Easy2D/Win/winbase.h +++ b/core/Win/winbase.h @@ -1,7 +1,5 @@ #pragma once #include "..\emacros.h" -#include -using namespace std::chrono; #ifndef HINST_THISCOMPONENT @@ -22,9 +20,15 @@ IWICImagingFactory * &GetImagingFactory(); IDWriteFactory * &GetDirectWriteFactory(); -std::chrono::steady_clock::time_point &GetNow(); +LARGE_INTEGER &GetFreq(); -long long GetInterval(std::chrono::steady_clock::time_point tLast); +LARGE_INTEGER &GetNow(); + +bool IsIntervalFull(const LARGE_INTEGER& tLast, const LARGE_INTEGER& tInterval); + +LONGLONG ToMilliseconds(LONGLONG tLast); + +void SetInterval(LARGE_INTEGER& nInterval, LONGLONG nIntervalMS); template diff --git a/Easy2D/eactions.h b/core/eactions.h similarity index 99% rename from Easy2D/eactions.h rename to core/eactions.h index 52e73da0..f00df0d1 100644 --- a/Easy2D/eactions.h +++ b/core/eactions.h @@ -1,6 +1,5 @@ #pragma once #include "enodes.h" -#include namespace e2d { @@ -82,8 +81,8 @@ protected: bool m_bInit; ENode * m_pTarget; EScene * m_pParentScene; - LONGLONG m_nAnimationInterval; - std::chrono::steady_clock::time_point m_tLast; + LARGE_INTEGER m_nAnimationInterval; + LARGE_INTEGER m_tLast; }; diff --git a/Easy2D/easy2d.h b/core/easy2d.h similarity index 97% rename from Easy2D/easy2d.h rename to core/easy2d.h index 3d51d77c..8ca0a152 100644 --- a/Easy2D/easy2d.h +++ b/core/easy2d.h @@ -12,7 +12,7 @@ #error Easy2D is only for C++ #endif -#if _MSC_VER < 1900 +#if _MSC_VER < 1600 #error Do Visual Studio 2015/2017 specific stuff #endif diff --git a/Easy2D/ebase.h b/core/ebase.h similarity index 96% rename from Easy2D/ebase.h rename to core/ebase.h index 773ca7ce..a682dad8 100644 --- a/Easy2D/ebase.h +++ b/core/ebase.h @@ -144,22 +144,14 @@ private: virtual ~EApp(); - // Ϸѭ - void _mainLoop(); - - // Ϸ void _update(); - // ȾϷ void _render(); - // һ void _enterNextScene(); - // ˢϷʱ void _updateTime(); - // ڳ static LRESULT CALLBACK WndProc( HWND hWnd, UINT message, @@ -175,7 +167,7 @@ private: EString m_sTitle; EString m_sAppName; UINT32 m_ClearColor; - LONGLONG m_nAnimationInterval; + LARGE_INTEGER m_nAnimationInterval; EScene * m_pCurrentScene; EScene * m_pNextScene; EWindowStyle m_WindowStyle; diff --git a/Easy2D/ecommon.h b/core/ecommon.h similarity index 99% rename from Easy2D/ecommon.h rename to core/ecommon.h index 4c3212df..a1d2e951 100644 --- a/Easy2D/ecommon.h +++ b/core/ecommon.h @@ -506,7 +506,7 @@ public: }; // ֵ - enum class KEY + enum KEY { A = 'A', B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, // ĸֵ NUM0 = '0', NUM1, NUM2, NUM3, NUM4, NUM5, NUM6, NUM7, NUM8, NUM9, // ֵּ diff --git a/Easy2D/egeometry.h b/core/egeometry.h similarity index 100% rename from Easy2D/egeometry.h rename to core/egeometry.h diff --git a/Easy2D/elisteners.h b/core/elisteners.h similarity index 100% rename from Easy2D/elisteners.h rename to core/elisteners.h diff --git a/Easy2D/emacros.h b/core/emacros.h similarity index 98% rename from Easy2D/emacros.h rename to core/emacros.h index 79934a1a..168f4bdf 100644 --- a/Easy2D/emacros.h +++ b/core/emacros.h @@ -29,6 +29,7 @@ #include // C RunTime Header Files +#include #include #include #include diff --git a/Easy2D/emanagers.h b/core/emanagers.h similarity index 100% rename from Easy2D/emanagers.h rename to core/emanagers.h diff --git a/Easy2D/enodes.h b/core/enodes.h similarity index 100% rename from Easy2D/enodes.h rename to core/enodes.h diff --git a/Easy2D/etools.h b/core/etools.h similarity index 98% rename from Easy2D/etools.h rename to core/etools.h index ea82c1e6..4b862f8c 100644 --- a/Easy2D/etools.h +++ b/core/etools.h @@ -1,6 +1,5 @@ #pragma once #include "ebase.h" -#include #include namespace e2d @@ -99,8 +98,8 @@ protected: int m_nRepeatTimes; ENode * m_pParentNode; TIMER_CALLBACK m_Callback; - LONGLONG m_nInterval; - std::chrono::steady_clock::time_point m_tLast; + LARGE_INTEGER m_nInterval; + LARGE_INTEGER m_tLast; }; diff --git a/Easy2D/etransitions.h b/core/etransitions.h similarity index 96% rename from Easy2D/etransitions.h rename to core/etransitions.h index a36e3f8e..f3f24d15 100644 --- a/Easy2D/etransitions.h +++ b/core/etransitions.h @@ -1,6 +1,5 @@ #pragma once #include "ebase.h" -#include namespace e2d { @@ -41,7 +40,8 @@ protected: float m_fRateOfProgress; EScene * m_pPrevScene; EScene * m_pNextScene; - std::chrono::steady_clock::time_point m_tLast; + LARGE_INTEGER m_tLast; + LARGE_INTEGER m_nAnimationInterval; }; diff --git a/project/vs2010/Easy2D.sln b/project/vs2010/Easy2D.sln new file mode 100644 index 00000000..9b743ffb --- /dev/null +++ b/project/vs2010/Easy2D.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D.vcxproj", "{47AF11E1-8725-4ECA-B8CF-951ABC397B31}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Debug|Win32.ActiveCfg = Debug|Win32 + {47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Debug|Win32.Build.0 = Debug|Win32 + {47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Release|Win32.ActiveCfg = Release|Win32 + {47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/project/vs2010/Easy2D.vcxproj b/project/vs2010/Easy2D.vcxproj new file mode 100644 index 00000000..8c3670bd --- /dev/null +++ b/project/vs2010/Easy2D.vcxproj @@ -0,0 +1,167 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {47AF11E1-8725-4ECA-B8CF-951ABC397B31} + Win32Proj + Easy2D + + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + false + Unicode + + + + + + + + + + + + + Easy2Dw + $(SolutionDir)$(Platform)\ + $(Configuration)\$(Platform)\ + + + Easy2Ddw + $(SolutionDir)$(Platform)\ + $(Configuration)\$(Platform)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + + + false + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + + + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project/vs2010/Easy2D.vcxproj.filters b/project/vs2010/Easy2D.vcxproj.filters new file mode 100644 index 00000000..a9adec6a --- /dev/null +++ b/project/vs2010/Easy2D.vcxproj.filters @@ -0,0 +1,275 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {d4a509dd-1bc0-4456-9554-d414de91b50c} + + + {3ff66c81-6040-4f84-a39a-d21b4bb54819} + + + {5be538cb-a432-4f84-9678-bbf408eca288} + + + {6c760a81-9bc8-4fb0-a145-8e119b783365} + + + {7b102f67-5905-4c0e-8400-51c128da026a} + + + {c536c42c-283d-4a10-b19b-0699b4f1e051} + + + {17bdc67b-1801-4b69-b79b-ffcbbee8dae0} + + + {7454d212-5d2e-4b0b-865c-30fb02d2878c} + + + {c5f168c6-1403-486a-9cae-ab29495a723c} + + + {c907d829-e510-472c-bd47-cf4eab6f9266} + + + {508b39c8-a430-45c3-9405-364fbc281220} + + + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 源文件\Win + + + 源文件\Win + + + + + 源文件\Base + + + 源文件\Base + + + 源文件\Msg + + + 源文件\Msg + + + 源文件\Msg + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Action + + + 源文件\Manager + + + 源文件\Manager + + + 源文件\Manager + + + 源文件\Manager + + + 源文件\Manager + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Listener + + + 源文件\Common + + + 源文件\Common + + + 源文件\Common + + + 源文件\Common + + + 源文件\Common + + + 源文件\Geometry + + + 源文件\Geometry + + + 源文件\Geometry + + + 源文件\Geometry + + + 源文件\Win + + + 源文件\Win + + + 源文件\Tool + + + 源文件\Tool + + + 源文件\Tool + + + 源文件\Tool + + + 源文件\Node + + + 源文件\Node + + + 源文件\Node + + + 源文件\Node + + + 源文件\Node + + + 源文件\Node + + + 源文件\Transition + + + 源文件\Transition + + + 源文件\Transition + + + 源文件\Transition + + + \ No newline at end of file diff --git a/project/vs2017/Easy2D.sln b/project/vs2017/Easy2D.sln new file mode 100644 index 00000000..41abced5 --- /dev/null +++ b/project/vs2017/Easy2D.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.12 +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|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + 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|x86.ActiveCfg = Debug|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x86.Build.0 = Debug|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x86.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}.Release|x86.ActiveCfg = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x86.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/Easy2D/Easy2D.vcxproj b/project/vs2017/Easy2D.vcxproj similarity index 64% rename from Easy2D/Easy2D.vcxproj rename to project/vs2017/Easy2D.vcxproj index fc40508c..fc4ec006 100644 --- a/Easy2D/Easy2D.vcxproj +++ b/project/vs2017/Easy2D.vcxproj @@ -1,274 +1,272 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - 15.0 - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF} - Win32Proj - Easy2D - 10.0.16299.0 - - - - StaticLibrary - true - Unicode - v141 - - - StaticLibrary - false - v141 - false - Unicode - - - StaticLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - false - Unicode - - - - - - - - - - - - - - - - - - - - - true - Easy2Ddw - $(SolutionDir)$(Platform)\ - $(Platform)\$(Configuration)\ - - - true - Easy2Ddw - $(SolutionDir)$(Platform)\ - $(Platform)\$(Configuration)\ - - - false - Easy2Dw - $(SolutionDir)$(Platform)\ - $(Platform)\$(Configuration)\ - - - false - Easy2Dw - $(SolutionDir)$(Platform)\ - $(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - EditAndContinue - false - - - Console - true - - - - - - - - - - - false - - - - - NotUsing - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - None - false - - - Console - true - - - - - - - - - - - NotUsing - Level3 - MaxSpeed - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - None - - - Console - true - true - true - - - - - - - - - - - - - NotUsing - Level3 - MaxSpeed - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - None - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 15.0 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF} + Win32Proj + Easy2D + 10.0.16299.0 + + + + StaticLibrary + true + Unicode + v141 + + + StaticLibrary + false + false + Unicode + v141 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + false + Unicode + + + + + + + + + + + + + + + + + + + + + true + Easy2Ddw + $(SolutionDir)$(Platform)\ + $(Configuration)\$(Platform)\ + + + true + Easy2Ddw + $(SolutionDir)$(Platform)\ + $(Configuration)\$(Platform)\ + + + false + Easy2Dw + $(SolutionDir)$(Platform)\ + $(Configuration)\$(Platform)\ + + + false + Easy2Dw + $(SolutionDir)$(Platform)\ + $(Configuration)\$(Platform)\ + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + None + false + + + Console + true + + + + + + + + + + + false + + + + + NotUsing + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + None + false + + + Console + true + + + + + + + + + + + NotUsing + Level3 + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + None + + + Console + true + true + true + + + + + + + + + + + + + NotUsing + Level3 + MaxSpeed + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + None + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Easy2D/Easy2D.vcxproj.filters b/project/vs2017/Easy2D.vcxproj.filters similarity index 51% rename from Easy2D/Easy2D.vcxproj.filters rename to project/vs2017/Easy2D.vcxproj.filters index e793408e..bb60a7f1 100644 --- a/Easy2D/Easy2D.vcxproj.filters +++ b/project/vs2017/Easy2D.vcxproj.filters @@ -1,245 +1,245 @@ - - - - - {2f0f3d30-bfc2-4aea-a170-258bbaacaa79} - - - {42d46a92-c043-4667-8c20-358319e5c313} - - - {51864c81-02ee-4043-bf09-9ce3cbe5b6da} - - - {261633d3-3814-40c7-bd6d-201ede6c6ade} - - - {50293f38-87fe-4dde-b938-cf1b7a2921f8} - - - {563b19f2-4c5e-4362-983a-94d2ae724550} - - - {9031e36b-fa85-4b4e-8e80-657c7e68f283} - - - {b9bb1728-5106-4574-998e-8564b49cb4a1} - - - {d5f86335-f3a0-450d-92a3-7edd9348d995} - - - {be5d9314-b00a-4f11-bd2a-1f720dc32407} - - - {3c524aef-fb91-4f44-a3dc-bff34de229eb} - - - - - Win - - - Base - - - Node - - - Base - - - Node - - - Node - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Action - - - Tool - - - Tool - - - Action - - - Action - - - Action - - - Transition - - - Action - - - Manager - - - Manager - - - Manager - - - Manager - - - Listener - - - Node - - - Transition - - - Transition - - - Tool - - - Tool - - - Geometry - - - Geometry - - - Geometry - - - Geometry - - - Manager - - - Listener - - - Listener - - - Listener - - - Listener - - - Listener - - - Listener - - - Listener - - - Listener - - - Common - - - Common - - - Common - - - Listener - - - Node - - - Node - - - Common - - - Win - - - Transition - - - Msg - - - Msg - - - Msg - - - Common - - - - - Win - - - - - - - - - - - - - - Win - - + + + + + {2f0f3d30-bfc2-4aea-a170-258bbaacaa79} + + + {42d46a92-c043-4667-8c20-358319e5c313} + + + {51864c81-02ee-4043-bf09-9ce3cbe5b6da} + + + {261633d3-3814-40c7-bd6d-201ede6c6ade} + + + {50293f38-87fe-4dde-b938-cf1b7a2921f8} + + + {563b19f2-4c5e-4362-983a-94d2ae724550} + + + {9031e36b-fa85-4b4e-8e80-657c7e68f283} + + + {b9bb1728-5106-4574-998e-8564b49cb4a1} + + + {d5f86335-f3a0-450d-92a3-7edd9348d995} + + + {be5d9314-b00a-4f11-bd2a-1f720dc32407} + + + {3c524aef-fb91-4f44-a3dc-bff34de229eb} + + + + + Win + + + Base + + + Node + + + Base + + + Node + + + Node + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Tool + + + Tool + + + Action + + + Action + + + Action + + + Transition + + + Action + + + Manager + + + Manager + + + Manager + + + Manager + + + Listener + + + Node + + + Transition + + + Transition + + + Tool + + + Tool + + + Geometry + + + Geometry + + + Geometry + + + Geometry + + + Manager + + + Listener + + + Listener + + + Listener + + + Listener + + + Listener + + + Listener + + + Listener + + + Listener + + + Common + + + Common + + + Common + + + Listener + + + Node + + + Node + + + Common + + + Win + + + Transition + + + Msg + + + Msg + + + Msg + + + Common + + + + + Win + + + + + + + + + + + + + + Win + + \ No newline at end of file