Files
integration/Source/Integration/IntegrationGameModeBase.h

81 lines
2.3 KiB
C
Raw Normal View History

2023-06-08 17:10:14 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "enginewrapper.hpp"
#include "engineutil.hpp"
2023-09-02 01:33:11 -04:00
#include "TangibleManager.h"
2023-06-23 16:27:23 -04:00
#include "LuprexSockets.hpp"
2023-06-09 14:36:47 -04:00
#include "IntegrationGameModeBase.generated.h"
2023-06-08 17:10:14 -04:00
/**
*
*/
UCLASS()
class INTEGRATION_API AIntegrationGameModeBase : public AGameModeBase, public FRunnable
2023-06-08 17:10:14 -04:00
{
GENERATED_BODY()
public:
2023-06-09 14:36:47 -04:00
AIntegrationGameModeBase();
~AIntegrationGameModeBase();
2023-06-08 17:10:14 -04:00
virtual void BeginPlay() override;
virtual void Tick(float) override;
2023-06-09 16:47:46 -04:00
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
2023-06-08 17:10:14 -04:00
2023-06-23 16:27:23 -04:00
// Delete all the state created in BeginPlay. That
// includes: the Luprex engine, the thread, and the socket state.
void ResetToInitialState();
2023-06-23 12:45:23 -04:00
// Method of FRunnable, called by the Luprex thread.
virtual uint32 Run() override;
2023-06-08 17:10:14 -04:00
// 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.
2023-06-08 17:10:14 -04:00
UFUNCTION(BlueprintCallable)
void ConsoleSendInput(const FString& text);
2023-08-29 19:36:37 -04:00
// The blueprint class TangibleActor
UPROPERTY(EditDefaultsOnly, Category = TangibleClasses)
TSubclassOf<AActor> ClassTangibleActor;
2023-06-23 12:45:23 -04:00
// Transfer console output from the Luprex engine to unreal.
2023-09-03 02:01:32 -04:00
void HandleLuprexConsoleOutput(FLockedWrapper &w);
2023-06-23 12:45:23 -04:00
UPROPERTY()
FTangibleManager TangibleManager;
2023-08-29 20:05:10 -04:00
2023-06-23 12:45:23 -04:00
// This stores the entire text currently visible in the console.
engineutil::ConsoleOutput ConsoleOutput;
2023-06-08 17:10:14 -04:00
2023-06-23 12:45:23 -04:00
// The worker thread.
FRunnableThread *Thread;
2023-06-09 16:47:46 -04:00
2023-06-23 12:45:23 -04:00
// Used to tell the worker thread to stop.
bool ThreadStopRequested;
2023-06-23 12:45:23 -04:00
// 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;
2023-09-03 02:01:32 -04:00
// The Luprex EngineWrapper, with a Mutex to protect it.
// To access it, construct a FLockedWrapper.
FLockableWrapper LockableWrapper;
2023-06-23 16:27:23 -04:00
// Luprex socket system. Aside from construction, only touched by Luprex thread.
TUniquePtr<FLpxSockets> Sockets;
// Amount of elapsed time.
2023-06-08 17:10:14 -04:00
float EngineSeconds;
2023-06-23 12:45:23 -04:00
// When do we next trigger the thread event (relative to EngineSeconds).
float NextThreadTrigger;
2023-06-08 17:10:14 -04:00
};