FieldCharacter * FieldCharacter::Clone() { FieldCharacter *pCloneCharacter = new FieldCharacter(GetId(), GetName(), characterStandingAnimationIds, characterWalkingAnimationIds, characterRunningAnimationIds); pCloneCharacter->SetHitBox(GetHitBox()->Clone()); pCloneCharacter->SetAnchorPosition(GetAnchorPosition()); pCloneCharacter->SetClickRect(GetClickRect()); pCloneCharacter->interactionLocation = interactionLocation; pCloneCharacter->SetCondition(pCondition != NULL ? pCondition->Clone() : NULL); return pCloneCharacter; }
void CharacterCamera::SetCharacter(Character* pCharacter) { mCharacter = pCharacter; Vector3f anchorPos = GetAnchorPosition(); mCurrentAnchorPos = anchorPos; mPreviousAnchorPos = anchorPos; mPosition = anchorPos; LookAt( GetFocusPosition() ); }
void CharacterCamera::Update(Double pElapsedTime) { // Follow the object if any. if(mCharacter) { mPreviousAnchorPos = mCurrentAnchorPos; mCurrentAnchorPos = GetAnchorPosition(); mPosition = SpringDamp(mPosition, mCurrentAnchorPos, mPreviousAnchorPos, pElapsedTime, mSpringForce, 0.25f, 1.0f); LookAt( GetFocusPosition() ); } }
BOOL CResizableSheet::ArrangeLayoutCallback(LAYOUTINFO &layout) const { if (layout.nCallbackID != m_nCallbackID) // we only added 1 callback return CResizableLayout::ArrangeLayoutCallback(layout); // set layout info for active page layout.hWnd = (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0); if (!::IsWindow(layout.hWnd)) return FALSE; // set margins if (IsWizard()) // wizard mode { // use pre-calculated margins layout.marginTopLeft = m_sizePageTL; layout.marginBottomRight = m_sizePageBR; } else // tab mode { CTabCtrl* pTab = GetTabControl(); ASSERT(pTab != NULL); // get tab position after resizing and calc page rect CRect rectPage, rectSheet; GetTotalClientRect(&rectSheet); if (!GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage)) return FALSE; // no page yet // temporarily resize the tab control to calc page size CRect rectSave; pTab->GetWindowRect(rectSave); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectSave, 2); pTab->SetRedraw(FALSE); pTab->MoveWindow(rectPage, FALSE); pTab->AdjustRect(FALSE, &rectPage); pTab->MoveWindow(rectSave, FALSE); pTab->SetRedraw(TRUE); // set margins layout.marginTopLeft = rectPage.TopLeft() - rectSheet.TopLeft(); layout.marginBottomRight = rectPage.BottomRight() - rectSheet.BottomRight(); } // set anchor types layout.anchorTopLeft = TOP_LEFT; layout.anchorBottomRight = BOTTOM_RIGHT; // use this layout info return TRUE; }
void CResizableSheetEx::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { MinMaxInfo(lpMMI); CTabCtrl* pTab = GetTabControl(); if (!pTab) return; int nCount = GetPageCount(); for (int idx = 0; idx < nCount; ++idx) { if (IsWizard()) // wizard mode { // use pre-calculated margins CRect rectExtra(-CPoint(m_sizePageTL), -CPoint(m_sizePageBR)); // add non-client size ::AdjustWindowRectEx(&rectExtra, GetStyle(), !(GetStyle() & WS_CHILD) && ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); ChainMinMaxInfo(lpMMI, *GetPage(idx), rectExtra.Size()); } else if (IsWizard97()) // wizard 97 { // use pre-calculated margins CRect rectExtra(-CPoint(m_sizePageTL), -CPoint(m_sizePageBR)); if (!(GetPage(idx)->m_psp.dwFlags & PSP_HIDEHEADER)) { // add header vertical offset CRect rectLine, rectSheet; GetTotalClientRect(&rectSheet); GetAnchorPosition(ID_WIZLINEHDR, rectSheet, rectLine); rectExtra.top = -rectLine.bottom; } // add non-client size ::AdjustWindowRectEx(&rectExtra, GetStyle(), !(GetStyle() & WS_CHILD) && ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); ChainMinMaxInfo(lpMMI, *GetPage(idx), rectExtra.Size()); } else // tab mode { ChainMinMaxInfoCB(lpMMI, *GetPage(idx)); } } }
BOOL CResizableSheetEx::CalcSizeExtra(HWND /*hWndChild*/, CSize sizeChild, CSize &sizeExtra) { CTabCtrl* pTab = GetTabControl(); if (!pTab) return FALSE; // get margins of tabcontrol CRect rectMargins; if (!GetAnchorMargins(pTab->m_hWnd, sizeChild, rectMargins)) return FALSE; // get margin caused by tabcontrol CRect rectTabMargins(0,0,0,0); // get tab position after resizing and calc page rect CRect rectPage, rectSheet; GetTotalClientRect(&rectSheet); if (!GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage)) return FALSE; // no page yet // temporarily resize the tab control to calc page size CRect rectSave; pTab->GetWindowRect(rectSave); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectSave, 2); pTab->SetRedraw(FALSE); pTab->MoveWindow(rectPage, FALSE); pTab->AdjustRect(TRUE, &rectTabMargins); pTab->MoveWindow(rectSave, FALSE); pTab->SetRedraw(TRUE); // add non-client size ::AdjustWindowRectEx(&rectTabMargins, GetStyle(), !(GetStyle() & WS_CHILD) && ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); // compute extra size sizeExtra = rectMargins.TopLeft() + rectMargins.BottomRight() + rectTabMargins.Size(); return TRUE; }
Point ClipNode::GetOriginPosition() const { return GetAnchorPosition( Point( 0.0f, 0.0f ) ); }
Vector2 FieldCharacter::GetVectorAnchorPosition() { return Vector2( GetPosition().GetX() + GetClickRect().GetX() + GetClickRect().GetWidth() / 2, GetPosition().GetY() + GetAnchorPosition()); }