2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2018-09-25 10:11:35 -04:00
# pragma once
# include "Widgets/SWindow.h"
2019-10-08 16:33:58 -04:00
# include "IAnalyticsProviderET.h"
2018-09-25 10:11:35 -04:00
enum class EPreLoadScreenTypes : uint8
{
2019-10-03 08:46:18 -04:00
CustomSplashScreen ,
2018-09-25 10:11:35 -04:00
EarlyStartupScreen ,
EngineLoadingScreen
} ;
// Interface that defines the class that handles all the logic for controlling / displaying a particular PreLoadScreen.
// Designed to be implemented in a Plugin that calls FPreLoadScreenManager::RegisterPreLoadScreen so that functions are called by PreLoadScreenManager correctly.
// Really should probably inherit from FPreLoadScreenBase instead of this class for more functionality
2021-04-08 14:32:07 -04:00
class IPreLoadScreen : public TSharedFromThis < IPreLoadScreen >
2018-09-25 10:11:35 -04:00
{
public :
2020-06-23 18:40:00 -04:00
virtual ~ IPreLoadScreen ( ) = default ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
virtual void Init ( ) = 0 ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
/** Standard tick that happens every frame */
virtual void Tick ( float DeltaTime ) = 0 ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
/**
* This function is used to determine if an extra platform sleep should be performed every tick ( to slow down the tick rate )
* keeps us from spinning super fast when we aren ' t doing much beyond loading data / etc on other threads .
*/
virtual float GetAddedTickDelay ( ) = 0 ;
/** Whether an EarlyStartupLoadScreen should render */
2019-07-22 11:49:15 -04:00
virtual bool ShouldRender ( ) const = 0 ;
2020-06-23 18:40:00 -04:00
/**
* This tick happens as part of the slate render tick during an EarlyStartupLoadScreen
* @ note Called on the render thread
*/
virtual void RenderTick ( float DeltaTime ) = 0 ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
/** Callback for when a PreLoadScreen starts being displayed. Provides a reference to the SWindow that will be used to display content */
virtual void OnPlay ( TWeakPtr < SWindow > TargetWindow ) = 0 ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
/** Callback for when a PreLoadScreen is no longer being displayed. */
virtual void OnStop ( ) = 0 ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
/**
* Returns true when the PreLoadScreen is completed .
* @ note This need to be thread safe
*/
virtual bool IsDone ( ) const = 0 ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
virtual void CleanUp ( ) = 0 ;
/**
* Should override this function to determine if this screen should be used to handle EarlyStartupScreen behavior
* @ note IMPORTANT : This changes a LOT of functionality and implementation details . EarlyStartupScreens happen before the engine is fully initialized and block engine initialization before they finish .
* this means they have to forgo even the most basic of engine features like UObject support , as they are displayed before those systems are initialized .
*/
virtual EPreLoadScreenTypes GetPreLoadScreenType ( ) const = 0 ;
/**
* Allows the PreLoadScreen to register a tag that can be later used to find a specific loading screen .
* PreLoadScreens not using this functionality should return NAME_None
*/
2018-09-25 10:11:35 -04:00
virtual FName GetPreLoadScreenTag ( ) const = 0 ;
2020-06-23 18:40:00 -04:00
/** @See IsDone when GetPreLoadScreenType() returns EPreLoadScreenTypes::EngineLoadingScreen */
virtual void SetEngineLoadingFinished ( bool IsEngineLoadingFinished ) = 0 ;
2018-09-25 10:11:35 -04:00
2020-06-23 18:40:00 -04:00
virtual const TSharedPtr < const SWidget > GetWidget ( ) const = 0 ;
virtual TSharedPtr < SWidget > GetWidget ( ) = 0 ;
2018-09-25 10:11:35 -04:00
} ;