本文整理汇总了C++中Array::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::Clear方法的具体用法?C++ Array::Clear怎么用?C++ Array::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShutDown
void ShutDown()
{
#if BUILD_DEV
PRINTF( "SimCount: %d RenderCount: %d\n", g_DEBUGTickSimCount, g_DEBUGTickRenderCount );
#endif
g_Statuses.Clear();
g_HTTPResultBuffer.Clear();
g_FilesInManifest.Clear();
g_CommandLineArguments.Clear();
SafeDelete( g_CommandLine );
SafeDelete( g_Clock );
SafeDelete( g_Keyboard );
SafeDelete( g_Renderer );
SafeDelete( g_MenuSurface );
SafeDelete( g_BackBufferSurface );
SafeDelete( g_HTTPSocket );
StringManager::DeleteInstance();
PrintManager::DeleteInstance();
ConfigManager::DeleteInstance();
PackStream::StaticShutDown();
}
示例2: BuildMenu
void OvrOutOfSpaceMenu::BuildMenu( int memoryInKB )
{
const VRMenuFontParms fontParms( true, true, false, false, true, 0.505f, 0.43f, 1.0f );
Array< VRMenuObjectParms const * > parms;
int menuId = 9000;
// ---
// Icon
{
VRMenuSurfaceParms iconSurfParms( "",
"res/raw/out_of_disk_space_warning.png", SURFACE_TEXTURE_DIFFUSE,
"", SURFACE_TEXTURE_MAX,
"", SURFACE_TEXTURE_MAX );
VRMenuObjectParms iconParms(
VRMENU_STATIC, Array< VRMenuComponent* >(), iconSurfParms, "",
Posef( Quatf(), Vector3f( 0.0f, CENTER_TO_ICON_Y_OFFSET, 0.0f ) ),
Vector3f( 1.0f ), fontParms, VRMenuId_t( ++menuId ),
VRMenuObjectFlags_t( VRMENUOBJECT_DONT_HIT_ALL ),
VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );
parms.PushBack( &iconParms );
AddItems( AppPtr->GetVRMenuMgr(), AppPtr->GetDefaultFont(), parms, GetRootHandle(), true );
parms.Clear();
}
// ---
// Message
{
String outOfSpaceMsg;
VrLocale::GetString( AppPtr->GetVrJni(), AppPtr->GetJavaObject(),
"@string/out_of_memory",
"To use this app, please free up at least %dKB of storage space on your phone.",
outOfSpaceMsg );
char charBuff[10];
sprintf( charBuff, "%d", memoryInKB );
outOfSpaceMsg = VrLocale::GetXliffFormattedString( outOfSpaceMsg, charBuff );
BitmapFont & font = AppPtr->GetDefaultFont();
font.WordWrapText( outOfSpaceMsg, 1.4f );
VRMenuObjectParms titleParms(
VRMENU_STATIC,
Array< VRMenuComponent* >(),
VRMenuSurfaceParms(),
(const char*)outOfSpaceMsg,
Posef( Quatf(), Vector3f( 0.0f, CENTER_TO_TEXT_Y_OFFSET, 0.0f ) ),
Vector3f( 1.0f ),
fontParms,
VRMenuId_t( ++menuId ),
VRMenuObjectFlags_t( VRMENUOBJECT_DONT_HIT_TEXT ),
VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );
parms.PushBack( &titleParms );
AddItems( AppPtr->GetVRMenuMgr(), AppPtr->GetDefaultFont(), parms, GetRootHandle(), true );
parms.Clear();
}
this->SetMenuPose( Posef( Quatf(), Vector3f( 0.0f, 0.0f, -3.0f ) ) );
}
示例3: GetAmbientOcclusionTaps
// Get fake Poisson taps in one-third sections of
// the unit hemisphere for doing directional AO.
void MeshCompiler::GetAmbientOcclusionTaps( Array< Vector >& Taps, const Matrix& TangentSpace )
{
Taps.Clear();
Taps.Resize( 51 );
Taps[0] = Vector( 0.0f, 0.81649700000000003f, 0.57735000000000003f );
Taps[1] = Vector( -0.74401973459062531f, 0.57783472685691717f, 0.33547229837631554f );
Taps[2] = Vector( 0.25901018724643815f, 0.68792466879887804f, 0.67799216290494024f );
Taps[3] = Vector( -0.58988856970793446f, 0.80685558587873407f, 0.031867520521874151f );
Taps[4] = Vector( 0.26882545565790789f, 0.93007621426021569f, 0.25038192837683715f );
Taps[5] = Vector( 0.0041285378312679675f, 0.52339192756451713f, 0.85208206490670535f );
Taps[6] = Vector( 0.52300845383744843f, 0.83589430002845266f, 0.16656192960729299f );
Taps[7] = Vector( 0.67164601369536103f, 0.61759181590387924f, 0.40923340676889991f );
Taps[8] = Vector( -0.38725619624135338f, 0.76349261896781795f, 0.51682846211711353f );
Taps[9] = Vector( 0.55273004695713479f, 0.56155706754364609f, 0.61574601507646354f );
Taps[10] = Vector( 0.72493806462362065f, 0.68525434936331431f, 0.069937680390617263f );
Taps[11] = Vector( -0.57003909323433155f, 0.74767366048824102f, 0.34064575382161405f );
Taps[12] = Vector( -0.4883240745402157f, 0.56430943593345706f, 0.66565340736820811f );
Taps[13] = Vector( 0.24691230716222037f, 0.50036658190736905f, 0.82985998595074195f );
Taps[14] = Vector( -0.26737561786638481f, 0.53293155768514677f, 0.80280398217363869f );
Taps[15] = Vector( -0.33103794538084164f, 0.93594428249487172f, 0.12009237604107406f );
Taps[16] = Vector( 0.076679712920537185f, 0.99461859155774424f, 0.069671220414983512f );
Matrix FirstSection = Matrix::CreateRotationAboutZ( -TWOPI / 3.0f );
Matrix ThirdSection = Matrix::CreateRotationAboutZ( TWOPI / 3.0f );
for( uint i = 0; i < 17; ++i )
{
Vector Tap = Taps[ i ];
Taps[ i ] = ( Tap * FirstSection ) * TangentSpace;
Taps[ i + 17 ] = Tap * TangentSpace;
Taps[ i + 34 ] = ( Tap * ThirdSection ) * TangentSpace;
}
}
示例4: GetWorkArea
void Ctrl::GetWorkArea(Array<Rect>& rc)
{
GuiLock __;
GdkScreen *s = gdk_screen_get_default();
int n = gdk_screen_get_n_monitors(s);
rc.Clear();
Vector<int> netwa;
for(int i = 0; i < n; i++) {
GdkRectangle rr;
Rect r;
#if GTK_CHECK_VERSION (3, 3, 5) // U++ does not work with gtk3 yet, but be prepared
gdk_screen_get_monitor_workarea(s, i, &rr);
r = RectC(r.x, r.y, r.width, r.height);
#else
gdk_screen_get_monitor_geometry (s, i, &rr);
r = RectC(rr.x, rr.y, rr.width, rr.height);
#ifdef GDK_WINDOWING_X11
if(i == 0)
netwa = GetPropertyInts(gdk_screen_get_root_window(gdk_screen_get_default()),
"_NET_WORKAREA");
if(netwa.GetCount())
r = r & RectC(netwa[0], netwa[1], netwa[2], netwa[3]);
#endif
#endif
rc.Add(r);
}
}
示例5: ConstructKeyFromStrings
// Add a bunch of strings together to produce a more robust key
void Crypto::ConstructKeyFromStrings( const Array< SimpleString >& Keys, Array< char >& OutKey )
{
ASSERT( Keys.Size() );
Array< Array< char > > KeyArrays;
uint Length = Keys[0].Length();
// Push arrays one at a time instead of resizing, so they are constructed and not simply allocated
for( uint KeyIndex = 0; KeyIndex < Keys.Size(); ++KeyIndex )
{
const SimpleString& Key = Keys[ KeyIndex ];
KeyArrays.PushBack( Array< char >() );
Key.FillArray( KeyArrays[ KeyIndex ] );
Length = Min( Length, Key.Length() );
}
OutKey.Clear();
for( uint Index = 0; Index < Length; ++Index )
{
OutKey.PushBack( 0 );
for( uint KeyIndex = 0; KeyIndex < Keys.Size(); ++KeyIndex )
{
OutKey[ Index ] = ( OutKey[ Index ] + KeyArrays[ KeyIndex ][ Index ] ) & 255;
}
}
}
示例6: FillArray
void SimpleString::FillArray( Array<char>& OutArray, bool WithNull /*= false*/ ) const
{
const uint Length = WithNull ? m_Length + 1 : m_Length;
OutArray.Clear();
OutArray.Resize( Length );
memcpy_s( OutArray.GetData(), Length, m_String, Length );
}
示例7: EnumerateDisplayModes
/*virtual*/ void D3D9Renderer::EnumerateDisplayModes(
Array<SDisplayMode>& DisplayModes) {
DisplayModes.Clear();
EnumerateDisplayModes(DisplayModes, D3DFMT_X8R8G8B8);
EnumerateDisplayModes(DisplayModes, D3DFMT_A8R8G8B8);
ASSERT(DisplayModes.Size());
}
示例8: Shutdown
//==============================
// ovrFileSysLocal::Shutdown
void ovrFileSysLocal::Shutdown()
{
for ( int i = 0; i < Schemes.GetSizeI(); ++i )
{
Schemes[i]->Shutdown();
delete Schemes[i];
Schemes[i] = NULL;
}
Schemes.Clear();
}
示例9: GetGraphicsCardList
// From http://stackoverflow.com/questions/9524309/enumdisplaydevices-function-not-working-for-me
void GetGraphicsCardList( Array< String > &gpus)
{
gpus.Clear();
DISPLAY_DEVICEW dd;
dd.cb = sizeof(dd);
DWORD deviceNum = 0;
while( EnumDisplayDevicesW(NULL, deviceNum, &dd, 0) )
{
if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
gpus.PushBack(String(dd.DeviceString));
deviceNum++;
}
}
示例10: EnumDisplaySettings
/*static*/ void Display::EnumerateDisplayModes( Array<SDisplayMode>& DisplayModes )
{
DisplayModes.Clear();
#if BUILD_WINDOWS_NO_SDL
DEVMODE DevMode;
uint ModeIndex = 0;
BOOL Valid = TRUE;
for( ; Valid; ++ModeIndex )
{
Valid = EnumDisplaySettings( NULL, ModeIndex, &DevMode );
// Some users have problems if their refresh rate is set to 59 Hz. Maybe I should reconsider this?
if( DevMode.dmBitsPerPel == 32 )
{
SDisplayMode Mode;
Mode.Width = DevMode.dmPelsWidth;
Mode.Height = DevMode.dmPelsHeight;
DisplayModes.PushBackUnique( Mode );
}
}
#endif
#if BUILD_SDL
PRINTF( "Enumerating SDL display modes...\n" );
const int NumDisplays = SDL_GetNumVideoDisplays();
for( int DisplayIndex = 0; DisplayIndex < NumDisplays; ++DisplayIndex )
{
const int NumModes = SDL_GetNumDisplayModes( DisplayIndex );
for( int ModeIndex = 0; ModeIndex < NumModes; ++ModeIndex )
{
SDL_DisplayMode DisplayMode;
SDL_GetDisplayMode( DisplayIndex, ModeIndex, &DisplayMode );
if( SDL_BYTESPERPIXEL( DisplayMode.format ) == 4 )
{
SDisplayMode Mode;
Mode.Width = DisplayMode.w;
Mode.Height = DisplayMode.h;
DisplayModes.PushBackUnique( Mode );
PRINTF( "Enumerated mode %dx%d\n", Mode.Width, Mode.Height );
}
}
}
#endif
ASSERT( DisplayModes.Size() );
}
示例11: ReadString
void StreamReader::ReadString(String *result, const String &delimiter) {
Array<Char> retString;
Array<Char> delString;
String strDelimiter = delimiter;
Char c;
if (strDelimiter.IsEmpty()) {
strDelimiter.Resize(1);
strDelimiter.Append("\0");
}
while (true) {
c = ReadByte();
if (this->GetError())
break;
if (c == strDelimiter.GetData()[0]) {
delString.Clear();
delString.Append(c);
for (Int i = 1; i < strDelimiter.GetSizeInBytes(); i++) {
c = ReadByte();
if (this->GetError()) {
for (Int j = 0; j < delString.GetElementCount(); j++)
retString.Append(delString[j]);
break;
}
delString.Append(c);
if (c != strDelimiter.GetData()[i])
break;
}
if (strDelimiter.GetSizeInBytes() > delString.GetElementCount())
for (Int i = 0; i < delString.GetElementCount(); i++)
retString.Append(delString[i]);
else {
if (memcmp(strDelimiter.GetData(),
delString.GetData(), delString.GetElementCount()))
{
for (Int i = 0; i < delString.GetElementCount(); i++)
retString.Append(delString[i]);
}
else
break;
}
} else {
retString.Append(c);
}
}
result->Resize(retString.GetElementCount());
memcpy((Char*)result->GetData(),
retString.GetData(), retString.GetElementCount());
}
示例12: CalculateCubicSpline
// [TODO] Comment/Cleanup
void CubicSpline::CalculateCubicSpline(uint32 n, Array<TransferControlPoint> &v, Array<CubicSpline> &cubic)
{
if (n) {
// From: http://graphicsrunner.blogspot.com/2009/01/volume-rendering-102-transfer-functions.html
float *gamma = new float[n + 1];
float *delta = new float[n + 1];
float *D = new float[n + 1];
// We need to solve the equation
// * taken from: http://mathworld.wolfram.com/CubicSpline.html
// [2 1 ] [D[0]] [3(v[1] - v[0]) ]
// |1 4 1 | |D[1]| |3(v[2] - v[0]) |
// | 1 4 1 | | . | = | . |
// | ..... | | . | | . |
// | 1 4 1| | . | |3(v[n] - v[n-2])|
// [ 1 2] [D[n]] [3(v[n] - v[n-1])]
// by converting the matrix to upper triangular.
// The D[i] are the derivatives at the control points.
// This builds the coefficients of the left matrix
gamma[0] = 1.0f / 2.0f;
for (uint32 i=1; i<n; i++)
gamma[i] = 1.0f / ((4 * 1.0f) - gamma[i - 1]);
gamma[n] = 1.0f / ((2 * 1.0f) - gamma[n - 1]);
delta[0] = 3 * (v[1].GetValue() - v[0].GetValue()) * gamma[0];
for (uint32 i=1; i<n; i++)
delta[i] = (3 * (v[i + 1].GetValue() - v[i - 1].GetValue()) - delta[i - 1]) * gamma[i];
delta[n] = (3 * (v[n].GetValue() - v[n - 1].GetValue()) - delta[n - 1]) * gamma[n];
D[n] = delta[n];
for (int i=n-1; i>= 0; i--)
D[i] = delta[i] - gamma[i] * D[i + 1];
// Now compute the coefficients of the cubics
cubic.Clear();
for (uint32 i=0; i<n; i++)
cubic.Add(CubicSpline(v[i].GetValue(), D[i], 3*(v[i + 1].GetValue() - v[i].GetValue()) - 2*D[i] - D[i + 1], 2*(v[i].GetValue() - v[i + 1].GetValue()) + D[i] + D[i + 1]));
delete [] gamma;
delete [] delta;
delete [] D;
}
}
示例13: Decrypt
void Crypto::Decrypt( const Array< char >& Ciphertext, const Array< char >& Key, Array< char >& OutPlaintext )
{
ARC4Initialize( Key );
uint8 Nonce = Ciphertext[ Ciphertext.Size() - 1 ];
for( uint Step = 0; Step < Nonce + FixedStep; ++Step )
{
ARC4Step();
}
OutPlaintext.Clear();
OutPlaintext.Resize( Ciphertext.Size() - Overhead );
for( uint Index = 0; Index < Ciphertext.Size() - Overhead; ++Index )
{
OutPlaintext[ Index ] = Ciphertext[ Index ] ^ ARC4Step();
}
}
示例14: Fill
void ProcessList::Fill() {
Process.Reset();
Process.AddColumn("Id", 6);
Process.AddColumn("Priority", 6);
Process.AddColumn("Program", 12);
Array<int64> pidL;
pidL.Clear();
Array<String> pNames;
if (!GetProcessList(pidL, pNames))
Process.Add("Error getting process info");
else {
for (int i = 0; i < pidL.GetCount(); ++i) {
int priority = GetProcessPriority(pidL[i]);
Process.Add(Format64(pidL[i]), priority >= 0? FormatInt(priority): "Not accesible", pNames[i]);
}
}
ButUpdate.WhenPush = THISBACK(ButUpdate_Push);
}
示例15: HandleEvents
//==============================
// VRMenuEventHandler::HandleEvents
void VRMenuEventHandler::HandleEvents( OvrGuiSys & guiSys, VrFrame const & vrFrame,
menuHandle_t const rootHandle, Array< VRMenuEvent > const & events ) const
{
VRMenuObject * root = guiSys.GetVRMenuMgr().ToObject( rootHandle );
if ( root == NULL )
{
return;
}
// find the list of all objects that are in the focused path
Array< menuHandle_t > focusPath;
FindTargetPath( guiSys, rootHandle, FocusedHandle, focusPath );
Array< menuHandle_t > targetPath;
for ( int i = 0; i < events.GetSizeI(); ++i )
{
VRMenuEvent const & event = events[i];
switch ( event.DispatchType )
{
case EVENT_DISPATCH_BROADCAST:
{
// broadcast to everything
BroadcastEvent( guiSys, vrFrame, event, root );
}
break;
case EVENT_DISPATCH_FOCUS:
// send to the focus path only -- this list should be parent -> child order
DispatchToPath( guiSys, vrFrame, event, focusPath, false );
break;
case EVENT_DISPATCH_TARGET:
if ( targetPath.GetSizeI() == 0 || event.TargetHandle != targetPath.Back() )
{
targetPath.Clear();
FindTargetPath( guiSys, rootHandle, event.TargetHandle, targetPath );
}
DispatchToPath( guiSys, vrFrame, event, targetPath, false );
break;
default:
OVR_ASSERT( !"unknown dispatch type" );
break;
}
}
}