// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "GameFramework/GameModeBase.h" #include "enginewrapper.hpp" #include "engineutil.hpp" #include "IntegrationGameModeBase.generated.h" /** * */ UCLASS() class INTEGRATION_API AIntegrationGameModeBase : public AGameModeBase, public FRunnable { GENERATED_BODY() public: AIntegrationGameModeBase(); ~AIntegrationGameModeBase(); virtual void BeginPlay() override; virtual void Tick(float) override; virtual void EndPlay(const EEndPlayReason::Type EndPlayReason); // Thread start and shutdown. void LaunchThread(); void WaitForThread(); // Methods of FRunnable, for the thread to use. virtual bool Init() override; virtual uint32 Run() override; virtual void Stop() override; // Return true if luprex was successfully initialized. inline bool luprex_initialized() { return Luprex.play_initialize != nullptr; } // Set the entire contents of the console output box. UFUNCTION(BlueprintImplementableEvent) void ConsoleSetOutput(const FString& text); // This is called by the GUI whenever the user hits enter. UFUNCTION(BlueprintCallable) void ConsoleSendInput(const FString& text); void HandleConsoleOutput(); // The worker thread is responsible for networking and event_update FRunnableThread* Thread; bool ThreadStopRequested; engineutil::ConsoleOutput ConsoleOutput; static EngineWrapper Luprex; float EngineSeconds; };