From 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 02:43:29 +0100 Subject: i am in hell --- src/T2DLL/T2ArrowWnd.cpp | 58 +++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'src/T2DLL/T2ArrowWnd.cpp') diff --git a/src/T2DLL/T2ArrowWnd.cpp b/src/T2DLL/T2ArrowWnd.cpp index 0271881..6c60c08 100644 --- a/src/T2DLL/T2ArrowWnd.cpp +++ b/src/T2DLL/T2ArrowWnd.cpp @@ -3,17 +3,11 @@ #include "T2TowerDoc.h" #include "T2TowerMainView.h" -CObject* PASCAL T2ArrowWnd::CreateObject() { -#line 33 - return DEBUG_NEW T2ArrowWnd; -} -IMPLEMENT_DYNAMIC(T2ArrowWnd, CFrameWnd); - -T2ArrowWnd::T2ArrowWnd() { -} - -/*virtual*/ T2ArrowWnd::~T2ArrowWnd() { -} +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif static POINT rgnPoints[7] = { {20,35}, @@ -25,27 +19,36 @@ static POINT rgnPoints[7] = { {40,15} }; +#line 33 +IMPLEMENT_DYNCREATE(T2ArrowWnd, CFrameWnd); + +T2ArrowWnd::T2ArrowWnd() { +} + +/*virtual*/ T2ArrowWnd::~T2ArrowWnd() { +} + void T2ArrowWnd::Show(int inX, int inY, T2TowerDoc* inDoc) { mWndClass = AfxRegisterWndClass(CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH)); - CRect rect1(0, 0, 50, 50); - Create(mWndClass, "ArrowWnd", WS_CHILD, rect1, inDoc->GetTowerMainView(), NULL, WS_EX_TOPMOST); + CRect rect(0, 0, 50, 50); + Create(mWndClass, "ArrowWnd", WS_CHILD, rect, inDoc->GetTowerMainView(), NULL, WS_EX_TOPMOST); mRgn.CreatePolygonRgn(rgnPoints, 7, ALTERNATE); - CRect rect2; - GetClientRect(rect2); + CRect clientRect; + GetClientRect(clientRect); - CPoint pt; - pt.x = ((rect1.right - rect1.left) - (rect2.right - rect2.left)) / 2; - pt.y = ((rect1.bottom - rect1.top) - (rect2.bottom - rect2.top)) / 2; + CPoint center; + center.x = ((rect.right - rect.left) - (clientRect.right - clientRect.left)) / 2; + center.y = ((rect.bottom - rect.top) - (clientRect.bottom - clientRect.top)) / 2; - CRgn rgn; - rgn.CreateRectRgn(0, 0, 1, 1); - rgn.CopyRgn(&mRgn); - rgn.OffsetRgn(pt.x, pt.y); - SetWindowRgn(rgn, true); - rgn.Detach(); + CRgn region; + region.CreateRectRgn(0, 0, 1, 1); + region.CopyRgn(&mRgn); + region.OffsetRgn(center.x, center.y); + SetWindowRgn(region, true); + region.Detach(); SetWindowPos(NULL, inX - 20, inY - 45, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); GetCurrentT2TowerDoc()->towerDoc_vf290(true); @@ -67,7 +70,12 @@ afx_msg BOOL T2ArrowWnd::OnEraseBkgnd(CDC* pDC) { CRect rect; GetClientRect(rect); - pDC->FillSolidRect(rect, (mCounter & 1) ? RGB(255, 0, 0) : RGB(255, 255, 0)); + COLORREF bkColor; + if (mCounter & 1) + bkColor = RGB(255, 0, 0); + else + bkColor = RGB(255, 255, 0); + pDC->FillSolidRect(rect, bkColor); CBrush brush; brush.CreateStockObject(BLACK_BRUSH); -- cgit v1.2.3