这篇教程C++ ARRAY_COUNT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ARRAY_COUNT函数的典型用法代码示例。如果您正苦于以下问题:C++ ARRAY_COUNT函数的具体用法?C++ ARRAY_COUNT怎么用?C++ ARRAY_COUNT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ARRAY_COUNT函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetMonitorResolutionTArray<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;}
开发者ID:skeletoncrew,项目名称:skeletonwarsem2,代码行数:46,
示例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(); }
开发者ID:Nuclearfossil,项目名称:ducking-octo-dangerzone,代码行数:17,
示例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; } }
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:17,
示例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>();}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:18,
示例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(); }
开发者ID:Nuclearfossil,项目名称:ducking-octo-dangerzone,代码行数:17,
示例6: UpdateTranslucentVolumeCachevoid 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); } }}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:17,
示例7: logSerialFirmwareVersionstatic intlogSerialFirmwareVersion (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;}
开发者ID:mlang,项目名称:brltty,代码行数:17,
示例8: assertvoid 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);}
开发者ID:vilkov,项目名称:vcmi,代码行数:17,
示例9: appPrintfvoid 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}
开发者ID:hui211314dd,项目名称:UModel,代码行数:17,
示例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;}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:20,
示例11: GetD3DCompilerHMODULE 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;}
开发者ID:DrChat,项目名称:renderdoc,代码行数:46,
示例12: CollectDatavoid 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}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:45,
示例13: UE_LOGvoid 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( ... ) {}}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:45,
示例14: logSerialSerialNumberstatic intlogSerialSerialNumber (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;}
开发者ID:mlang,项目名称:brltty,代码行数:18,
示例15: ARRAY_COUNTStreamBase & 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;}
开发者ID:gerstrong,项目名称:fheroes2plus,代码行数:52,
示例16: whilevoid FArchiveFileWriterWindows::Serialize( void* V, INT Length ){ Pos += Length; INT Copy; while( Length > (Copy=ARRAY_COUNT(Buffer)-BufferCount) ) { appMemcpy( Buffer+BufferCount, V, Copy ); BufferCount += Copy; Length -= Copy; V = (BYTE*)V + Copy; Flush(); } if( Length ) { appMemcpy( Buffer+BufferCount, V, Length ); BufferCount += Length; }}
开发者ID:LiuKeHua,项目名称:colorful-engine,代码行数:18,
示例17: getBaseCharacterwchar_tgetBaseCharacter (wchar_t character) {#ifdef HAVE_ICU UChar source[] = {character}; const unsigned int resultLength = 0X10; UChar resultBuffer[resultLength]; UErrorCode error = U_ZERO_ERROR; unorm_normalize(source, ARRAY_COUNT(source), UNORM_NFD, 0, resultBuffer, resultLength, &error); if (U_SUCCESS(error)) return resultBuffer[0];#endif /* HAVE_ICU */ return 0;}
开发者ID:BaJIeK,项目名称:brltty,代码行数:18,
示例18: DrawUpperArm void DrawUpperArm(MatrixStack &modelToCameraStack) { modelToCameraStack.Push(); modelToCameraStack.RotateX(angUpperArm); { modelToCameraStack.Push(); modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, (sizeUpperArm / 2.0f) - 1.0f)); modelToCameraStack.Scale(glm::vec3(1.0f, 1.0f, sizeUpperArm / 2.0f)); glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top())); glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0); modelToCameraStack.Pop(); } DrawLowerArm(modelToCameraStack); modelToCameraStack.Pop(); }
开发者ID:captainadamo,项目名称:glfw_gltut,代码行数:18,
示例19: FilterMcppError/** * Filter MCPP errors. * @param ErrorMsg - The error message. * @returns true if the message is valid and has not been filtered out. */static bool FilterMcppError(const FString& ErrorMsg){ const TCHAR* SubstringsToFilter[] = { TEXT("with no newline, supplemented newline"), TEXT("Converted [CR+LF] to [LF]") }; const int32 FilteredSubstringCount = ARRAY_COUNT(SubstringsToFilter); for (int32 SubstringIndex = 0; SubstringIndex < FilteredSubstringCount; ++SubstringIndex) { if (ErrorMsg.Contains(SubstringsToFilter[SubstringIndex])) { return false; } } return true;}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:23,
示例20: ANSI_TO_TCHARvoid FLinuxCrashContext::CaptureStackTrace(){ // Only do work the first time this function is called - this is mainly a carry over from Windows where it can be called multiple times, left intact for extra safety. if (!bCapturedBacktrace) { const SIZE_T StackTraceSize = 65535; ANSICHAR* StackTrace = (ANSICHAR*) FMemory::Malloc( StackTraceSize ); StackTrace[0] = 0; // Walk the stack and dump it to the allocated memory (ignore first 2 callstack lines as those are in stack walking code) FPlatformStackWalk::StackWalkAndDump( StackTrace, StackTraceSize, 2, this); FCString::Strncat( GErrorHist, ANSI_TO_TCHAR(StackTrace), ARRAY_COUNT(GErrorHist) - 1 ); CreateExceptionInfoString(Signal, Info); FMemory::Free( StackTrace ); bCapturedBacktrace = true; }}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:18,
示例21: SERIALISE_ELEMENT_PTRbool WrappedID3D12Device::Serialise_CreateGraphicsPipelineState( const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, REFIID riid, void **ppPipelineState){ SERIALISE_ELEMENT_PTR(D3D12_GRAPHICS_PIPELINE_STATE_DESC, Descriptor, pDesc); SERIALISE_ELEMENT(IID, guid, riid); SERIALISE_ELEMENT(ResourceId, Pipe, ((WrappedID3D12PipelineState *)*ppPipelineState)->GetResourceID()); if(m_State == READING) { ID3D12PipelineState *ret = NULL; HRESULT hr = m_pDevice->CreateGraphicsPipelineState(&Descriptor, guid, (void **)&ret); if(FAILED(hr)) { RDCERR("Failed on resource serialise-creation, HRESULT: 0x%08x", hr); } else { ret = new WrappedID3D12PipelineState(ret, this); WrappedID3D12PipelineState *wrapped = (WrappedID3D12PipelineState *)ret; wrapped->graphics = new D3D12_GRAPHICS_PIPELINE_STATE_DESC(Descriptor); D3D12_SHADER_BYTECODE *shaders[] = { &wrapped->graphics->VS, &wrapped->graphics->HS, &wrapped->graphics->DS, &wrapped->graphics->GS, &wrapped->graphics->PS, }; for(size_t i = 0; i < ARRAY_COUNT(shaders); i++) { if(shaders[i]->BytecodeLength == 0) shaders[i]->pShaderBytecode = NULL; else shaders[i]->pShaderBytecode = WrappedID3D12PipelineState::AddShader(*shaders[i], this); } GetResourceManager()->AddLiveResource(Pipe, ret); } } return true;}
开发者ID:Anteru,项目名称:renderdoc,代码行数:44,
示例22: UE_LOGvoid FOutputDeviceLinuxError::HandleError(){ // make sure we don't report errors twice static int32 CallCount = 0; int32 NewCallCount = FPlatformAtomics::InterlockedIncrement(&CallCount); if (NewCallCount != 1) { UE_LOG(LogLinux, Error, TEXT("HandleError re-entered.") ); return; } // Trigger the OnSystemFailure hook if it exists FCoreDelegates::OnHandleSystemError.Broadcast();#if !PLATFORM_EXCEPTIONS_DISABLED try {#endif // !PLATFORM_EXCEPTIONS_DISABLED GIsGuarded = 0; GIsRunning = 0; GIsCriticalError = 1; GLogConsole = NULL; GErrorHist[ARRAY_COUNT(GErrorHist)-1] = 0; // Dump the error and flush the log. UE_LOG(LogLinux, Log, TEXT("=== Critical error: ===") LINE_TERMINATOR TEXT("%s") LINE_TERMINATOR, GErrorExceptionDescription); UE_LOG(LogLinux, Log, GErrorHist); GLog->Flush(); // do not copy if graphics have not been initialized or if we're on the wrong thread if (FApp::CanEverRender() && IsInGameThread()) { FPlatformMisc::ClipboardCopy(GErrorHist); } FPlatformMisc::SubmitErrorReport(GErrorHist, EErrorReportMode::Interactive); FCoreDelegates::OnShutdownAfterError.Broadcast();#if !PLATFORM_EXCEPTIONS_DISABLED } catch(...) {}#endif // !PLATFORM_EXCEPTIONS_DISABLED}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:44,
示例23: GetReplayAppFilenamestring GetReplayAppFilename(){ // look up the shared object's path via dladdr Dl_info info; dladdr((void *)&soLocator, &info); string path = info.dli_fname ? info.dli_fname : ""; path = dirname(path); string replay = path + "/qrenderdoc"; FILE *f = FileIO::fopen(replay.c_str(), "r"); if(f) { FileIO::fclose(f); return replay; } // if it's not in the same directory, try in a sibling /bin // e.g. /foo/bar/lib/librenderdoc.so -> /foo/bar/bin/qrenderdoc replay = path + "/../bin/qrenderdoc"; f = FileIO::fopen(replay.c_str(), "r"); if(f) { FileIO::fclose(f); return replay; } // random guesses! const char *guess[] = {"/opt/renderdoc/qrenderdoc", "/opt/renderdoc/bin/qrenderdoc", "/usr/local/bin/qrenderdoc", "/usr/bin/qrenderdoc"}; for(size_t i = 0; i < ARRAY_COUNT(guess); i++) { f = FileIO::fopen(guess[i], "r"); if(f) { FileIO::fclose(f); return guess[i]; } } // out of ideas return "";}
开发者ID:JasonWinston,项目名称:renderdoc,代码行数:44,
示例24: findKeyboardDevicestatic char *findKeyboardDevice (const char *deviceName) { char *devicePath = NULL; const char *directoryComponents[] = { "/sys/devices/platform/", deviceName, "/input" }; char *directoryPath = joinStrings(directoryComponents, ARRAY_COUNT(directoryComponents)); if (directoryPath) { DIR *directory = opendir(directoryPath); if (directory) { const char *filePrefix = "input"; size_t filePrefixLength = strlen(filePrefix); struct dirent *entry; while ((entry = readdir(directory))) { if (strncmp(entry->d_name, filePrefix, filePrefixLength) == 0) { int eventNumber; if (isInteger(&eventNumber, &entry->d_name[filePrefixLength])) { char path[0X80]; snprintf(path, sizeof(path), "/dev/input/event%d", eventNumber); if (!(devicePath = strdup(path))) logMallocError(); break; } } } closedir(directory); } else { logMessage(LOG_DEBUG, "keyboard directory open error: %s: %s", directoryPath, strerror(errno)); } free(directoryPath); } return devicePath;}
开发者ID:plundblad,项目名称:brltty,代码行数:44,
示例25: MakeShareable/** * Give the async task a chance to marshal its data back to the game thread * Can only be called on the game thread by the async task manager */void FOnlineAsyncEventSteamInviteAccepted::Finalize(){ FOnlineSessionSteamPtr SessionInt = StaticCastSharedPtr<FOnlineSessionSteam>(Subsystem->GetSessionInterface()); if (SessionInt.IsValid() && !SessionInt->CurrentSessionSearch.IsValid()) { // Create a search settings object TSharedRef<FOnlineSessionSearch> SearchSettings = MakeShareable(new FOnlineSessionSearch()); SessionInt->CurrentSessionSearch = SearchSettings; SessionInt->CurrentSessionSearch->SearchState = EOnlineAsyncTaskState::InProgress; TCHAR ParsedURL[1024]; if (!FParse::Value(*ConnectionURL, TEXT("SteamConnectIP="), ParsedURL, ARRAY_COUNT(ParsedURL))) { UE_LOG_ONLINE(Warning, TEXT("FOnlineAsyncEventSteamInviteAccepted: Failed to parse connection URL")); return; } // Determine the port int32 Port = 0; TCHAR* PortToken = FCString::Strchr(ParsedURL, ':'); if (PortToken) { Port = FCString::Atoi(PortToken+1); PortToken[0] = '/0'; } Port = (Port > 0) ? Port : Subsystem->GetGameServerGamePort(); // Parse the address bool bIsValid; TSharedRef<FInternetAddr> IpAddr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr(); IpAddr->SetIp(ParsedURL, bIsValid); if (bIsValid) { SessionInt->CurrentSessionSearch->QuerySettings.Set(FName(SEARCH_STEAM_HOSTIP), IpAddr->ToString(false), EOnlineComparisonOp::Equals); FOnlineAsyncTaskSteamFindServer* NewTask = new FOnlineAsyncTaskSteamFindServer(Subsystem, SearchSettings, LocalUserNum, SessionInt->OnSessionUserInviteAcceptedDelegates); Subsystem->QueueAsyncTask(NewTask); } } else { UE_LOG_ONLINE(Warning, TEXT("Invalid session or search already in progress when accepting invite. Ignoring invite request.")); }}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:48,
示例26: RDCEraseElbool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *ret){ if(ret == NULL || tex == ResourceId()) return false; RDCEraseEl(ret->value_f); bool decodeRamp = false; if(customShader && m_RenderData.texDisplay.CustomShader != ResourceId() && m_CustomShaderResourceId != ResourceId()) { tex = m_CustomShaderResourceId; } if((m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawDraw || m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawPass) && m_OverlayResourceId != ResourceId()) { decodeRamp = true; tex = m_OverlayResourceId; } m_pDevice->PickPixel(m_pDevice->GetLiveID(tex), x, y, sliceFace, mip, sample, ret->value_f); if(decodeRamp) { for(size_t c = 0; c < ARRAY_COUNT(overdrawRamp); c++) { if(fabs(ret->value_f[0] - overdrawRamp[c].x) < 0.00005f && fabs(ret->value_f[1] - overdrawRamp[c].y) < 0.00005f && fabs(ret->value_f[2] - overdrawRamp[c].z) < 0.00005f) { ret->value_i[0] = (int32_t)c; ret->value_i[1] = 0; ret->value_i[2] = 0; ret->value_i[3] = 0; break; } } } return true;}
开发者ID:EecheE,项目名称:renderdoc,代码行数:44,
示例27: PrintGameListvoid PrintGameList(bool tags){ const char *oldTitle = NULL; int pos = 0;#define LINEFEED 80 int Count = ARRAY_COUNT(GListOfGames) - 1; // exclude TABLE_END marker bool out = false; for (int i = 0; i < Count; i++) { const GameInfo &info = GListOfGames[i]; if (tags && !info.Switch) continue; // engine title const char *title = GetEngineName(info.Enum); if (title != oldTitle) { appPrintf("%s%s:", out ? "/n/n" : "", title); pos = LINEFEED; } oldTitle = title; out = true; // game info if (tags) { appPrintf("/n %8s %s", info.Switch ? info.Switch : "", info.Name); continue; } // simple game list if (!(info.Enum & ~GAME_ENGINE) && info.Switch) continue; // skip simple GAME_UEn const char *name = info.Name; int len = strlen(name); bool needComma = (i < Count - 1) && (GetEngineName(GListOfGames[i+1].Enum) == title); if (needComma) len += 2; if (pos >= LINEFEED - len) { appPrintf("/n "); pos = 2; } appPrintf("%s%s", name, needComma ? ", " : ""); pos += len; } appPrintf("/n");}
开发者ID:omegaluo,项目名称:UModel,代码行数:43,
示例28: usbGetFileSystemstatic char *usbGetFileSystem (const char *type, const FileSystemCandidate *candidates, MountPointTester test, FileSystemVerifier verify) { if (candidates) { const FileSystemCandidate *candidate = candidates; while (candidate->path) { logMessage(LOG_DEBUG, "verifying file system path: %s: %s", type, candidate->path); if (candidate->verify(candidate->path)) { char *path = strdup(candidate->path); if (path) return path; logMallocError(); } candidate += 1; } } if (test) { char *path = findMountPoint(test); if (path) return path; } if (verify) { char *directory = makeWritablePath(type); if (directory) { if (ensureDirectory(directory)) { if (verify(directory)) return directory; { const char *strings[] = {PACKAGE_NAME, "-", type}; char *name = joinStrings(strings, ARRAY_COUNT(strings)); if (makeMountPoint(directory, name, type)) return directory; } } free(directory); } } return NULL;}
开发者ID:junwuwei,项目名称:brailleback,代码行数:43,
注:本文中的ARRAY_COUNT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ARRAY_INIT函数代码示例 C++ ARRAY_CARDINALITY函数代码示例 |