Jump to content

Fix Camera when Minimize Client


Recommended Posts

  • Premium
1 minute ago, Abel(Tiger) said:

The tutorial is very old 😅

New tutorial:

// PythonApplicationProcedure.cpp
// After:
					if (m_isWindowFullScreenEnable)
					{
						__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
					}
// Just add:
					OnMouseMiddleButtonUp(0, 0);

That's all! 😬

I guess this solution is more elegant lol

Link to comment
Share on other sites

  • Active Member

@Abel(Tiger) To solve fix camera when minimize client I just need to add: OnMouseMiddleButtonUp(0, 0); instad of writing all the lines of code that you wrote in the past? Or you're just talking about client crash fix? Thanks for the info.

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 1 month later...
  • Honorable Member
On 8/16/2021 at 6:37 PM, Abel(Tiger) said:

The tutorial is very old 😅

New tutorial:

// PythonApplicationProcedure.cpp
// After:
					if (m_isWindowFullScreenEnable)
					{
						__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
					}
// Just add:
					OnMouseMiddleButtonUp(0, 0);

That's all! 😬

The old fix added a new bug. The new fix also adds the same bug. If you switch to another window with ALT+TAB while you have PPM pressed, you won't be able to move the game window, minimize and close.
030505Action-03-10-2021-05-02-28.gif

Edited by Tatsumaru

GhwYizE.gif

Link to comment
Share on other sites

  • Premium

for client crash

void CPythonApplication::__ResetCameraWhenMinimize()
{
	if (m_CursorHandleMap.empty()) // FIXME
		return;

	CCameraManager& rkCmrMgr = CCameraManager::Instance();
	CCamera* pkCmrCur = rkCmrMgr.GetCurrentCamera();
	if (pkCmrCur)
	{
		pkCmrCur->EndDrag();
	}

	SetCursorNum(NORMAL);
	if (CURSOR_MODE_HARDWARE == GetCursorMode())
	{
		SetCursorVisible(TRUE);
	}
}

and

void CPythonApplication::DestroyCursors()
{
	for (auto itor = m_CursorHandleMap.begin(); itor != m_CursorHandleMap.end(); ++itor)
		DestroyCursor((HCURSOR)itor->second);
	m_CursorHandleMap.clear();	// FIXME
}

😁

  • Good 1
Link to comment
Share on other sites

  • 5 months later...
On 10/3/2021 at 5:01 AM, Tatsumaru said:

The old fix added a new bug. The new fix also adds the same bug. If you switch to another window with ALT+TAB while you have PPM pressed, you won't be able to move the game window, minimize and close.
030505Action-03-10-2021-05-02-28.gif

That's right, you just have to do it like this

if(m_isWindowFullScreenEnable)
{
	__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
}
SafeReleaseCapture();
UI::CWindowManager::Instance().RunMouseMiddleButtonUp(short(LOWORD(lParam)), short(HIWORD(lParam)));

 

Edited by Paszka
  • Good 1
Link to comment
Share on other sites

  • Management
1 hour ago, Mafuyu said:

can someone post the "old" fix again so i can remove the old one? added it years ago and the TE was so smart to remove the old code so we cant remove it??

 

Old (2017) (Edit history)

#PythonApplicationProcedure.cpp
//Search this function:
void CPythonApplication::__MinimizeFullScreenWindow(HWND hWnd, DWORD dwWidth, DWORD dwHeight)
{
	ChangeDisplaySettings(0, 0);
	SetWindowPos(hWnd, 0, 0, 0,
				 dwWidth,
				 dwHeight,
				 SWP_SHOWWINDOW);
	ShowWindow(hWnd, SW_MINIMIZE);
}
//Add after:
void CPythonApplication::__ResetCameraWhenMinimize()
{
	CCameraManager& rkCmrMgr=CCameraManager::Instance();
	CCamera* pkCmrCur=rkCmrMgr.GetCurrentCamera();
	if (pkCmrCur) 
	{
		pkCmrCur->EndDrag();
	}
	
	SetCursorNum(NORMAL);
	if ( CURSOR_MODE_HARDWARE == GetCursorMode())
		SetCursorVisible(TRUE);
}

//Search:
					if (m_isWindowFullScreenEnable)
					{
						__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
					}
//Replace with:
					if (m_isWindowFullScreenEnable)
					{
						__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
						__ResetCameraWhenMinimize();
					}
					else
					{
						__ResetCameraWhenMinimize();
					}
#PythonApplication.h
//Search:
		void __MinimizeFullScreenWindow(HWND hWnd, DWORD dwWidth, DWORD dwHeight);
//Add after:
		void __ResetCameraWhenMinimize();

 

  • Love 1
Link to comment
Share on other sites

  • 5 months later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.