修复一些细节问题
This commit is contained in:
parent
08f57430d3
commit
afb24f7a32
|
|
@ -69,7 +69,7 @@ bool e2d::Game::init(String sGameName)
|
||||||
return s_bInitialized;
|
return s_bInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
int e2d::Game::run()
|
int e2d::Game::start()
|
||||||
{
|
{
|
||||||
if (!s_bInitialized)
|
if (!s_bInitialized)
|
||||||
{
|
{
|
||||||
|
|
@ -146,7 +146,7 @@ void e2d::Game::quit()
|
||||||
s_bEndGame = true; // 这个变量将控制游戏是否结束
|
s_bEndGame = true; // 这个变量将控制游戏是否结束
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::Game::uninit()
|
void e2d::Game::destroy()
|
||||||
{
|
{
|
||||||
// 删除所有场景
|
// 删除所有场景
|
||||||
SceneManager::__uninit();
|
SceneManager::__uninit();
|
||||||
|
|
@ -211,5 +211,5 @@ bool e2d::Game::createMutex(String sMutexName, String sWindowTitle)
|
||||||
|
|
||||||
e2d::String e2d::Game::getName()
|
e2d::String e2d::Game::getName()
|
||||||
{
|
{
|
||||||
return String();
|
return s_sGameName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,6 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
||||||
if (!pCurrentScene || pCurrentScene->onCloseWindow())
|
if (!pCurrentScene || pCurrentScene->onCloseWindow())
|
||||||
{
|
{
|
||||||
e2d::Game::quit();
|
e2d::Game::quit();
|
||||||
DestroyWindow(hWnd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
|
||||||
|
|
@ -82,15 +82,15 @@ void e2d::Transition::_update()
|
||||||
void e2d::Transition::_render()
|
void e2d::Transition::_render()
|
||||||
{
|
{
|
||||||
auto pRT = Renderer::getRenderTarget();
|
auto pRT = Renderer::getRenderTarget();
|
||||||
Size windowSize = Window::getSize();
|
|
||||||
if (m_pPrevScene)
|
if (m_pPrevScene)
|
||||||
{
|
{
|
||||||
Point rootPos = m_pPrevScene->getRoot()->getPos();
|
Point rootPos = m_pPrevScene->getRoot()->getPos();
|
||||||
auto clipRect = D2D1::RectF(
|
auto clipRect = D2D1::RectF(
|
||||||
float(max(rootPos.x, 0)),
|
float(max(rootPos.x, 0)),
|
||||||
float(max(rootPos.y, 0)),
|
float(max(rootPos.y, 0)),
|
||||||
float(min(rootPos.x + windowSize.width, windowSize.width)),
|
float(min(rootPos.x + m_WindowSize.width, m_WindowSize.width)),
|
||||||
float(min(rootPos.y + windowSize.height, windowSize.height))
|
float(min(rootPos.y + m_WindowSize.height, m_WindowSize.height))
|
||||||
);
|
);
|
||||||
pRT->SetTransform(D2D1::Matrix3x2F::Identity());
|
pRT->SetTransform(D2D1::Matrix3x2F::Identity());
|
||||||
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||||
|
|
@ -109,8 +109,8 @@ void e2d::Transition::_render()
|
||||||
auto clipRect = D2D1::RectF(
|
auto clipRect = D2D1::RectF(
|
||||||
float(max(rootPos.x, 0)),
|
float(max(rootPos.x, 0)),
|
||||||
float(max(rootPos.y, 0)),
|
float(max(rootPos.y, 0)),
|
||||||
float(min(rootPos.x + windowSize.width, windowSize.width)),
|
float(min(rootPos.x + m_WindowSize.width, m_WindowSize.width)),
|
||||||
float(min(rootPos.y + windowSize.height, windowSize.height))
|
float(min(rootPos.y + m_WindowSize.height, m_WindowSize.height))
|
||||||
);
|
);
|
||||||
pRT->SetTransform(D2D1::Matrix3x2F::Identity());
|
pRT->SetTransform(D2D1::Matrix3x2F::Identity());
|
||||||
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
// 启动游戏
|
// 启动游戏
|
||||||
static int run();
|
static int start();
|
||||||
|
|
||||||
// 暂停游戏
|
// 暂停游戏
|
||||||
static void pause();
|
static void pause();
|
||||||
|
|
@ -30,7 +30,7 @@ public:
|
||||||
static void quit();
|
static void quit();
|
||||||
|
|
||||||
// 回收游戏资源
|
// 回收游戏资源
|
||||||
static void uninit();
|
static void destroy();
|
||||||
|
|
||||||
// 游戏是否暂停
|
// 游戏是否暂停
|
||||||
static bool isPaused();
|
static bool isPaused();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue