From afb24f7a32278d8a472bdc79c4a18b46350f8695 Mon Sep 17 00:00:00 2001 From: Nomango <569629550@qq.com> Date: Thu, 19 Apr 2018 17:18:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/Base/Game.cpp | 6 +++--- core/Base/Window.cpp | 1 - core/Transition/Transition.cpp | 10 +++++----- core/ebase.h | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) 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();