//-------------------------------------------------------------------------------- void CTokenEditorDlg::OnPaint() { if(! IsIconic()) { PopulateCells(); CDialog::OnPaint(); } }
void Grid::Update() { for (int i = 0; i < NumberOfPartitionsX; ++i) for (int j = 0; j < NumberOfPartitionsY; ++j) part[i][j]->Reset(); PopulateCells(owner->root); }
void Grid::PopulateCells(Entity* ent) { BoxCollider* box = ent->GetComponent<BoxCollider>(); if (box) { box->cell = cell; box->part.clear(); Vector3 min = box->GetMinCoord(); Vector3 max = box->GetMaxCoord(); min.x /= GridWidth; min.x *= NumberOfPartitionsX; max.x /= GridWidth; max.x *= NumberOfPartitionsX; min.y /= GridHeight; min.y *= NumberOfPartitionsY; max.y /= GridHeight; max.y *= NumberOfPartitionsY; for (int i = min.x; i <= max.x; ++i) for (int j = min.y; j <= max.y; ++j) { Partition* c = GetPartition(i, j); if (c) { c->Add(ent); box->part.push_back(c); } } } for (auto &child : ent->GetChildren()) { if (child->IsActive()) PopulateCells(child); } }
//-------------------------------------------------------------------------------- void CTokenEditorDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { int nCurPos = pScrollBar->GetScrollPos(); switch(nSBCode) { case SB_BOTTOM: break; case SB_ENDSCROLL: break; case SB_LINEDOWN: m_list.DoLineDown(nPos, pScrollBar); PopulateCells(); break; case SB_PAGEDOWN: m_list.DoPageDown(nPos, pScrollBar); PopulateCells(); break; case SB_LINEUP: m_list.DoLineUp(nPos, pScrollBar); PopulateCells(); break; case SB_PAGEUP: m_list.DoPageUp(nPos, pScrollBar); PopulateCells(); break; case SB_THUMBPOSITION: m_list.DoThumbPos(nPos, pScrollBar); PopulateCells(); break; case SB_THUMBTRACK: m_list.DoThumbTrack(nPos, pScrollBar); PopulateCells(); break; case SB_TOP: break; } CDialog::OnVScroll(nSBCode, nPos, pScrollBar); }