Browse Source

调整坐标

Jeff Wang 1 year ago
parent
commit
b077213149

+ 6 - 6
GameAssist/GameAssist/Assist.cpp

@@ -15,12 +15,12 @@ namespace GameAssist
 {
 	RECT g_rcRoleIdleHP = { 55, 8, 116, 13 };
 	RECT g_rcRoleIdleSP = { 55, 20, 116, 25 };
-	RECT g_rcSummonerIdleHP = { 168, 34, 202, 40 };
-	RECT g_rcSummonerIdleSP = { 168, 46, 202, 52 };
-	RECT g_rcRoleFightingHP = { 656, 34, 717, 40 };
-	RECT g_rcRoleFightingSP = { 656, 46, 717, 52 };
-	RECT g_rcSummonerFightingHP = { 766, 34, 800, 40 };
-	RECT g_rcSummonerFightingSP = { 766, 46, 800, 52 };
+	RECT g_rcSummonerIdleHP = { 165, 8, 198, 13 };
+	RECT g_rcSummonerIdleSP = { 165, 20, 198, 25 };
+	RECT g_rcRoleFightingHP = { 653, 8, 715, 13 };
+	RECT g_rcRoleFightingSP = { 653, 20, 715, 25 };
+	RECT g_rcSummonerFightingHP = { 763, 8, 798, 13 };
+	RECT g_rcSummonerFightingSP = { 763, 20, 798, 25 };
 	std::vector<CtrlInfo> g_vtCtrlInfo;
 	std::vector<GameWndInfo> g_vtGameWndInfo;
 	void ClearGameInfo(std::vector<GameWndInfo>& vtGWnd)

+ 4 - 4
GameAssist/GameAssist/GameAssistDlg.cpp

@@ -514,8 +514,8 @@ void CGameAssistDlg::OnBnClickedButton8() // 职业
 			{
 				DebugLog(_T("低SP安全值"));
 				// 右键;
-				pAction->MouseMove({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2 - 3, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 - 20 });
-				pAction->MouseRClick({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2 - 3, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 - 20 });
+				pAction->MouseMove({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 });
+				pAction->MouseRClick({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 });
 			}
 
 			pAction->FightingOthers(g_szHeros[i], "缚神诀");
@@ -564,8 +564,8 @@ void CGameAssistDlg::OnBnClickedButton10() // Alt+A
 			{
 				DebugLog(_T("低SP安全值"));
 				// 右键;
-				pAction->MouseMove({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2 - 3, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 - 20 });
-				pAction->MouseRClick({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2 - 3, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 - 20 });
+				pAction->MouseMove({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 });
+				pAction->MouseRClick({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 });
 			}
 
 			Sleep(800);

+ 8 - 3
GameAssist/GameAssist/ImgAssist.cpp

@@ -426,7 +426,7 @@ namespace ImgAssist
 
 	cv::Mat CropPicture(HWND hWnd, CRect rc)
 	{
-		cv::Mat srcImg = CaptureWnd(hWnd), tempImg, matchImg;
+		cv::Mat srcImg = CaptureWnd(hWnd);
 		if (srcImg.empty())
 		{
 			if (srcImg.data) srcImg.release();
@@ -434,8 +434,13 @@ namespace ImgAssist
 		}
 
 		// 指定源图片区域来做模块比较,提高效率;
-		cv::Mat imgROI;
-		return srcImg(cv::Rect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top));
+		cv::Mat imgROI = srcImg(cv::Rect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top));
+#ifdef DEBUG
+		TCHAR szName[MAX_PATH] = { 0 };
+		_stprintf_s(szName, _T("%s-截图.bmp"), GameGlobal::g_szTempDir);
+		cv::imwrite(szName, imgROI);
+#endif
+		return imgROI;
 	}
 
 	BOOL IsSimilarPicture(const char* szp1, const char* szp2, double lowestMatchValue)