本文整理汇总了C++中ARRAY_COUNT函数的典型用法代码示例。如果您正苦于以下问题:C++ ARRAY_COUNT函数的具体用法?C++ ARRAY_COUNT怎么用?C++ ARRAY_COUNT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ARRAY_COUNT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMonitorResolution
TArray<FString> USkeleUtilityFunctionLibrary::GetValidResolutions() {
int32 width, height;
GetMonitorResolution(width, height);
int32 widthsArray[] = {
1280,
1280,
1366,
1440,
1600,
1600,
1680,
1920,
1920,
2048,
2560,
2560,
3840,
4096
};
int32 heightsArray[] = {
800,
1024,
768,
900,
900,
1200,
1050,
1080,
1200,
1080,
1440,
1600,
2160,
2160
};
TArray<FString> resolutions;
for (int i = 0; i < ARRAY_COUNT(widthsArray); i++) {
if (widthsArray[i] <= width && heightsArray[i] <= height) {
resolutions.Add(FString::FromInt(widthsArray[i]) + "x" + FString::FromInt(heightsArray[i]));
}
}
return resolutions;
}
示例2: DrawLowerArm
void DrawLowerArm(MatrixStack &modelToCameraStack)
{
modelToCameraStack.Push();
modelToCameraStack.Translate(posLowerArm);
modelToCameraStack.RotateX(angLowerArm);
modelToCameraStack.Push();
modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, lenLowerArm / 2.0f));
modelToCameraStack.Scale(glm::vec3(widthLowerArm / 2.0f, widthLowerArm / 2.0f, lenLowerArm / 2.0f));
glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
modelToCameraStack.Pop();
DrawWrist(modelToCameraStack);
modelToCameraStack.Pop();
}
示例3: FVoiceCaptureWindowsVars
FVoiceCaptureWindowsVars() :
VoiceCaptureDev(NULL),
VoiceCaptureBuffer8(NULL),
NextCaptureOffset(0)
{
FMemory::Memzero(&VoiceCaptureDevCaps, sizeof(VoiceCaptureDevCaps));
FMemory::Memzero(&WavFormat, sizeof(WavFormat));
FMemory::Memzero(&VoiceCaptureBufferDesc, sizeof(VoiceCaptureBufferDesc));
FMemory::Memzero(&VoiceCaptureBufferCaps8, sizeof(VoiceCaptureBufferCaps8));
FMemory::Memzero(&Events, ARRAY_COUNT(Events) * sizeof(HANDLE));
for (int i = 0; i < NUM_EVENTS; i++)
{
Events[i] = INVALID_HANDLE_VALUE;
}
}
示例4:
/** Helper function to find a unit from a string (name or abbreviation) */
TOptional<EUnit> FUnitConversion::UnitFromString(const TCHAR* UnitString)
{
if (!UnitString || *UnitString == '\0')
{
return TOptional<EUnit>();
}
for (int32 Index = 0; Index < ARRAY_COUNT(ParseCandidates); ++Index)
{
if (FCString::Stricmp(UnitString, ParseCandidates[Index].String) == 0)
{
return ParseCandidates[Index].Unit;
}
}
return TOptional<EUnit>();
}
示例5: DrawWrist
void DrawWrist(MatrixStack &modelToCameraStack)
{
modelToCameraStack.Push();
modelToCameraStack.Translate(posWrist);
modelToCameraStack.RotateZ(angWristRoll);
modelToCameraStack.RotateX(angWristPitch);
modelToCameraStack.Push();
modelToCameraStack.Scale(glm::vec3(widthWrist / 2.0f, widthWrist/ 2.0f, lenWrist / 2.0f));
glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
modelToCameraStack.Pop();
DrawFingers(modelToCameraStack);
modelToCameraStack.Pop();
}
示例6: UpdateTranslucentVolumeCache
void FIndirectLightingCache::UpdateTranslucentVolumeCache(FViewInfo& View, TMap<FIntVector, FBlockUpdateInfo>& BlocksToUpdate, TArray<FIndirectLightingCacheAllocation*>& TransitionsOverTimeToUpdate)
{
extern int32 GUseIndirectLightingCacheInLightingVolume;
if (View.State && GUseIndirectLightingCacheInLightingVolume)
{
FSceneViewState* ViewState = (FSceneViewState*)View.State;
for (int32 CascadeIndex = 0; CascadeIndex < ARRAY_COUNT(ViewState->TranslucencyLightingCacheAllocations); CascadeIndex++)
{
FIndirectLightingCacheAllocation*& Allocation = ViewState->TranslucencyLightingCacheAllocations[CascadeIndex];
const FBoxSphereBounds Bounds(FBox(View.TranslucencyLightingVolumeMin[CascadeIndex], View.TranslucencyLightingVolumeMin[CascadeIndex] + View.TranslucencyLightingVolumeSize[CascadeIndex]));
UpdateCacheAllocation(Bounds, GTranslucencyLightingVolumeDim / 4, true, Allocation, BlocksToUpdate, TransitionsOverTimeToUpdate);
}
}
}
示例7: logSerialFirmwareVersion
static int
logSerialFirmwareVersion (BrailleDisplay *brl) {
unsigned char device;
for (device=0; device<ARRAY_COUNT(serialDeviceNames); ++device) {
const unsigned char code = 0X46;
unsigned char buffer[5];
if (!writeSerialPacket(brl, code, &device, 1)) return 0;
if (!nextSerialPacket(brl, code, buffer, sizeof(buffer), 1)) return 0;
logMessage(LOG_INFO, "%s Firmware Version: %c.%c.%c",
serialDeviceNames[buffer[1]],
buffer[2], buffer[3], buffer[4]);
}
return 1;
}
示例8: assert
void CSDL_Ext::alphaTransform(SDL_Surface *src)
{
assert(src->format->BitsPerPixel == 8);
SDL_Color colors[] =
{
{ 0, 0, 0, 0}, { 0, 0, 0, 32}, { 0, 0, 0, 64},
{ 0, 0, 0, 128}, { 0, 0, 0, 128}
};
for (size_t i=0; i< ARRAY_COUNT(colors); i++ )
{
SDL_Color & palColor = src->format->palette->colors[i];
palColor = colors[i];
}
SDL_SetColorKey(src, SDL_SRCCOLORKEY, 0);
}
示例9: appPrintf
void appPrintf(const char *fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
char buf[4096];
int len = vsnprintf(ARRAY_ARG(buf), fmt, argptr);
va_end(argptr);
assert(len >= 0 && len < ARRAY_COUNT(buf) - 1);
fwrite(buf, len, 1, stdout);
if (GLogFile) fwrite(buf, len, 1, GLogFile);
#if VSTUDIO_INTEGRATION
if (IsDebuggerPresent())
OutputDebugString(buf);
#endif
}
示例10: Value
//
// Get a globally unique identifier.
//
bool FParse::Value( const TCHAR* Stream, const TCHAR* Match, struct FGuid& Guid )
{
TCHAR Temp[256];
if( !FParse::Value( Stream, Match, Temp, ARRAY_COUNT(Temp) ) )
return 0;
Guid.A = Guid.B = Guid.C = Guid.D = 0;
if( FCString::Strlen(Temp)==32 )
{
TCHAR* End;
Guid.D = FCString::Strtoi( Temp+24, &End, 16 ); Temp[24]=0;
Guid.C = FCString::Strtoi( Temp+16, &End, 16 ); Temp[16]=0;
Guid.B = FCString::Strtoi( Temp+8, &End, 16 ); Temp[8 ]=0;
Guid.A = FCString::Strtoi( Temp+0, &End, 16 ); Temp[0 ]=0;
}
return 1;
}
示例11: GetD3DCompiler
HMODULE GetD3DCompiler()
{
static HMODULE ret = NULL;
if(ret != NULL)
return ret;
// dlls to try in priority order
const char *dlls[] = {
"d3dcompiler_47.dll", "d3dcompiler_46.dll", "d3dcompiler_45.dll",
"d3dcompiler_44.dll", "d3dcompiler_43.dll",
};
for(int i = 0; i < 2; i++)
{
for(int d = 0; d < ARRAY_COUNT(dlls); d++)
{
if(i == 0)
ret = GetModuleHandleA(dlls[d]);
else
ret = LoadLibraryA(dlls[d]);
if(ret != NULL)
return ret;
}
}
// all else failed, couldn't find d3dcompiler loaded,
// and couldn't even loadlibrary any version!
// we'll have to loadlibrary the version that ships with
// RenderDoc.
HMODULE hModule = NULL;
GetModuleHandleEx(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCTSTR)&dllLocator, &hModule);
wchar_t curFile[512] = {0};
GetModuleFileNameW(hModule, curFile, 511);
std::wstring path = std::wstring(curFile);
path = dirname(path);
std::wstring dll = path + L"/d3dcompiler_47.dll";
ret = LoadLibraryW(dll.c_str());
return ret;
}
示例12: CollectData
void FGameplayDebuggerCategory_Navmesh::CollectData(APlayerController* OwnerPC, AActor* DebugActor)
{
#if WITH_RECAST
ARecastNavMesh* NavData = nullptr;
APawn* PlayerPawn = OwnerPC ? OwnerPC->GetPawnOrSpectator() : nullptr;
APawn* DebugActorAsPawn = Cast<APawn>(DebugActor);
APawn* DestPawn = DebugActorAsPawn ? DebugActorAsPawn : PlayerPawn;
if (DestPawn)
{
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(OwnerPC->GetWorld());
const FNavAgentProperties& NavAgentProperties = DestPawn->GetNavAgentPropertiesRef();
NavData = Cast<ARecastNavMesh>(NavSys->GetNavDataForProps(NavAgentProperties));
}
if (NavData)
{
// add 3x3 neighborhood of target
const FVector TargetLocation = DestPawn->GetActorLocation();
TArray<int32> TileSet;
int32 TileX = 0;
int32 TileY = 0;
const int32 DeltaX[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 };
const int32 DeltaY[] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
int32 TargetTileX = 0;
int32 TargetTileY = 0;
NavData->GetNavMeshTileXY(TargetLocation, TargetTileX, TargetTileY);
for (int32 Idx = 0; Idx < ARRAY_COUNT(DeltaX); Idx++)
{
const int32 NeiX = TargetTileX + DeltaX[Idx];
const int32 NeiY = TargetTileY + DeltaY[Idx];
NavData->GetNavMeshTilesAt(NeiX, NeiY, TileSet);
}
const int32 DetailFlags =
(1 << static_cast<int32>(ENavMeshDetailFlags::PolyEdges)) |
(1 << static_cast<int32>(ENavMeshDetailFlags::FilledPolys)) |
(1 << static_cast<int32>(ENavMeshDetailFlags::NavLinks));
NavmeshRenderData.GatherData(NavData, DetailFlags, TileSet);
}
#endif // WITH_RECAST
}
示例13: UE_LOG
void FOutputDeviceMacError::HandleError()
{
// make sure we don't report errors twice
static int32 CallCount = 0;
int32 NewCallCount = FPlatformAtomics::InterlockedIncrement(&CallCount);
if (NewCallCount != 1)
{
UE_LOG(LogMac, Error, TEXT("HandleError re-entered.") );
return;
}
// Trigger the OnSystemFailure hook if it exists
FCoreDelegates::OnHandleSystemError.Broadcast();
try
{
GIsGuarded = 0;
GIsRunning = 0;
GIsCriticalError = 1;
GLogConsole = NULL;
GErrorHist[ARRAY_COUNT(GErrorHist)-1]=0;
// Dump the error and flush the log.
UE_LOG(LogMac, Log, TEXT("=== Critical error: ===") LINE_TERMINATOR TEXT("%s") LINE_TERMINATOR, GErrorExceptionDescription);
UE_LOG(LogMac, Log, GErrorHist);
GLog->Flush();
// Unhide the mouse.
while (!CGCursorIsVisible())
{
CGDisplayShowCursor(kCGDirectMainDisplay);
}
// Release capture and allow mouse to freely roam around.
CGAssociateMouseAndMouseCursorPosition(true);
FPlatformMisc::ClipboardCopy(GErrorHist);
FPlatformMisc::SubmitErrorReport( GErrorHist, EErrorReportMode::Interactive );
FCoreDelegates::OnShutdownAfterError.Broadcast();
}
catch( ... )
{}
}
示例14: logSerialSerialNumber
static int
logSerialSerialNumber (BrailleDisplay *brl) {
unsigned char device;
for (device=0; device<ARRAY_COUNT(serialDeviceNames); ++device) {
const unsigned char code = 0X53;
unsigned char buffer[10];
if (!writeSerialPacket(brl, code, &device, 1)) return 0;
if (!nextSerialPacket(brl, code, buffer, sizeof(buffer), 1)) return 0;
logMessage(LOG_INFO, "%s Serial Number: %02X%02X%02X%02X%02X%02X%02X%02X",
serialDeviceNames[buffer[1]],
buffer[2], buffer[3], buffer[4], buffer[5],
buffer[6], buffer[7], buffer[8], buffer[9]);
}
return 1;
}
示例15: ARRAY_COUNT
StreamBase & GameStatic::operator<< (StreamBase & msg, const Data & obj)
{
msg <<
whirlpool_lost_percent <<
kingdom_max_heroes <<
castle_grown_well <<
castle_grown_wel2 <<
castle_grown_week_of <<
castle_grown_month_of <<
heroes_spell_points_day <<
gameover_lost_days <<
spell_dd_distance <<
spell_dd_sp <<
spell_dd_hp;
u8 array_size = ARRAY_COUNT(overview_distance);
msg << array_size;
for(u32 ii = 0; ii < array_size; ++ii)
msg << overview_distance[ii];
array_size = ARRAY_COUNT(kingdom_starting_resource);
msg << array_size;
for(u32 ii = 0; ii < array_size; ++ii)
msg << kingdom_starting_resource[ii];
array_size = ARRAY_COUNT(mageguild_restore_spell_points_day);
msg << array_size;
for(u32 ii = 0; ii < array_size; ++ii)
msg << mageguild_restore_spell_points_day[ii];
array_size = ARRAY_COUNT(objects_mod);
msg << array_size;
for(u32 ii = 0; ii < array_size; ++ii)
msg << objects_mod[ii];
msg << monster_upgrade_ratio << uniq;
// skill statics
array_size = ARRAY_COUNT(Skill::_stats);
msg << array_size;
for(u32 ii = 0; ii < array_size; ++ii)
msg << Skill::_stats[ii];
array_size = ARRAY_COUNT(Skill::_values);
msg << array_size;
for(u32 ii = 0; ii < array_size; ++ii)
msg << Skill::_values[ii];
msg << Skill::_from_witchs_hut;
return msg;
}