diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2ArrowWnd.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to 'src/T2DLL/T2ArrowWnd.cpp')
-rw-r--r-- | src/T2DLL/T2ArrowWnd.cpp | 100 |
1 files changed, 79 insertions, 21 deletions
diff --git a/src/T2DLL/T2ArrowWnd.cpp b/src/T2DLL/T2ArrowWnd.cpp index 495f0b9..0271881 100644 --- a/src/T2DLL/T2ArrowWnd.cpp +++ b/src/T2DLL/T2ArrowWnd.cpp @@ -1,13 +1,13 @@ +#include "GlobalFunc.h" #include "T2ArrowWnd.h" +#include "T2TowerDoc.h" +#include "T2TowerMainView.h" -/*static*/ CObject* __stdcall T2ArrowWnd::CreateObject() { -} - -/*static*/ CRuntimeClass* __stdcall T2ArrowWnd::_GetBaseClass() { -} - -/*virtual*/ CRuntimeClass* T2ArrowWnd::GetRuntimeClass() const { +CObject* PASCAL T2ArrowWnd::CreateObject() { +#line 33 + return DEBUG_NEW T2ArrowWnd; } +IMPLEMENT_DYNAMIC(T2ArrowWnd, CFrameWnd); T2ArrowWnd::T2ArrowWnd() { } @@ -15,29 +15,87 @@ T2ArrowWnd::T2ArrowWnd() { /*virtual*/ T2ArrowWnd::~T2ArrowWnd() { } -void T2ArrowWnd::Show(int, int, T2TowerDoc*) { -} +static POINT rgnPoints[7] = { + {20,35}, + {0, 15}, + {10,15}, + {10,0}, + {30,0}, + {30,15}, + {40,15} +}; -/*static*/ const AFX_MSGMAP* __stdcall T2ArrowWnd::_GetBaseMessageMap() { -} +void T2ArrowWnd::Show(int inX, int inY, T2TowerDoc* inDoc) { + mWndClass = AfxRegisterWndClass(CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH)); -/*virtual*/ const AFX_MSGMAP* T2ArrowWnd::GetMessageMap() const { -} + CRect rect1(0, 0, 50, 50); + Create(mWndClass, "ArrowWnd", WS_CHILD, rect1, inDoc->GetTowerMainView(), NULL, WS_EX_TOPMOST); -int T2ArrowWnd::OnEraseBkgnd(CDC*) { -} + mRgn.CreatePolygonRgn(rgnPoints, 7, ALTERNATE); -void T2ArrowWnd::OnTimer(unsigned int) { -} + CRect rect2; + GetClientRect(rect2); + + CPoint pt; + pt.x = ((rect1.right - rect1.left) - (rect2.right - rect2.left)) / 2; + pt.y = ((rect1.bottom - rect1.top) - (rect2.bottom - rect2.top)) / 2; + + CRgn rgn; + rgn.CreateRectRgn(0, 0, 1, 1); + rgn.CopyRgn(&mRgn); + rgn.OffsetRgn(pt.x, pt.y); + SetWindowRgn(rgn, true); + rgn.Detach(); + SetWindowPos(NULL, inX - 20, inY - 45, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + + GetCurrentT2TowerDoc()->towerDoc_vf290(true); + GetCurrentT2TowerDoc()->towerDoc_vf1A0(true); -void T2ArrowWnd::OnDestroy() { + mCounter = 0; + SetTimer(1, 50, NULL); } -/*static*/ const CRuntimeClass T2ArrowWnd::classT2ArrowWnd { +BEGIN_MESSAGE_MAP(T2ArrowWnd, CFrameWnd) + ON_WM_ERASEBKGND() + ON_WM_TIMER() + ON_WM_DESTROY() +END_MESSAGE_MAP() + +afx_msg BOOL T2ArrowWnd::OnEraseBkgnd(CDC* pDC) { + int save = pDC->SaveDC(); + { + CRect rect; + GetClientRect(rect); + + pDC->FillSolidRect(rect, (mCounter & 1) ? RGB(255, 0, 0) : RGB(255, 255, 0)); + + CBrush brush; + brush.CreateStockObject(BLACK_BRUSH); + pDC->FrameRgn(&mRgn, &brush, 1, 1); + } + pDC->RestoreDC(save); + return true; } -/*static*/ const AFX_MSGMAP T2ArrowWnd::messageMap { +afx_msg void T2ArrowWnd::OnTimer(UINT nIDEvent) { + if (nIDEvent == 1) { + if (mCounter == 0) + ShowWindow(SW_SHOWNA); + + mCounter++; + if (mCounter > 30) { + ShowWindow(SW_HIDE); + DestroyWindow(); + } else { + InvalidateRect(NULL); + } + } } -/*static*/ const AFX_MSGMAP_ENTRY* const T2ArrowWnd::_messageEntries { +afx_msg void T2ArrowWnd::OnDestroy() { + CFrameWnd::OnDestroy(); + DeleteObject(mRgn); + GetCurrentT2TowerDoc()->towerDoc_vf294(); + GetCurrentT2TowerDoc()->towerDoc_vf1A0(false); + KillTimer(1); } |