Mostly Harmless

UE3:GameViewportClient (UDK)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UDK Object >> GameViewportClient

Contents

Package: 
Engine
Within class: 
Engine
Known classes within GameViewportClient:
Console, PlayerManagerInteraction, UIInteraction, UTConsole, UTGameInteraction
Direct subclass:
UTGameViewportClient
This class in other games:
UT3

A game viewport (FViewport) is a high-level abstract interface for the platform specific rendering, audio, and input subsystems. GameViewportClient is the engine's interface to a game viewport. Exactly one GameViewportClient is created for each instance of the game. The only case (so far) where you might have a single instance of Engine, but multiple instances of the game (and thus multiple GameViewportClients) is when you have more than one PIE window running.

Responsibilities: propagating input events to the global interactions list

Properties[edit]

ActiveSplitscreenType[edit]

Type: ESplitScreenType

Modifiers: protected

The splitscreen type that is actually being used; takes into account the number of players and other factors (such as cinematic mode) that could affect the splitscreen mode that is actually used.

bDisableWorldRendering[edit]

Type: bool

set to disable world rendering

bDisplayingUIMouseCursor[edit]

Type: bool

Modifiers: transient

Indicates whether the UI is currently displaying a mouse cursor. Prevents GameEngine::Tick() from recapturing mouse input while the UI has active scenes that mouse input.

bShowTitleSafeZone[edit]

Type: bool

if TRUE then the title safe border is drawn

bUIMouseCaptureOverride[edit]

Type: bool

Modifiers: transient

Indicates that the UI needs to receive all mouse input events. Usually enabled when the user is interacting with a draggable widget, such as a scrollbar or slider.

ConnectingMessage[edit]

Type: string

Modifiers: localized


Default value: "CONNECTING"

DebugProperties[edit]

Type: array<DebugDisplayProperty>


Default2PSplitType[edit]

Type: ESplitScreenType

Modifiers: const

Defaults for intances where there are multiple configs for a certain number of players

Default value: eSST_2P_HORIZONTAL

Default3PSplitType[edit]

Type: ESplitScreenType

Modifiers: const


Default value: eSST_3P_FAVOR_TOP

DesiredSplitscreenType[edit]

Type: ESplitScreenType

Modifiers: protected

The splitscreen layout type that the player wishes to use; this value usually comes from places like the player's profile

GlobalInteractions[edit]

Type: array<Interaction>

Modifiers: init, protected

A list of interactions which have a chance at all input before the player's interactions.

LoadingMessage[edit]

Type: string

Modifiers: localized

Name: Localized transition messages.

Default value: "LOADING"

PausedMessage[edit]

Type: string

Modifiers: localized


Default value: "PAUSED"

PrecachingMessage[edit]

Type: string

Modifiers: localized


Default value: "PRECACHING"

ProgressFadeTime[edit]

Type: float


Default value: 1.0

ProgressMessage[edit]

Type: string

Array size: 2


ProgressTimeOut[edit]

Type: float


Default value: 8.0

SavingMessage[edit]

Type: string

Modifiers: localized


Default value: "SAVING"

ShowFlags[edit]

Type: Object.qword

Modifiers: const

The show flags used by the viewport's players.

SplitscreenInfo[edit]

Type: array<SplitscreenData>

Array of the screen data needed for all the different splitscreen configurations

Default value, index 0:

Member Value
PlayerData
Member Value
SizeX 1.0
SizeY 1.0

Default value, index 1:

Member Value
PlayerData
Member Value
SizeX 1.0
SizeY 0.5
Member Value
OriginY 0.5
SizeX 1.0
SizeY 0.5

Default value, index 2:

Member Value
PlayerData
Member Value
SizeX 0.5
SizeY 1.0
Member Value
OriginX 0.5
SizeX 0.5
SizeY 1.0

Default value, index 3:

Member Value
PlayerData
Member Value
SizeX 1.0
SizeY 0.5
Member Value
OriginY 0.5
SizeX 0.5
SizeY 0.5
Member Value
OriginX 0.5
OriginY 0.5
SizeX 0.5
SizeY 0.5

Default value, index 4:

Member Value
PlayerData
Member Value
SizeX 0.5
SizeY 0.5
Member Value
OriginX 0.5
SizeX 0.5
SizeY 0.5
Member Value
OriginY 0.5
SizeX 1.0
SizeY 0.5

Default value, index 5:

Member Value
PlayerData
Member Value
SizeX 0.5
SizeY 0.5
Member Value
OriginX 0.5
SizeX 0.5
SizeY 0.5
Member Value
OriginY 0.5
SizeX 0.5
SizeY 0.5
Member Value
OriginX 0.5
OriginY 0.5
SizeX 0.5
SizeY 0.5

TitleSafeZone[edit]

Type: TitleSafeZoneArea

border of safe area

Default value:

Member Value
MaxPercentX 0.9
MaxPercentY 0.9
RecommendedPercentX 0.8
RecommendedPercentY 0.8

UIController[edit]

Type: UIInteraction

The viewport's UI controller

UIControllerClass[edit]

Type: class<UIInteraction>

The class for the UI controller

Default value: Class'Engine.UIInteraction'

Viewport[edit]

Type: pointer{FViewport}

Modifiers: const

The platform-specific viewport which this viewport client is attached to.

ViewportConsole[edit]

Type: Console

The viewport's console. Might be null on consoles

ViewportFrame[edit]

Type: pointer{FViewportFrame}

Modifiers: const

The platform-specific viewport frame which this viewport is contained by.

Enums[edit]

ESafeZoneType[edit]

The 4 different kinds of safezones

eSZ_TOP 
eSZ_BOTTOM 
eSZ_LEFT 
eSZ_RIGHT 

ESplitScreenType[edit]

Enum of the different splitscreen types

eSST_NONE 
No split
eSST_2P_HORIZONTAL 
2 player horizontal split
eSST_2P_VERTICAL 
2 player vertical split
eSST_3P_FAVOR_TOP 
3 Player split with 1 player on top and 2 on bottom
eSST_3P_FAVOR_BOTTOM 
3 Player split with 1 player on bottom and 2 on top
eSST_4P 
4 Player split

Structs[edit]

DebugDisplayProperty[edit]

Modifiers: native

debug property display functionality to interact with this, use "display", "displayall", "displayclear"

Object Obj 
the object whose property to display. If this is a class, all objects of that class are drawn.
name PropertyName 
name of the property to display
bool bSpecialProperty 
whether PropertyName is a "special" value not directly mapping to a real property (e.g. state name)

PerPlayerSplitscreenData[edit]

Modifiers: native

Structure to store splitscreen data.

float SizeX 
float SizeY 
float OriginX 
float OriginY 

SplitscreenData[edit]

Modifiers: native

Structure containing all the player splitscreen datas per splitscreen configuration.

array<PerPlayerSplitscreenData> PlayerData 

TitleSafeZoneArea[edit]

Modifiers: native

Max/Recommended screen viewable extents as a percentage

float MaxPercentX 
float MaxPercentY 
float RecommendedPercentX 
float RecommendedPercentY 

Delegates[edit]

HandleInputAxis[edit]

delegate bool HandleInputAxis (int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad)

Provides script-only child classes the opportunity to handle input axis events received from the viewport. This delegate is called before the input axis event is passed to the interactions array for processing.

Parameters:

  • ControllerId - the controller that generated this input axis event
  • Key - the name of the axis that moved (KEY_MouseX, KEY_XboxTypeS_LeftX, etc.)
  • Delta - the movement delta for the axis
  • DeltaTime - the time (in seconds) since the last axis update.
  • bGamepad - input came from gamepad (ie xbox controller)

Returns:

return TRUE to indicate that the input event was handled. if the return value is TRUE, this input event will not be passed to the interactions array.

HandleInputChar[edit]

delegate bool HandleInputChar (int ControllerId, string Unicode)

Provides script-only child classes the opportunity to handle character input (typing) events received from the viewport. This delegate is called before the character event is passed to the interactions array for processing.

Parameters:

  • ControllerId - the controller that generated this character input event
  • Unicode - the character that was typed

Returns:

return TRUE to indicate that the input event was handled. if the return value is TRUE, this input event will not be passed to the interactions array.

HandleInputKey[edit]

delegate bool HandleInputKey (int ControllerId, name Key, Object.EInputEvent EventType, float AmountDepressed, optional bool bGamepad)

Provides script-only child classes the opportunity to handle input key events received from the viewport. This delegate is called before the input key event is passed to the interactions array for processing.

Parameters:

  • ControllerId - the controller that generated this input key event
  • Key - the name of the key which an event occured for (KEY_Up, KEY_Down, etc.)
  • EventType - the type of event which occured (pressed, released, etc.)
  • AmountDepressed - for analog keys, the depression percent.
  • bGamepad - input came from gamepad (ie xbox controller)

Returns:

return TRUE to indicate that the input event was handled. if the return value is TRUE, this input event will not be passed to the interactions array.

Functions[edit]

Exec functions[edit]

SetProgressTime[edit]

exec event SetProgressTime (float T)


ClearProgressMessages[edit]

exec function ClearProgressMessages ()


Native functions[edit]

ConsoleCommand[edit]

native function string ConsoleCommand (string Command)

Executes a console command in the context of this viewport.

Parameters:

  • Command - The command to execute.

Returns:

The output of the command will be returned.

GetViewportSize[edit]

native final function GetViewportSize (out Object.Vector2D out_ViewportSize)

Retrieve the size of the main viewport.

Parameters:

  • out_ViewportSize - out] will be filled in with the size of the main viewport

IsFullScreenViewport[edit]

native final function bool IsFullScreenViewport ()

Returns:

Whether or not the main viewport is fullscreen or windowed.

ShouldForceFullscreenViewport[edit]

native final function bool ShouldForceFullscreenViewport () const

Determine whether a fullscreen viewport should be used in cases where there are multiple players.

Returns:

TRUE to use a fullscreen viewport; FALSE to allow each player to have their own area of the viewport.

Events[edit]

CreatePlayer[edit]

event LocalPlayer CreatePlayer (int ControllerId, out string OutError, bool bSpawnActor)

Adds a new player.

Parameters:

  • ControllerId - The controller ID the player should accept input from.
  • OutError - If no player is returned, OutError will contain a string describing the reason.
  • SpawnActor - True if an actor should be spawned for the new player.

Returns:

The player which was created.

FindPlayerByControllerId[edit]

final event LocalPlayer FindPlayerByControllerId (int ControllerId)

Finds a player by controller ID.

Parameters:

  • ControllerId - The controller ID to search for.

Returns:

None or the player with matching controller ID.

GameSessionEnded[edit]

event GameSessionEnded ()

Called when the current map is being unloaded. Cleans up any references which would prevent garbage collection.

GetSubtitleRegion[edit]

event GetSubtitleRegion (out Object.Vector2D MinPos, out Object.Vector2D MaxPos)

called before rending subtitles to allow the game viewport to determine the size of the subtitle area

Parameters:

  • Min - top left bounds of subtitle region (0 to 1)
  • Max - bottom right bounds of subtitle region (0 to 1)

Init[edit]

event bool Init (out string OutError)

Initialize the game viewport.

Parameters:

  • OutError - If an error occurs, returns the error description.

Returns:

False if an error occurred, true if the viewport was initialized successfully.

InsertInteraction[edit]

event int InsertInteraction (Interaction NewInteraction, optional int InIndex)

Inserts an interaction into the GlobalInteractions array at the specified index

Parameters:

  • NewInteraction - the interaction that should be inserted into the array
  • Index - the position in the GlobalInteractions array to insert the element. if no value (or -1) is specified, inserts the interaction at the end of the array

Returns:

the position in the GlobalInteractions array where the element was placed, or -1 if the element wasn't added to the array for some reason

LayoutPlayers[edit]

event LayoutPlayers ()

Called before rendering to allow the game viewport to allocate subregions to players.

PostRender[edit]

event PostRender (Canvas Canvas)

Called after rendering the player views and HUDs to render menus, the console, etc. This is the last rendering call in the render loop

Parameters:

  • Canvas - The canvas to use for rendering.

RemovePlayer[edit]

event bool RemovePlayer (LocalPlayer ExPlayer)

Removes a player.

Parameters:

  • Player - The player to remove.

Returns:

whether the player was successfully removed. Removal is not allowed while connected to a server.

SetProgressMessage[edit]

event SetProgressMessage (PlayerController.EProgressMessageType MessageType, string Message, optional string Title, optional bool bIgnoreFutureNetworkMessages)

handler for global state messages, generally network connection related (failures, download progress, etc)

Tick[edit]

event Tick (float DeltaTime)

Called every frame to allow the game viewport to update time based state.

Parameters:

  • DeltaTime - The time since the last call to Tick.

Other instance functions[edit]

AddLocalPlayer[edit]

private final function int AddLocalPlayer (LocalPlayer NewPlayer)

Adds a LocalPlayer to the local and global list of Players.

Parameters:

  • NewPlayer - the player to add

CalculateDeadZone[edit]

final function float CalculateDeadZone (LocalPlayer LPlayer, ESafeZoneType SZType, Canvas Canvas, optional bool bUseMaxPercent)


CalculateDeadZoneForAllSides[edit]

final function bool CalculateDeadZoneForAllSides (LocalPlayer LPlayer, Canvas Canvas, out float fTopSafeZone, out float fBottomSafeZone, out float fLeftSafeZone, out float fRightSafeZone, optional bool bUseMaxPercent)


CalculatePixelCenter[edit]

final function CalculatePixelCenter (out float out_CenterX, out float out_CenterY, LocalPlayer LPlayer, Canvas Canvas, optional bool bUseMaxPercent)

Calculate the pixel value of the center of the viewport - this takes the safezones into consideration.

CalculateSafeZoneValues[edit]

final function CalculateSafeZoneValues (out float out_Horizontal, out float out_Vertical, Canvas Canvas, int LocalPlayerIndex, bool bUseMaxPercent)

Calculate the amount of safezone needed for a single side for both vertical and horizontal dimensions

ConvertLocalPlayerToGamePlayerIndex[edit]

final function int ConvertLocalPlayerToGamePlayerIndex (LocalPlayer LPlayer)

Convert a LocalPlayer to it's index in the GamePlayer array Returns -1 if the index could not be found.

CreateInitialPlayer[edit]

function bool CreateInitialPlayer (out string OutError)

Create the game's initial player at startup. First search for a player that is signed into the OnlineSubsystem; if none are found, create a player with a ControllerId of 0.

Parameters:

  • OutError - receives the error string if an error occurs while creating the player.

Returns:

TRUE if a player was successfully created.

DisplayProgressMessage[edit]

function DisplayProgressMessage (Canvas Canvas)

display progress messages in center of screen

DrawTitleSafeArea[edit]

function DrawTitleSafeArea (Canvas Canvas)

Draw the safe area using the current TitleSafeZone settings

DrawTransition[edit]

function DrawTransition (Canvas Canvas)

Displays the transition screen.

Parameters:

  • Canvas - The canvas to use for rendering.

DrawTransitionMessage[edit]

function DrawTransitionMessage (Canvas Canvas, string Message)

Print a centered transition message with a drop shadow.

GetPixelSizeOfScreen[edit]

final function GetPixelSizeOfScreen (out float out_Width, out float out_Height, Canvas Canvas, int LocalPlayerIndex)

Get the total pixel size of the screen. This is different from the pixel size of the viewport since we could be in splitscreen

GetSplitscreenConfiguration[edit]

function ESplitScreenType GetSplitscreenConfiguration ()

Returns:

the actual splitscreen type being used, taking into account the number of players.

HasBottomSafeZone[edit]

final function bool HasBottomSafeZone (int LocalPlayerIndex)

Whether the player at LocalPlayerIndex's viewport has a "bottom of viewport" safezone or not.

HasLeftSafeZone[edit]

final function bool HasLeftSafeZone (int LocalPlayerIndex)

Whether the player at LocalPlayerIndex's viewport has a "left of viewport" safezone or not.

HasRightSafeZone[edit]

final function bool HasRightSafeZone (int LocalPlayerIndex)

Whether the player at LocalPlayerIndex's viewport has a "right of viewport" safezone or not.

HasTopSafeZone[edit]

final function bool HasTopSafeZone (int LocalPlayerIndex)

Whether the player at LocalPlayerIndex's viewport has a "top of viewport" safezone or not.

NotifyConnectionError[edit]

function NotifyConnectionError (optional string Message, optional string Title)

Notifies the player that an attempt to connect to a remote server failed, or an existing connection was dropped.

Parameters:

  • Message - a description of why the connection was lost
  • Title - the title to use in the connection failure message.

NotifyPlayerAdded[edit]

final function NotifyPlayerAdded (int PlayerIndex, LocalPlayer AddedPlayer)

Notifies all interactions that a new player has been added to the list of active players.

Parameters:

  • PlayerIndex - the index [into the GamePlayers array] where the player was inserted
  • AddedPlayer - the player that was added

NotifyPlayerRemoved[edit]

final function NotifyPlayerRemoved (int PlayerIndex, LocalPlayer RemovedPlayer)

Notifies all interactions that a new player has been added to the list of active players.

Parameters:

  • PlayerIndex - the index [into the GamePlayers array] where the player was located
  • RemovedPlayer - the player that was removed

RemoveLocalPlayer[edit]

private final function int RemoveLocalPlayer (LocalPlayer ExistingPlayer)

Removes a LocalPlayer from the local and global list of Players.

Parameters:

  • ExistingPlayer - the player to remove

SetSplitscreenConfiguration[edit]

function SetSplitscreenConfiguration (ESplitScreenType SplitType)

Sets the screen layout configuration that the player wishes to use when in split-screen mode.

UpdateActiveSplitscreenType[edit]

function UpdateActiveSplitscreenType ()

Sets the value of ActiveSplitscreenConfiguration based on the desired split-screen layout type, current number of players, and any other factors that might affect the way the screen should be layed out.