// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "GameFramework/GameModeBase.h" #include "enginewrapper.hpp" #include "engineutil.hpp" #include "TangibleManager.h" #include "LuprexSockets.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); // Delete all the state created in BeginPlay. That // includes: the Luprex engine, the thread, and the socket state. void ResetToInitialState(); // Method of FRunnable, called by the Luprex thread. virtual uint32 Run() override; // 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); // The blueprint class TangibleActor UPROPERTY(EditDefaultsOnly, Category = TangibleClasses) TSubclassOf ClassTangibleActor; // Transfer console output from the Luprex engine to unreal. void HandleLuprexConsoleOutput(); //UPROPERTY() //FTangibleManager TangibleManager; // This stores the entire text currently visible in the console. engineutil::ConsoleOutput ConsoleOutput; // The worker thread. FRunnableThread *Thread; // Used to tell the worker thread to stop. bool ThreadStopRequested; // This event is used to wake up the Luprex thread. Normally, // this means we want the worker to do one processing step. But // if ThreadStopRequested is true, it means we want the thread // to exit. FEvent* ThreadEvent; // This critical section guards the use of the EngineWrapper. FCriticalSection LuprexMutex; // The Luprex wrapper and engine. MUST CLAIM LuprexMutex. EngineWrapper Luprex; // Luprex socket system. Aside from construction, only touched by Luprex thread. TUniquePtr Sockets; // Amount of elapsed time. float EngineSeconds; // When do we next trigger the thread event (relative to EngineSeconds). float NextThreadTrigger; };