本文整理汇总了C++中TSharedRef::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::Get方法的具体用法?C++ TSharedRef::Get怎么用?C++ TSharedRef::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedRef
的用法示例。
在下文中一共展示了TSharedRef::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnWindowDestroyed
/** Called when a window is destroyed to give the renderer a chance to free resources */
void FSlateOpenGLRenderer::OnWindowDestroyed( const TSharedRef<SWindow>& InWindow )
{
FSlateOpenGLViewport* Viewport = WindowToViewportMap.Find( &InWindow.Get() );
if( Viewport )
{
Viewport->Destroy();
}
WindowToViewportMap.Remove( &InWindow.Get() );
}
示例2: CreateViewport
void FSlateOpenGLRenderer::CreateViewport( const TSharedRef<SWindow> InWindow )
{
#if UE_BUILD_DEBUG
// Ensure a viewport for this window doesnt already exist
FSlateOpenGLViewport* Viewport = WindowToViewportMap.Find( &InWindow.Get() );
check(!Viewport);
#endif
FSlateOpenGLViewport& NewViewport = WindowToViewportMap.Add( &InWindow.Get(), FSlateOpenGLViewport() );
NewViewport.Initialize( InWindow, SharedContext );
}
示例3: ActivateContext
void FWindowsTextInputMethodSystem::ActivateContext(const TSharedRef<ITextInputMethodContext>& Context)
{
UE_LOG(LogWindowsTextInputMethodSystem, Verbose, TEXT("Activating context %p..."), &(Context.Get()));
HRESULT Result;
// General Implementation
ActiveContext = Context;
check(ContextToInternalContextMap.Contains(Context));
FInternalContext& InternalContext = ContextToInternalContextMap[Context];
const TSharedPtr<FGenericWindow> GenericWindow = Context->GetWindow();
InternalContext.WindowHandle = GenericWindow.IsValid() ? reinterpret_cast<HWND>(GenericWindow->GetOSWindowHandle()) : nullptr;
// IMM Implementation
InternalContext.IMMContext.IsComposing = false;
InternalContext.IMMContext.IsDeactivating = false;
::ImmAssociateContext(InternalContext.WindowHandle, IMMContextId);
// TSF Implementation
TComPtr<FTextStoreACP>& TextStore = InternalContext.TSFContext;
ITfDocumentMgr* Unused;
Result = TSFThreadManager->AssociateFocus(InternalContext.WindowHandle, TextStore->TSFDocumentManager, &Unused);
if(FAILED(Result))
{
UE_LOG(LogWindowsTextInputMethodSystem, Error, TEXT("Activating a context failed while setting focus on a TSF document manager."));
}
UE_LOG(LogWindowsTextInputMethodSystem, Verbose, TEXT("Activated context %p!"), &(Context.Get()));
}
示例4: FSlateImageBrush
/**
参考 FCoreStyle::Create()
*/
TSharedRef<class FSlateStyleSet> FHUDStyle::Create()
{
TSharedRef<FSlateStyleSet> StyleRef = FSlateGameResources::New(FHUDStyle::GetStyleSetName(), "/Game/Slate", "/Game/Slate");
auto& Style = StyleRef.Get();
/**
FSlateStyleSet::Set("XXX", スタイル) は第二引数に様々なスタイル(ブラシも可)を取るオーバーロードを持つ
ここでスタイル(ブラシ)を登録しておく
Style.Set("XXX", FSlateImageBrush(FPaths::GameContentDir() / TEXT("YYY.png"), FVector2D(32, 32)));
Style.Set("XXX", FSlateBoxBrush(FPaths::GameContentDir() / TEXT("YYY.png"), FMargin(3.0f / 8.0f)));
Style.Set("XXX", FSlateBoxBrush(FPaths::GameContentDir() / TEXT("YYY.png"), FMargin(3.0f / 8.0f)));
Style.Set("XXX", FTextBlockStyle()
.SetFont(FSlateFontInfo(FPaths::GameContentDir() / TEXT("YYY.ttf"), 14))
.SetColorAndOpacity(FLinearColor::White)
.SetShadowOffset(FIntPoint(-1, 1))
);
Style.Set("XXX", FTextBlockStyle()
.SetFont(FSlateFontInfo(FPaths::GameContentDir() / TEXT("YYY.otf"), 14))
.SetColorAndOpacity(FLinearColor::White)
.SetShadowOffset(FIntPoint(-1, 1))
);
*/
//!< https://wiki.unrealengine.com/First_Person_Shooter_C%2B%2B_Tutorial からクロスヘア画像を持ってきた
Style.Set("Crosshair", new FSlateImageBrush(FPaths::GameContentDir() / TEXT("Crosshair_fps_tutorial") / TEXT("crosshair") + TEXT(".TGA"), FVector2D(16, 16)));
//!< UnrealEngine\Engine\Content\Slate\Testing\UE4Icon.png をコピーしてきた
Style.Set("UE4Icon", new FSlateImageBrush(FPaths::GameContentDir() / TEXT("Slate") / TEXT("UE4Icon") + TEXT(".png"), FVector2D(50, 50)));
return StyleRef;
}
示例5:
TSharedRef<FSlateStyleSet> FARUIStyle::Create()
{
TSharedRef<FSlateStyleSet> StyleRef = FSlateGameResources::New(FARUIStyle::GetStyleName(), "/Game/UI/Styles", "/Game/UI/Styles");
FSlateStyleSet& Set = StyleRef.Get();
return StyleRef;
}
示例6: DroppedOnAction
FReply FKismetVariableDragDropAction::DroppedOnAction(TSharedRef<FEdGraphSchemaAction> Action)
{
if(Action->GetTypeId() == FEdGraphSchemaAction_K2Var::StaticGetTypeId())
{
FEdGraphSchemaAction_K2Var* VarAction = (FEdGraphSchemaAction_K2Var*)&Action.Get();
// Only let you drag and drop if variables are from same BP class, and not onto itself
UBlueprint* BP = UBlueprint::GetBlueprintFromClass(Cast<UClass>(VariableSource.Get()));
FName TargetVarName = VarAction->GetVariableName();
if( (BP != NULL) &&
(VariableName != TargetVarName) &&
(VariableSource == VarAction->GetVariableClass()) )
{
bool bMoved = FBlueprintEditorUtils::MoveVariableBeforeVariable(BP, VariableName, TargetVarName, true);
// If we moved successfully
if(bMoved)
{
// Change category of var to match the one we dragged on to as well
FText MovedVarCategory = FBlueprintEditorUtils::GetBlueprintVariableCategory(BP, VariableName, GetLocalVariableScope());
FText TargetVarCategory = FBlueprintEditorUtils::GetBlueprintVariableCategory(BP, TargetVarName, GetLocalVariableScope());
if(!MovedVarCategory.EqualTo(TargetVarCategory))
{
FBlueprintEditorUtils::SetBlueprintVariableCategory(BP, VariableName, GetLocalVariableScope(), TargetVarCategory, true);
}
// Update Blueprint after changes so they reflect in My Blueprint tab.
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(BP);
}
}
return FReply::Handled();
}
return FReply::Unhandled();
}
示例7: IsViewportFullscreen
void FSlateD3DRenderer::Private_CreateViewport( TSharedRef<SWindow> InWindow, const FVector2D &WindowSize )
{
TSharedRef< FGenericWindow > NativeWindow = InWindow->GetNativeWindow().ToSharedRef();
bool bFullscreen = IsViewportFullscreen( *InWindow );
bool bWindowed = true;//@todo implement fullscreen: !bFullscreen;
DXGI_SWAP_CHAIN_DESC SwapChainDesc;
FMemory::Memzero(&SwapChainDesc, sizeof(SwapChainDesc) );
SwapChainDesc.BufferCount = 1;
SwapChainDesc.BufferDesc.Width = FMath::TruncToInt(WindowSize.X);
SwapChainDesc.BufferDesc.Height = FMath::TruncToInt(WindowSize.Y);
SwapChainDesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
SwapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
SwapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
SwapChainDesc.OutputWindow = (HWND)NativeWindow->GetOSWindowHandle();
SwapChainDesc.SampleDesc.Count = 1;
SwapChainDesc.SampleDesc.Quality = 0;
SwapChainDesc.Windowed = bWindowed;
SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
SwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
TRefCountPtr<IDXGIDevice> DXGIDevice;
HRESULT Hr = GD3DDevice->QueryInterface( __uuidof(IDXGIDevice), (void**)DXGIDevice.GetInitReference() );
check( SUCCEEDED(Hr) );
TRefCountPtr<IDXGIAdapter> DXGIAdapter;
Hr = DXGIDevice->GetParent(__uuidof(IDXGIAdapter), (void **)DXGIAdapter.GetInitReference() );
check( SUCCEEDED(Hr) );
TRefCountPtr<IDXGIFactory> DXGIFactory;
DXGIAdapter->GetParent(__uuidof(IDXGIFactory), (void **)DXGIFactory.GetInitReference() );
check( SUCCEEDED(Hr) );
FSlateD3DViewport Viewport;
Hr = DXGIFactory->CreateSwapChain(DXGIDevice.GetReference(), &SwapChainDesc, Viewport.D3DSwapChain.GetInitReference() );
check( SUCCEEDED(Hr) );
Hr = DXGIFactory->MakeWindowAssociation((HWND)NativeWindow->GetOSWindowHandle(),DXGI_MWA_NO_ALT_ENTER);
check(SUCCEEDED(Hr));
uint32 Width = FMath::TruncToInt(WindowSize.X);
uint32 Height = FMath::TruncToInt(WindowSize.Y);
Viewport.ViewportInfo.MaxDepth = 1.0f;
Viewport.ViewportInfo.MinDepth = 0.0f;
Viewport.ViewportInfo.Width = Width;
Viewport.ViewportInfo.Height = Height;
Viewport.ViewportInfo.TopLeftX = 0;
Viewport.ViewportInfo.TopLeftY = 0;
CreateBackBufferResources( Viewport.D3DSwapChain, Viewport.BackBufferTexture, Viewport.RenderTargetView );
Viewport.ProjectionMatrix = CreateProjectionMatrixD3D( Width, Height );
WindowToViewportMap.Add( &InWindow.Get(), Viewport );
}
示例8: SUCCEEDED
void FSlateD3DRenderer::Private_ResizeViewport( const TSharedRef<SWindow> InWindow, uint32 Width, uint32 Height, bool bFullscreen )
{
FSlateD3DViewport* Viewport = WindowToViewportMap.Find( &InWindow.Get() );
if( Viewport && ( Width != Viewport->ViewportInfo.Width || Height != Viewport->ViewportInfo.Height || bFullscreen != Viewport->bFullscreen ) )
{
GD3DDeviceContext->OMSetRenderTargets(0,NULL,NULL);
Viewport->BackBufferTexture.SafeRelease();
Viewport->RenderTargetView.SafeRelease();
Viewport->DepthStencilView.SafeRelease();
Viewport->ViewportInfo.Width = Width;
Viewport->ViewportInfo.Height = Height;
Viewport->bFullscreen = bFullscreen;
Viewport->ProjectionMatrix = CreateProjectionMatrixD3D( Width, Height );
DXGI_SWAP_CHAIN_DESC Desc;
Viewport->D3DSwapChain->GetDesc( &Desc );
HRESULT Hr = Viewport->D3DSwapChain->ResizeBuffers( Desc.BufferCount, Viewport->ViewportInfo.Width, Viewport->ViewportInfo.Height, Desc.BufferDesc.Format, Desc.Flags );
check( SUCCEEDED(Hr) );
CreateBackBufferResources( Viewport->D3DSwapChain, Viewport->BackBufferTexture,Viewport->RenderTargetView );
}
}
示例9: CopyInterpLinearColorTrack
void CopyInterpLinearColorTrack(TSharedRef<ISequencer> Sequencer, UInterpTrackLinearColorProp* LinearColorPropTrack, UMovieSceneColorTrack* ColorTrack)
{
if (FMatineeImportTools::CopyInterpLinearColorTrack(LinearColorPropTrack, ColorTrack))
{
Sequencer.Get().NotifyMovieSceneDataChanged( EMovieSceneDataChangeType::MovieSceneStructureItemAdded );
}
}
示例10: MakeShareable
TSharedRef< FSlateStyleSet > FCrashReportClientStyle::Create()
{
TSharedRef<FSlateStyleSet> StyleRef = MakeShareable(new FSlateStyleSet("CrashReportClientStyle"));
FSlateStyleSet& Style = StyleRef.Get();
const FTextBlockStyle DefaultText = FTextBlockStyle()
.SetFont(TTF_FONT("Fonts/Roboto-Black", 10))
.SetColorAndOpacity(FSlateColor::UseForeground())
.SetShadowOffset(FVector2D::ZeroVector)
.SetShadowColorAndOpacity(FLinearColor::Black);
// Set the client app styles
Style.Set(TEXT("Code"), FTextBlockStyle(DefaultText)
.SetFont(TTF_FONT("Fonts/DroidSansMono", 8))
.SetColorAndOpacity(FSlateColor(FLinearColor::White * 0.8f))
);
Style.Set(TEXT("Title"), FTextBlockStyle(DefaultText)
.SetFont(TTF_FONT("Fonts/Roboto-Bold", 12))
);
Style.Set(TEXT("Status"), FTextBlockStyle(DefaultText)
.SetColorAndOpacity(FSlateColor::UseSubduedForeground())
);
return StyleRef;
}
示例11: SavePluginDescriptor
bool FPluginHelpers::SavePluginDescriptor(const FString& NewProjectFilename, const FPluginDescriptor& PluginDescriptor)
{
FString Text;
TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&Text);
Writer->WriteObjectStart();
// Write all the simple fields
Writer->WriteValue(TEXT("FileVersion"), PluginDescriptor.FileVersion);
Writer->WriteValue(TEXT("FriendlyName"), PluginDescriptor.FriendlyName);
Writer->WriteValue(TEXT("Version"), PluginDescriptor.Version);
Writer->WriteValue(TEXT("VersionName"), PluginDescriptor.VersionName);
Writer->WriteValue(TEXT("CreatedBy"), PluginDescriptor.CreatedBy);
Writer->WriteValue(TEXT("CreatedByURL"), PluginDescriptor.CreatedByURL);
Writer->WriteValue(TEXT("Category"), PluginDescriptor.Category);
Writer->WriteValue(TEXT("Description"), PluginDescriptor.Description);
Writer->WriteValue(TEXT("EnabledByDefault"), PluginDescriptor.bEnabledByDefault);
// Write the module list
FModuleDescriptor::WriteArray(Writer.Get(), TEXT("Modules"), PluginDescriptor.Modules);
Writer->WriteObjectEnd();
Writer->Close();
return FFileHelper::SaveStringToFile(Text, *NewProjectFilename);
}
示例12: Construct
void Construct(const FArguments& InArgs, const TSharedRef<FFriendsStatusViewModel>& InViewModel)
{
FriendStyle = *InArgs._FriendStyle;
ViewModel = InViewModel;
FFriendsStatusViewModel* ViewModelPtr = &InViewModel.Get();
const TArray<FFriendsStatusViewModel::FOnlineState>& StatusOptions = ViewModelPtr->GetStatusList();
SFriendsAndChatCombo::FItemsArray ComboMenuItems;
for (const auto& StatusOption : StatusOptions)
{
if (StatusOption.bIsDisplayed)
{
ComboMenuItems.AddItem(StatusOption.DisplayText, GetStatusBrush(StatusOption.State), FName(*StatusOption.DisplayText.ToString()));
}
}
SUserWidget::Construct(SUserWidget::FArguments()
[
SNew(SFriendsAndChatCombo)
.FriendStyle(&FriendStyle)
.ButtonText(ViewModelPtr, &FFriendsStatusViewModel::GetStatusText)
.bShowIcon(true)
.DropdownItems(ComboMenuItems)
.bSetButtonTextToSelectedItem(false)
.bAutoCloseWhenClicked(true)
.ButtonSize(FriendStyle.StatusButtonSize)
.OnDropdownItemClicked(this, &SFriendsStatusImpl::HandleStatusChanged)
.IsEnabled(this, &SFriendsStatusImpl::IsStatusEnabled)
]);
}
示例13: Construct
void SEditorViewport::Construct( const FArguments& InArgs )
{
ChildSlot
[
SAssignNew( ViewportWidget, SViewport )
.ShowEffectWhenDisabled( false )
.EnableGammaCorrection( false ) // Scene rendering handles this
.AddMetaData(InArgs.MetaData.Num() > 0 ? InArgs.MetaData[0] : MakeShareable(new FTagMetaData(TEXT("LevelEditorViewport"))))
[
SAssignNew( ViewportOverlay, SOverlay )
+SOverlay::Slot()
[
SNew( SBorder )
.BorderImage( this, &SEditorViewport::OnGetViewportBorderBrush )
.BorderBackgroundColor( this, &SEditorViewport::OnGetViewportBorderColorAndOpacity )
.Visibility( this, &SEditorViewport::OnGetViewportContentVisibility )
.Padding(0.0f)
.ShowEffectWhenDisabled( false )
]
]
];
TSharedRef<FEditorViewportClient> ViewportClient = MakeEditorViewportClient();
if (!ViewportClient->VisibilityDelegate.IsBound())
{
ViewportClient->VisibilityDelegate.BindSP(this, &SEditorViewport::IsVisible);
}
SceneViewport = MakeShareable( new FSceneViewport( &ViewportClient.Get(), ViewportWidget ) );
ViewportClient->Viewport = SceneViewport.Get();
ViewportWidget->SetViewportInterface(SceneViewport.ToSharedRef());
Client = ViewportClient;
if ( Client->IsRealtime() )
{
ActiveTimerHandle = RegisterActiveTimer( 0.f, FWidgetActiveTimerDelegate::CreateSP( this, &SEditorViewport::EnsureTick ) );
}
CommandList = MakeShareable( new FUICommandList );
// Ensure the commands are registered
FEditorViewportCommands::Register();
BindCommands();
TSharedPtr<SWidget> ViewportToolbar = MakeViewportToolbar();
if( ViewportToolbar.IsValid() )
{
ViewportOverlay->AddSlot()
.VAlign(VAlign_Top)
[
ViewportToolbar.ToSharedRef()
];
}
PopulateViewportOverlays(ViewportOverlay.ToSharedRef());
}
示例14: AddThreadedRequest
void FHttpManager::AddThreadedRequest(const TSharedRef<IHttpThreadedRequest>& Request)
{
{
FScopeLock ScopeLock(&RequestLock);
Requests.Add(Request);
}
Thread->AddRequest(&Request.Get());
}
示例15: Setup
void UJavascriptMultiBox::Setup(TSharedRef<SBox> Box)
{
Box->SetContent(SNew(SSpacer));
Target = &(Box.Get());
OnHook.Execute(FName("Main"),this,FJavascriptMenuBuilder());
Target = nullptr;
}