本文整理汇总了C++中FKey类的典型用法代码示例。如果您正苦于以下问题:C++ FKey类的具体用法?C++ FKey怎么用?C++ FKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FKey
bool UDozerGameViewportClient::InputKey(FViewport* Viewport,
int32 ControllerId,
FKey Key,
EInputEvent Event,
float AmountDepressed,
bool bGamepad){
Super::InputKey(Viewport, ControllerId, Key, Event, AmountDepressed, bGamepad);
if (ControllerId == 0){
if (Key.GetDisplayName().ToString().Equals(TEXT("Up"))){
Super::InputKey(Viewport, 1, FKey("W"), Event, AmountDepressed, bGamepad);
}
else if (Key.GetDisplayName().ToString().Equals(TEXT("Down"))){
Super::InputKey(Viewport, 1, FKey("S"), Event, AmountDepressed, bGamepad);
}
else if (Key.GetDisplayName().ToString().Equals(TEXT("Left"))){
Super::InputKey(Viewport, 1, FKey("A"), Event, AmountDepressed, bGamepad);
}
else if (Key.GetDisplayName().ToString().Equals(TEXT("Right"))){
Super::InputKey(Viewport, 1, FKey("D"), Event, AmountDepressed, bGamepad);
}
}
return true;
}
示例2: OnKeyDown
FReply FSceneViewport::OnKeyDown( const FGeometry& InGeometry, const FKeyEvent& InKeyEvent )
{
// Start a new reply state
CurrentReplyState = FReply::Handled();
FKey Key = InKeyEvent.GetKey();
KeyStateMap.Add( Key, true );
//@todo Slate Viewports: FWindowsViewport checks for Alt+Enter or F11 and toggles fullscreen. Unknown if fullscreen via this method will be needed for slate viewports.
if( ViewportClient && GetSizeXY() != FIntPoint::ZeroValue )
{
// Switch to the viewport clients world before processing input
FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient );
if (!ViewportClient->InputKey(this, InKeyEvent.GetUserIndex(), Key, InKeyEvent.IsRepeat() ? IE_Repeat : IE_Pressed, 1.0f, Key.IsGamepadKey()))
{
CurrentReplyState = FReply::Unhandled();
}
}
return CurrentReplyState;
}
示例3: OnKeyUp
FReply FSceneViewport::OnKeyUp( const FGeometry& InGeometry, const FKeyEvent& InKeyEvent )
{
// Start a new reply state
CurrentReplyState = FReply::Handled();
FKey Key = InKeyEvent.GetKey();
KeyStateMap.Add( Key, false );
if( ViewportClient && GetSizeXY() != FIntPoint::ZeroValue )
{
// Switch to the viewport clients world before processing input
FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient );
if (!ViewportClient->InputKey(this, InKeyEvent.GetUserIndex(), Key, IE_Released, 1.0f, Key.IsGamepadKey()))
{
CurrentReplyState = FReply::Unhandled();
}
}
return CurrentReplyState;
}
示例4: OnAnalogValueChanged
FReply FSceneViewport::OnAnalogValueChanged(const FGeometry& MyGeometry, const FAnalogInputEvent& InAnalogInputEvent)
{
// Start a new reply state
CurrentReplyState = FReply::Handled();
FKey Key = InAnalogInputEvent.GetKey();
KeyStateMap.Add(Key, true);
if (ViewportClient)
{
// Switch to the viewport clients world before processing input
FScopedConditionalWorldSwitcher WorldSwitcher(ViewportClient);
if (!ViewportClient->InputAxis(this, InAnalogInputEvent.GetUserIndex(), Key, Key == EKeys::Gamepad_RightY ? -InAnalogInputEvent.GetAnalogValue() : InAnalogInputEvent.GetAnalogValue(), FApp::GetDeltaTime(), 1, Key.IsGamepadKey()))
{
CurrentReplyState = FReply::Unhandled();
}
}
return CurrentReplyState;
}
示例5: InputKey
bool UBomberManViewportClient::InputKey(FViewport * Viewport, int32 ControllerId, FKey Key, EInputEvent EventType, float AmountDepressed, bool bGamepad)
{
if (IgnoreInput() || bGamepad || Key.IsMouseButton())
{
return Super::InputKey(Viewport, ControllerId, Key, EventType, AmountDepressed, bGamepad);
}
else
{
// Propagate keyboard events to all players
UEngine* const Engine = GetOuterUEngine();
int32 const NumPlayers = Engine ? Engine->GetNumGamePlayers(this) : 0;
bool bRetVal = false;
for (int32 i = 0; i < NumPlayers; i++)
{
bRetVal = Super::InputKey(Viewport, i, Key, EventType, AmountDepressed, bGamepad) || bRetVal;
}
return bRetVal;
}
}
示例6: InputAxis
bool UBomberManViewportClient::InputAxis(FViewport* Viewport, int32 ControllerId, FKey Key, float Delta, float DeltaTime, int32 NumSamples, bool bGamepad)
{
if (IgnoreInput() || bGamepad || Key.IsMouseButton())
{
return Super::InputAxis(Viewport, ControllerId, Key, Delta, DeltaTime, NumSamples, bGamepad);
}
else
{
// Propagate axis events to all players
UEngine* const Engine = GetOuterUEngine();
int32 const NumPlayers = Engine ? Engine->GetNumGamePlayers(this) : 0;
bool bRetVal = false;
for (int32 i = 0; i < NumPlayers; i++)
{
bRetVal = Super::InputAxis(Viewport, i, Key, Delta, DeltaTime, NumSamples, bGamepad) || bRetVal;
}
return bRetVal;
}
}
示例7: FKey
void SFlareKeyBind::SetKey(FKey NewKey, bool bCanReset, bool bNotify)
{
if (Key.IsValid())
{
FKey CurrentKey = *Key;
if (NewKey == *Key && bCanReset)
{
NewKey = FKey();
}
*Key = NewKey;
KeyText->SetText(NewKey == FKey() ? FString() : NewKey.ToString());
bWaitingForKey = false;
FSlateApplication::Get().GetPlatformApplication().Get()->Cursor->Show(true);
FSlateApplication::Get().ClearKeyboardFocus(EKeyboardFocusCause::SetDirectly);
if (bNotify)
{
OnKeyBindingChanged.ExecuteIfBound( CurrentKey , NewKey );
}
}
}
示例8: Key_GetDisplayName
FText UKismetInputLibrary::Key_GetDisplayName(const FKey& Key)
{
return Key.GetDisplayName();
}
示例9: Key_IsModifierKey
bool UKismetInputLibrary::Key_IsModifierKey(const FKey& Key)
{
return Key.IsModifierKey();
}
示例10: PopulateCefKeyEvent
void FCEFWebBrowserWindow::PopulateCefKeyEvent(const FKeyEvent& InKeyEvent, CefKeyEvent& OutKeyEvent)
{
#if PLATFORM_MAC
OutKeyEvent.native_key_code = InKeyEvent.GetKeyCode();
FKey Key = InKeyEvent.GetKey();
if (Key == EKeys::BackSpace)
{
OutKeyEvent.unmodified_character = kBackspaceCharCode;
}
else if (Key == EKeys::Tab)
{
OutKeyEvent.unmodified_character = kTabCharCode;
}
else if (Key == EKeys::Enter)
{
OutKeyEvent.unmodified_character = kReturnCharCode;
}
else if (Key == EKeys::Pause)
{
OutKeyEvent.unmodified_character = NSPauseFunctionKey;
}
else if (Key == EKeys::Escape)
{
OutKeyEvent.unmodified_character = kEscapeCharCode;
}
else if (Key == EKeys::PageUp)
{
OutKeyEvent.unmodified_character = NSPageUpFunctionKey;
}
else if (Key == EKeys::PageDown)
{
OutKeyEvent.unmodified_character = NSPageDownFunctionKey;
}
else if (Key == EKeys::End)
{
OutKeyEvent.unmodified_character = NSEndFunctionKey;
}
else if (Key == EKeys::Home)
{
OutKeyEvent.unmodified_character = NSHomeFunctionKey;
}
else if (Key == EKeys::Left)
{
OutKeyEvent.unmodified_character = NSLeftArrowFunctionKey;
}
else if (Key == EKeys::Up)
{
OutKeyEvent.unmodified_character = NSUpArrowFunctionKey;
}
else if (Key == EKeys::Right)
{
OutKeyEvent.unmodified_character = NSRightArrowFunctionKey;
}
else if (Key == EKeys::Down)
{
OutKeyEvent.unmodified_character = NSDownArrowFunctionKey;
}
else if (Key == EKeys::Insert)
{
OutKeyEvent.unmodified_character = NSInsertFunctionKey;
}
else if (Key == EKeys::Delete)
{
OutKeyEvent.unmodified_character = kDeleteCharCode;
}
else if (Key == EKeys::F1)
{
OutKeyEvent.unmodified_character = NSF1FunctionKey;
}
else if (Key == EKeys::F2)
{
OutKeyEvent.unmodified_character = NSF2FunctionKey;
}
else if (Key == EKeys::F3)
{
OutKeyEvent.unmodified_character = NSF3FunctionKey;
}
else if (Key == EKeys::F4)
{
OutKeyEvent.unmodified_character = NSF4FunctionKey;
}
else if (Key == EKeys::F5)
{
OutKeyEvent.unmodified_character = NSF5FunctionKey;
}
else if (Key == EKeys::F6)
{
OutKeyEvent.unmodified_character = NSF6FunctionKey;
}
else if (Key == EKeys::F7)
{
OutKeyEvent.unmodified_character = NSF7FunctionKey;
}
else if (Key == EKeys::F8)
{
OutKeyEvent.unmodified_character = NSF8FunctionKey;
}
else if (Key == EKeys::F9)
{
//.........这里部分代码省略.........
示例11: Key_IsMouseButton
bool UKismetInputLibrary::Key_IsMouseButton(const FKey& Key)
{
return Key.IsMouseButton();
}
示例12: Key_IsGamepadKey
bool UKismetInputLibrary::Key_IsGamepadKey(const FKey& Key)
{
return Key.IsGamepadKey();
}
示例13: EventButtonReleased
void FDirectInputJoystick::EventButtonReleased(const TSharedPtr<FGenericApplicationMessageHandler>& MessageHandler, EDirectInputPadKeyNames ePadName, FKey DIKey)
{
if(!IsRelease(ePadName-DIGamePad_Button1)) return;
MessageHandler->OnControllerButtonReleased(DIKey.GetFName(), GetPlayerIndex(), false);
}
示例14: GetVectorAxisValue
FVector UInputComponent::GetVectorAxisValue( const FKey AxisKey ) const
{
FVector AxisValue;
bool bFound = false;
for (const FInputVectorAxisBinding& AxisBinding : VectorAxisBindings)
{
if (AxisBinding.AxisKey == AxisKey)
{
AxisValue = AxisBinding.AxisValue;
bFound = true;
break;
}
}
if (!bFound)
{
UE_LOG(LogPlayerController, Warning, TEXT("Request for value of vector axis key '%s' returning 0 as it is not bound on this input component."), *AxisKey.ToString());
}
return AxisValue;
}
示例15: EventAnalog
void FDirectInputJoystick::EventAnalog(const TSharedPtr<FGenericApplicationMessageHandler>& MessageHandler, float Analog, EDirectInputPadKeyNames ePadName, FKey DIKey)
{
MessageHandler->OnControllerAnalog(DIKey.GetFName(), GetPlayerIndex(), Analog);
}