Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #139 from Timothy-LiuXuefeng/timothy
Browse files Browse the repository at this point in the history
Add debug info and fixed some bugs
  • Loading branch information
BryantSuen authored May 13, 2021
2 parents 6a27aa1 + 125cb15 commit 93aa9dd
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
9 changes: 8 additions & 1 deletion logic/GameEngine/MoveEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ public void MoveObj(IMovable obj, int moveTime, double moveDirection)
MaxTolerantTimeExceedCount = ulong.MaxValue,
TimeExceedAction = b =>
{
Console.WriteLine("The computer runs so slow that the player cannot finish moving during this time!!!!!!");
if (b) Console.WriteLine("Fatal Error: The computer runs so slow that the object cannot finish moving during this time!!!!!!");

#if DEBUG
else
{
Console.WriteLine("Debug info: Object moving time exceed for once.");
}
#endif
}
}.Start();
}
Expand Down
8 changes: 4 additions & 4 deletions logic/LocalUIDll/BasicWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BOOL BasicWindow::Init
(
HINSTANCE hInstance, int nCmdShow,
int x, int y, int cx, int cy, DWORD dwStyle,
LPCTSTR c_lpszWndTitle, WNDCLASSEX wcex
LPCTSTR c_lpszWndTitle, WNDCLASSEX wcex, HWND hWndParent
)
{
wcex.lpfnWndProc = WndProc;
Expand All @@ -15,7 +15,7 @@ BOOL BasicWindow::Init
}

// 执行应用程序初始化:
if (!InitInstance(hInstance, nCmdShow, x, y, cx, cy, dwStyle, wcex.lpszClassName, c_lpszWndTitle))
if (!InitInstance(hInstance, nCmdShow, x, y, cx, cy, dwStyle, wcex.lpszClassName, c_lpszWndTitle, hWndParent))
{
MessageBox(NULL, TEXT("Window creating failed!"), c_lpszError, MB_OK | MB_ICONERROR);
return FALSE;
Expand All @@ -31,12 +31,12 @@ BOOL BasicWindow::Init
// 目标: 保存实例句柄、主窗口句柄并创建主窗口
//

BOOL BasicWindow::InitInstance(HINSTANCE hInstance, int nCmdShow, int x, int y, int cx, int cy, DWORD dwStyle, LPCTSTR c_lpszWndClassName, LPCTSTR c_lpszWndTitle)
BOOL BasicWindow::InitInstance(HINSTANCE hInstance, int nCmdShow, int x, int y, int cx, int cy, DWORD dwStyle, LPCTSTR c_lpszWndClassName, LPCTSTR c_lpszWndTitle, HWND hWndParent)
{
m_hInst = hInstance; //将实例句柄存储在成员变量中

HWND hWnd = CreateWindow(c_lpszWndClassName, c_lpszWndTitle, dwStyle,
x, y, cx, cy, NULL, NULL, hInstance, this);
x, y, cx, cy, hWndParent, NULL, hInstance, this);

if (!hWnd)
{
Expand Down
4 changes: 2 additions & 2 deletions logic/LocalUIDll/BasicWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class BasicWindow
(
HINSTANCE hInstance, int nCmdShow,
int x, int y, int cx, int cy, DWORD dwStyle,
LPCTSTR c_lpszWndTitle, WNDCLASSEX wcex
LPCTSTR c_lpszWndTitle, WNDCLASSEX wcex, HWND hWndParent
);

//处理了消息返回true,没有处理则返回false
virtual bool MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) = 0;

private:

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, int x, int y, int cx, int cy, DWORD dwStyle, LPCTSTR c_lpszWndClassName, LPCTSTR c_c_lpszWndTitle);
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, int x, int y, int cx, int cy, DWORD dwStyle, LPCTSTR c_lpszWndClassName, LPCTSTR c_c_lpszWndTitle, HWND hWndParent);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

};
Expand Down
2 changes: 1 addition & 1 deletion logic/LocalUIDll/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int UI::Begin()

Init(GetModuleHandle(NULL), SW_NORMAL, 0, 0, width, height,
WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_BORDER | WS_MINIMIZEBOX,
TEXT("THUnity"), wcex);
TEXT("THUnity"), wcex, GetConsoleWindow());

MSG msg;

Expand Down
2 changes: 1 addition & 1 deletion logic/publish/publishall.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
SETLOCAL

:: The root folder to publish into
set PUBLISHROOT="..\private\ReleaseDemo\Release 3.0"
set PUBLISHROOT="..\private\ReleaseDemo\Release 4.0"

:: Create Relative drectories
mkdir %PUBLISHROOT%\linux\bin\Debug
Expand Down
8 changes: 4 additions & 4 deletions playback/PlayBackPlayerDll/BasicWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BOOL BasicWindow::Init
(
HINSTANCE hInstance, int nCmdShow,
int x, int y, int cx, int cy, DWORD dwStyle,
LPCTSTR c_lpszWndTitle, WNDCLASSEX wcex
LPCTSTR c_lpszWndTitle, WNDCLASSEX wcex, HWND hWndParent
)
{
wcex.lpfnWndProc = WndProc;
Expand All @@ -15,7 +15,7 @@ BOOL BasicWindow::Init
}

// 执行应用程序初始化:
if (!InitInstance(hInstance, nCmdShow, x, y, cx, cy, dwStyle, wcex.lpszClassName, c_lpszWndTitle))
if (!InitInstance(hInstance, nCmdShow, x, y, cx, cy, dwStyle, wcex.lpszClassName, c_lpszWndTitle, hWndParent))
{
MessageBox(NULL, TEXT("Window creating failed!"), c_lpszError, MB_OK | MB_ICONERROR);
return FALSE;
Expand All @@ -31,12 +31,12 @@ BOOL BasicWindow::Init
// 目标: 保存实例句柄、主窗口句柄并创建主窗口
//

BOOL BasicWindow::InitInstance(HINSTANCE hInstance, int nCmdShow, int x, int y, int cx, int cy, DWORD dwStyle, LPCTSTR c_lpszWndClassName, LPCTSTR c_lpszWndTitle)
BOOL BasicWindow::InitInstance(HINSTANCE hInstance, int nCmdShow, int x, int y, int cx, int cy, DWORD dwStyle, LPCTSTR c_lpszWndClassName, LPCTSTR c_lpszWndTitle, HWND hWndParent)
{
m_hInst = hInstance; //将实例句柄存储在成员变量中

HWND hWnd = CreateWindow(c_lpszWndClassName, c_lpszWndTitle, dwStyle,
x, y, cx, cy, NULL, NULL, hInstance, this);
x, y, cx, cy, hWndParent, NULL, hInstance, this);

if (!hWnd)
{
Expand Down
12 changes: 6 additions & 6 deletions playback/PlayBackPlayerDll/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ int UI::Begin(System::String^ initialFileName)
GetObject(hBmBkGnd, sizeof(bkGnd), &bkGnd);
}

Init(GetModuleHandle(NULL), SW_NORMAL, 0, 0, width, height,
WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_BORDER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME,
TEXT("THUAI Playback"), wcex, GetConsoleWindow());

SetMenu(m_hWnd, hMenu);

if (!chooseFileDlg.Begin(hRes, MAKEINTRESOURCE(IDD_CHOOSESPEEDDLG), m_hWnd))
{
if (MessageBox(GetConsoleWindow(), TEXT("The library PlayBackPlayerResources.dll might have been destroyed, continue?"), TEXT("Error"), MB_YESNO | MB_ICONERROR) != IDYES)
Expand All @@ -173,12 +179,6 @@ int UI::Begin(System::String^ initialFileName)
}
}

Init(GetModuleHandle(NULL), SW_NORMAL, 0, 0, width, height,
WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_BORDER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME,
TEXT("THUAI Playback"), wcex);

SetMenu(m_hWnd, hMenu);

FreeLibrary(hRes);


Expand Down

0 comments on commit 93aa9dd

Please sign in to comment.