本文整理汇总了C++中TVector::PushEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector::PushEnd方法的具体用法?C++ TVector::PushEnd怎么用?C++ TVector::PushEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector
的用法示例。
在下文中一共展示了TVector::PushEnd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChatListItem
ChatListItem(ChatInfo* pchatInfo, const WinPoint& ptLineSize) :
m_lData((long)pchatInfo),
m_pchatInfo(pchatInfo),
m_ptLineSize(ptLineSize)
{
ZString strMsg = CensorBadWords (m_pchatInfo->GetMessage());
IEngineFont* pfont = pchatInfo->IsFromLeader() ? TrekResources::SmallBoldFont() : TrekResources::SmallFont();
int nStrLenLeft = strMsg.GetLength();
int nStrLenLine;
while ((nStrLenLine = pfont->GetMaxTextLength(strMsg, ptLineSize.X(), true))
< nStrLenLeft)
{
int nStrLenWordBreak = nStrLenLine;
while (nStrLenWordBreak > 2 && strMsg[nStrLenWordBreak] != ' ' && strMsg[nStrLenWordBreak-1] != ' ')
nStrLenWordBreak--;
if (nStrLenWordBreak != 2)
nStrLenLine = nStrLenWordBreak;
if (nStrLenLine <= 2)
{
// put a blank line without the character
nStrLenLine = 3;
m_vMsgLines.PushEnd("");
}
else
{
m_vMsgLines.PushEnd(strMsg.Left(nStrLenLine));
}
strMsg = " " + strMsg.RightOf(nStrLenLine);
nStrLenLeft -= nStrLenLine - 2;
ZAssert(strMsg.GetLength() == nStrLenLeft);
}
m_vMsgLines.PushEnd(strMsg);
}
示例2: EnumObjectsCallback
BOOL EnumObjectsCallback(
LPCDIDEVICEOBJECTINSTANCE pddoi
) {
if (
pddoi->dwType & DIDFT_AXIS
|| pddoi->dwType & DIDFT_POV
) {
int index;
if (pddoi->guidType == GUID_XAxis ) {
index = 0;
} else if (pddoi->guidType == GUID_YAxis ) {
index = 1;
} else if (pddoi->guidType == GUID_Slider) {
index = 2;
} else if (pddoi->guidType == GUID_RzAxis) {
index = 3;
} else if (pddoi->guidType == GUID_POV ) {
index = 4;
} else {
index = -1;
}
ValueDDInputObject* pobject =
new ValueDDInputObject(
pddoi->tszName,
pddoi->dwType,
pddoi->guidType
);
if (index == -1) {
m_vvalueObject.PushEnd(pobject);
} else {
m_vvalueObject.Set(index, pobject);
}
} else if (pddoi->dwType & DIDFT_PSHBUTTON) {
ButtonDDInputObject* pobject =
new ButtonDDInputObject(
pddoi->tszName,
pddoi->dwType,
pddoi->guidType
);
m_vbuttonObject.PushEnd(pobject);
}
return DIENUM_CONTINUE;
}
示例3: EnumerateDisplayModes
//////////////////////////////////////////////////////////////////////////////
// EnumerateDisplayModes()
// Using the D3D9 interface, grab all available display modes and add
// to the vector of available modes.
// For now, we'll just interrogate the primary device, although this should
// be extended to all devices, so the user could select which monitor the game
// is displayed on. We are also sticking with 16 bit format for now too,
// although we really want to move to 32 bit.
//////////////////////////////////////////////////////////////////////////////
HRESULT EnumerateDisplayModes( )
{
DWORD i;
D3DFORMAT desiredFormat = D3DFMT_R5G6B5;
DWORD dwModeCount = m_pd3d->GetAdapterModeCount( D3DADAPTER_DEFAULT, desiredFormat );
D3DDISPLAYMODE dispMode;
WinPoint winSize;
for( i=0; i<dwModeCount; i++ )
{
if( m_pd3d->EnumAdapterModes( D3DADAPTER_DEFAULT,
desiredFormat,
i,
&dispMode ) != D3D_OK )
{
OutputDebugString( "Failed to enumerate adapter modes.\n");
_ASSERT( false );
return E_FAIL;
}
for( int iIndex=0; iIndex<g_countValidModes; iIndex++ )
{
if( ( dispMode.Width == g_validModes[iIndex].X() ) &&
( dispMode.Height == g_validModes[iIndex].Y() ) )
{
winSize.SetX( dispMode.Width );
winSize.SetY( dispMode.Height );
m_modes.PushEnd( winSize );
break;
}
}
}
return S_OK;
}
示例4: AddKey
void AddKey(float frame, const Quaternion& quat)
{
int count = m_keys.GetCount();
ZAssert(count == 0 || frame > m_keys.GetEnd().m_frame);
m_keys.PushEnd();
m_keys.GetEnd().m_frame = frame;
m_keys.GetEnd().m_quat = quat;
}
示例5: GetTextureX
IDirect3DTextureX* GetTextureX(PixelFormat* ppf, const WinPoint& size, int& id)
{
id = m_data.m_id;
// Return the fullsize surface if that's what's wanted.
if (size == m_size)
{
if (ppf == m_data.m_ppf)
{
SetSurfaceMode(SurfaceModeDD);
return m_data.m_pd3dtexture;
}
UpdateConvertedSurface(ppf, m_size, m_dataConverted, m_data);
return m_dataConverted.m_pd3dtexture;
}
// Need to return a lower level of detail
int index = 0;
WinPoint sizeSource = m_size;
while (true) {
sizeSource.SetX(sizeSource.X() / 2);
sizeSource.SetY(sizeSource.Y() / 2);
//
// Do we need to allocate a new lower level of detail?
//
if (index == m_datas.GetCount()) {
m_datas.PushEnd();
m_datasConverted.PushEnd();
ConstructSurfaceData(m_datas.Get(index), m_data.m_ppf, sizeSource);
}
// Do we need to update this level?
if (m_datas[index].m_id != m_data.m_id)
{
_ASSERT( false );
/* DownSample(
sizeSource,
m_datas[index].m_pdds,
index == 0 ?
m_data.m_pdds
: m_datas[index - 1].m_pdds
);
m_datas.Get(index).m_id = m_data.m_id;*/
}
// Did we find the right size?
if (sizeSource == size)
{
// Does the format need to be converted?
if (ppf == m_data.m_ppf)
{
return m_datas[index].m_pd3dtexture;
}
else
{
UpdateConvertedSurface(ppf, size, m_datasConverted.Get(index), m_datas[index]);
return m_datasConverted[index].m_pd3dtexture;
}
}
index++;
}
}