本文整理汇总了C++中TVector::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector::GetCount方法的具体用法?C++ TVector::GetCount怎么用?C++ TVector::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector
的用法示例。
在下文中一共展示了TVector::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindNearestNewIndex
int FindNearestNewIndex(int nOldIndex)
{
if (nOldIndex == -1 || m_vectItemsOld.GetCount() == 0)
return -1;
ZAssert(nOldIndex >= 0 && nOldIndex < m_vectItemsOld.GetCount());
int nNewIndex;
// check to see if the old item exists in the new list
nNewIndex = m_plist->GetIndex(m_vectItemsOld[nOldIndex]);
// if we haven't found a new index yet, try searching the items around it
int iDelta = 1;
while (nNewIndex == -1
&& (nOldIndex - iDelta >= 0
|| nOldIndex + iDelta < m_vectItemsOld.GetCount()))
{
if (nOldIndex - iDelta >= 0)
nNewIndex = m_plist->GetIndex(m_vectItemsOld[nOldIndex - iDelta]);
if (nNewIndex != -1 && nOldIndex + iDelta < m_vectItemsOld.GetCount())
nNewIndex = m_plist->GetIndex(m_vectItemsOld[nOldIndex - iDelta]);
++iDelta;
}
// if we still haven't found a new index, default to the first item
if (nNewIndex == -1)
{
nNewIndex = 0;
}
return nNewIndex;
}
示例2: SetColorKey
void SetColorKey(const Color& color)
{
ZAssert(m_datas.GetCount() == 0);
ZAssert(m_datasConverted.GetCount() == 0);
m_bColorKey = true;
m_colorKey = color;
// Update the ddraw surface
SetSurfaceMode(SurfaceModeDD);
DDCOLORKEY key;
key.dwColorSpaceLowValue =
key.dwColorSpaceHighValue = m_data.m_ppf->MakePixel(m_colorKey).Value();
// DDCall(m_data.m_pdds->SetColorKey(DDCKEY_SRCBLT, &key));
// Update the converted ddraw surface
if( m_dataConverted.m_pd3dtexture )
{
_ASSERT( false );
// DDCall(m_dataConverted.m_pdds->SetColorKey(DDCKEY_SRCBLT, &key));
}
SurfaceChanged();
}
示例3: ScrollToItemByIdx
void ScrollToItemByIdx(int iItem)
{
if (m_vItems.GetCount() == 0)
{
// nothing to do
return;
}
ZAssert((iItem == 0) || ((iItem > 0) && (iItem < m_vItems.GetCount())));
// find the first and last matching item
int iTop, iBottom;
iTop = iBottom = iItem;
while (iTop > 0 && m_vItems[iTop-1] == m_vItems[iTop])
iTop--;
while (iBottom < m_vItems.GetCount()-1 && m_vItems[iBottom+1] == m_vItems[iBottom])
iBottom++;
if (iBottom > LastVisibleItem())
m_iTopItem = max(iBottom - (m_cVisibleItems - 1), 0);
if (iTop < m_iTopItem)
m_iTopItem = iTop;
if (m_pScrollPane)
m_pScrollPane->SetPos(m_iTopItem);
NeedPaint();
}
示例4: Paint
void Paint( Surface * pSurface )
{
if (m_pImageBkgnd)
{
// TBD: See original function below.
_ASSERT( false );
}
// calc num Items to draw
int iLastVisibleItem = LastVisibleItem();
int iLastItem = m_vItems.GetCount() - 1;
if (iLastVisibleItem > iLastItem)
iLastVisibleItem = iLastItem;
// draw each Item
WinRect rectPaint = WinRect(0, 0, m_nItemWidth, YSize());
WinRect rectItem = rectPaint;
rectItem.bottom = rectItem.top;
ZAssert(m_iTopItem >= 0);
// count the number of slots for the first item which we are not drawing
int nNumHiddenSlots = 0;
if (m_vItems.GetCount() > 0)
{
while (m_iTopItem - nNumHiddenSlots > 0
&& m_vItems[m_iTopItem - (nNumHiddenSlots + 1)] == m_vItems[m_iTopItem])
nNumHiddenSlots++;
for (int iItem = m_iTopItem;
iItem <= iLastVisibleItem;
iItem += m_vItems[iItem]->GetItemHeight() - nNumHiddenSlots, nNumHiddenSlots = 0 )
{
rectItem.top = rectItem.bottom;
int nLinesLeft = (iLastVisibleItem - iItem) + 1;
int nLines = m_vItems[iItem]->GetItemHeight() - nNumHiddenSlots;
rectItem.bottom += m_nItemHeight * (nLines > nLinesLeft ? nLinesLeft : nLines);
// draw highlight if selected
bool bItemSel = (m_iSelItem == iItem);
if (bItemSel && m_pImageBkgndSel)
{
// TBD: See original function below.
_ASSERT( false );
}
// draw item
m_vItems[iItem]->DrawItem(pSurface, rectItem, bItemSel, nNumHiddenSlots);
}
}
}
示例5: GetString
ZString GetString(int indent)
{
// KeyFramedTranslate([ time, x, y, z ], frame)
ZString str = "KeyFramedTranslate(\n" + Indent(indent + 1) + "[\n";
int count = m_keys.GetCount();
for (int index = 0; index < count; index++) {
str +=
Indent(indent + 2)
+ ZString(m_keys[index].m_frame) + ", "
+ ZString(m_keys[index].m_vec.X()) + ", "
+ ZString(m_keys[index].m_vec.Y()) + ", "
+ ZString(m_keys[index].m_vec.Z());
if (index < count - 1) {
str += ",\n";
} else {
str += "\n";
}
}
return
str
+ Indent(indent + 1) + "],\n"
+ Indent(indent + 1) + GetFrame()->GetChildString(indent + 1) + "\n"
+ Indent(indent) + ")";
}
示例6: Evaluate
void Evaluate()
{
float frame = GetFrame()->GetValue();
int count = m_keys.GetCount();
if (frame <= m_keys[0].m_frame) {
//
// Before first key
//
GetValueInternal().SetTranslate(m_keys[0].m_vec);
} else if (frame >= m_keys[count - 1].m_frame) {
//
// After last key
//
GetValueInternal().SetTranslate(m_keys[count - 1].m_vec);
} else {
//
// Between two keys
//
int index = 0;
while (frame > m_keys[index + 1].m_frame) {
index++;
}
Vector vecDelta = m_keys[index + 1].m_vec - m_keys[index].m_vec;
float interpolant = (frame - m_keys[index].m_frame) / (m_keys[index + 1].m_frame - m_keys[index].m_frame);
GetValueInternal().SetTranslate(m_keys[index].m_vec + vecDelta * interpolant);
}
}
示例7: CalcBounds
void CalcBounds()
{
int rows = m_vvstr.GetCount();
int columns = m_vvstr[0].GetCount();
float xsize = 0;
for (int column = 0; column < columns; column++) {
m_vColumn.Set(column, xsize);
float xsizeColumn = 0;
for (int row = 0; row < rows; row++) {
WinPoint size = m_pfont->GetTextExtent(m_vvstr[row][column]);
if ((float)size.X() > xsizeColumn) {
xsizeColumn = (float)size.X();
}
}
xsize += xsizeColumn + 4;
}
m_bounds.SetRect(
Rect(
0,
(float)(-(rows * m_ysizeRow)),
(float)xsize,
0
)
);
}
示例8: GetItemByIdx
TRef<ListItem> GetItemByIdx(long iItem)
{
if ((-1 >= iItem) || (iItem >= m_vItems.GetCount()))
return NULL;
else
return m_vItems[iItem];
}
示例9: PartialInvestItemByIdx
// TE: Added PartialInvest method to trigger right-clicking
void PartialInvestItemByIdx(int iItem)
{
if (iItem < 0)
iItem = -1;
if (iItem >= m_vItems.GetCount())
iItem = m_vItems.GetCount() - 1;
// find the first matching item
while (iItem >= 1 && m_vItems[iItem-1] == m_vItems[iItem])
iItem--;
m_iSelItem = iItem;
NeedPaint();
m_pRightClickEventSource->Trigger(m_iSelItem);
}
示例10: GetValue
Number* GetValue(int id)
{
if (id < m_vvalueObject.GetCount()) {
return m_vvalueObject[id]->GetValue();
} else {
return NULL;
}
}
示例11: IsDown
Boolean* IsDown(int id)
{
if (id < m_vbuttonObject.GetCount()) {
return m_vbuttonObject[id]->GetValue();
} else {
return NULL;
}
}
示例12: NextItem
//Imago #133 7/10
void NextItem()
{
if (GetSelItemIdx() < m_vItems.GetCount() - 1) {
SetSelItemByIdx(GetSelItemIdx()+1);
if ((GetScrollPosition() + m_cVisibleItems) <= GetSelItemIdx())
ScrollPageDown();
}
}
示例13: SetScrollPosition
void SetScrollPosition(int iPosition)
{
m_iTopItem = iPosition;
if (m_iTopItem > (m_vItems.GetCount() - m_cVisibleItems)) {
m_iTopItem = max(0, m_vItems.GetCount() - m_cVisibleItems);
}
if (m_iTopItem < 0) {
m_iTopItem = 0;
}
if (m_pScrollPane) {
m_pScrollPane->SetPos(m_iTopItem);
}
NeedPaint();
}
示例14: RemoveAll
void RemoveAll()
{
m_vItems.SetEmpty();
if (m_pScrollPane) {
m_pScrollPane->SetSize(m_vItems.GetCount());
m_pScrollPane->SetPos(0);
}
SetSelItemByIdx(-1);
NeedPaint();
}
示例15: GetItemIdx
int GetItemIdx(ListItem* pListItem)
{
int cItems = m_vItems.GetCount();
for (int iItem = 0; iItem < cItems; iItem++)
{
if (m_vItems[iItem] == pListItem)
return iItem;
}
return -1;
}