本文整理汇总了C++中UGameViewportClient::SetReferenceToWorldContext方法的典型用法代码示例。如果您正苦于以下问题:C++ UGameViewportClient::SetReferenceToWorldContext方法的具体用法?C++ UGameViewportClient::SetReferenceToWorldContext怎么用?C++ UGameViewportClient::SetReferenceToWorldContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UGameViewportClient
的用法示例。
在下文中一共展示了UGameViewportClient::SetReferenceToWorldContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void UGameEngine::Init(IEngineLoop* InEngineLoop)
{
DECLARE_SCOPE_CYCLE_COUNTER(TEXT("UGameEngine Init"), STAT_GameEngineStartup, STATGROUP_LoadTime);
// Call base.
UEngine::Init(InEngineLoop);
#if USE_NETWORK_PROFILER
FString NetworkProfilerTag;
if( FParse::Value(FCommandLine::Get(), TEXT("NETWORKPROFILER="), NetworkProfilerTag ) )
{
GNetworkProfiler.EnableTracking(true);
}
#endif
// Load and apply user game settings
GetGameUserSettings()->LoadSettings();
GetGameUserSettings()->ApplySettings();
// Creates the initial world context. For GameEngine, this should be the only WorldContext that ever gets created.
FWorldContext &InitialWorldContext = CreateNewWorldContext(EWorldType::Game);
// Initialize the viewport client.
UGameViewportClient* ViewportClient = NULL;
if(GIsClient)
{
ViewportClient = ConstructObject<UGameViewportClient>(GameViewportClientClass,this);
ViewportClient->SetReferenceToWorldContext(InitialWorldContext);
GameViewport = ViewportClient;
InitialWorldContext.GameViewport = ViewportClient;
}
bCheckForMovieCapture = true;
// Attach the viewport client to a new viewport.
if(ViewportClient)
{
// This must be created before any gameplay code adds widgets
bool bWindowAlreadyExists = GameViewportWindow.IsValid();
if (!bWindowAlreadyExists)
{
GameViewportWindow = CreateGameWindow();
}
CreateGameViewport( ViewportClient );
if( !bWindowAlreadyExists )
{
SwitchGameWindowToUseGameViewport();
}
FString Error;
if(!ViewportClient->Init(Error))
{
UE_LOG(LogEngine, Fatal,TEXT("%s"),*Error);
}
}
// Create default URL.
// @note: if we change how we determine the valid start up map update LaunchEngineLoop's GetStartupMap()
FURL DefaultURL;
DefaultURL.LoadURLConfig( TEXT("DefaultPlayer"), GGameIni );
// Enter initial world.
EBrowseReturnVal::Type BrowseRet = EBrowseReturnVal::Failure;
FString Error;
TCHAR Parm[4096]=TEXT("");
const TCHAR* Tmp = FCommandLine::Get();
#if UE_BUILD_SHIPPING
// In shipping don't allow an override
Tmp = TEXT("");
#endif // UE_BUILD_SHIPPING
const UGameMapsSettings* GameMapsSettings = GetDefault<UGameMapsSettings>();
const FString& DefaultMap = GameMapsSettings->GetGameDefaultMap();
if (!FParse::Token(Tmp, Parm, ARRAY_COUNT(Parm), 0) || Parm[0] == '-')
{
FCString::Strcpy(Parm, *(DefaultMap + GameMapsSettings->LocalMapOptions));
}
FURL URL( &DefaultURL, Parm, TRAVEL_Partial );
if( URL.Valid )
{
BrowseRet = Browse(InitialWorldContext, URL, Error );
}
// If waiting for a network connection, go into the starting level.
if (BrowseRet != EBrowseReturnVal::Success && FCString::Stricmp(Parm, *DefaultMap) != 0)
{
const FText Message = FText::Format( NSLOCTEXT("Engine", "MapNotFound", "The map specified on the commandline '{0}' could not be found. Would you like to load the default map instead?"), FText::FromString( URL.Map ) );
// the map specified on the command-line couldn't be loaded. ask the user if we should load the default map instead
if ( FCString::Stricmp(*URL.Map, *DefaultMap) != 0 &&
FMessageDialog::Open( EAppMsgType::OkCancel, Message ) != EAppReturnType::Ok)
{
// user canceled (maybe a typo while attempting to run a commandlet)
FPlatformMisc::RequestExit( false );
return;
}
else
{
//.........这里部分代码省略.........