diff --git a/core/Base/Game.cpp b/core/Base/Game.cpp index b3e606aa..6605cb27 100644 --- a/core/Base/Game.cpp +++ b/core/Base/Game.cpp @@ -69,7 +69,7 @@ bool e2d::Game::init(String sGameName) return s_bInitialized; } -int e2d::Game::run() +int e2d::Game::start() { if (!s_bInitialized) { @@ -146,7 +146,7 @@ void e2d::Game::quit() s_bEndGame = true; // 这个变量将控制游戏是否结束 } -void e2d::Game::uninit() +void e2d::Game::destroy() { // 删除所有场景 SceneManager::__uninit(); @@ -211,5 +211,5 @@ bool e2d::Game::createMutex(String sMutexName, String sWindowTitle) e2d::String e2d::Game::getName() { - return String(); + return s_sGameName; } diff --git a/core/Base/Window.cpp b/core/Base/Window.cpp index ccb4529a..2d16371d 100644 --- a/core/Base/Window.cpp +++ b/core/Base/Window.cpp @@ -315,7 +315,6 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar if (!pCurrentScene || pCurrentScene->onCloseWindow()) { e2d::Game::quit(); - DestroyWindow(hWnd); } } result = 0; diff --git a/core/Transition/Transition.cpp b/core/Transition/Transition.cpp index a7e6ca15..4b16bb08 100644 --- a/core/Transition/Transition.cpp +++ b/core/Transition/Transition.cpp @@ -82,15 +82,15 @@ void e2d::Transition::_update() void e2d::Transition::_render() { auto pRT = Renderer::getRenderTarget(); - Size windowSize = Window::getSize(); + if (m_pPrevScene) { Point rootPos = m_pPrevScene->getRoot()->getPos(); auto clipRect = D2D1::RectF( float(max(rootPos.x, 0)), float(max(rootPos.y, 0)), - float(min(rootPos.x + windowSize.width, windowSize.width)), - float(min(rootPos.y + windowSize.height, windowSize.height)) + float(min(rootPos.x + m_WindowSize.width, m_WindowSize.width)), + float(min(rootPos.y + m_WindowSize.height, m_WindowSize.height)) ); pRT->SetTransform(D2D1::Matrix3x2F::Identity()); pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); @@ -109,8 +109,8 @@ void e2d::Transition::_render() auto clipRect = D2D1::RectF( float(max(rootPos.x, 0)), float(max(rootPos.y, 0)), - float(min(rootPos.x + windowSize.width, windowSize.width)), - float(min(rootPos.y + windowSize.height, windowSize.height)) + float(min(rootPos.x + m_WindowSize.width, m_WindowSize.width)), + float(min(rootPos.y + m_WindowSize.height, m_WindowSize.height)) ); pRT->SetTransform(D2D1::Matrix3x2F::Identity()); pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); diff --git a/core/ebase.h b/core/ebase.h index 3e262d5e..6e1bea0a 100644 --- a/core/ebase.h +++ b/core/ebase.h @@ -18,7 +18,7 @@ public: ); // 启动游戏 - static int run(); + static int start(); // 暂停游戏 static void pause(); @@ -30,7 +30,7 @@ public: static void quit(); // 回收游戏资源 - static void uninit(); + static void destroy(); // 游戏是否暂停 static bool isPaused();