コード例 #1
0
//--------------------------------------------------------------------------------
void CTokenEditorDlg::OnPaint() 
	{
	if(! IsIconic())
		{
		PopulateCells();
		CDialog::OnPaint();
		}
	}
コード例 #2
0
ファイル: Grid.cpp プロジェクト: Dopelust/SP4-10
void Grid::Update()
{
	for (int i = 0; i < NumberOfPartitionsX; ++i)
	for (int j = 0; j < NumberOfPartitionsY; ++j)
				part[i][j]->Reset();

	PopulateCells(owner->root);
}
コード例 #3
0
ファイル: Grid.cpp プロジェクト: Dopelust/SP4-10
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);
	}
}
コード例 #4
0
//--------------------------------------------------------------------------------
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);
	}