2025-03-28 23:31:44 -04:00
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ConsoleOutput
|
|
|
|
|
//
|
2026-02-14 01:25:04 -05:00
|
|
|
// This class can optionally be used by the GameMode
|
|
|
|
|
// blueprint to help implement the console window. There is
|
|
|
|
|
// no requirement that the blueprint use this class, it can
|
|
|
|
|
// implement the console window any way it wants, this is
|
|
|
|
|
// just here in case it is desired.
|
|
|
|
|
//
|
2025-03-28 23:31:44 -04:00
|
|
|
// This class stores the text that's in the unreal console.
|
|
|
|
|
// It stores it as one great big string, which contains
|
|
|
|
|
// newlines to denote line breaks.
|
|
|
|
|
//
|
2026-02-14 01:25:04 -05:00
|
|
|
// This class also contains a 'dirty' bit. Each time
|
|
|
|
|
// somebody appends a line of text to the console, the dirty
|
|
|
|
|
// bit is automatically set. The bit can be checked using
|
|
|
|
|
// 'IsDirty' and cleared using 'ClearDirty'. This makes it
|
|
|
|
|
// so that you don't have to update the unreal widget unless
|
|
|
|
|
// the text has actually changed.
|
2025-03-28 23:31:44 -04:00
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
2026-02-14 01:25:04 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Containers/UnrealString.h"
|
|
|
|
|
|
|
|
|
|
#include "ConsoleOutput.generated.h"
|
|
|
|
|
|
|
|
|
|
|
2025-12-09 02:42:13 -05:00
|
|
|
UCLASS(BlueprintType)
|
|
|
|
|
class UlxConsoleOutput : public UObject
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
2025-03-28 23:31:44 -04:00
|
|
|
private:
|
|
|
|
|
FString Content;
|
|
|
|
|
bool Dirty;
|
|
|
|
|
|
2025-12-09 02:42:13 -05:00
|
|
|
private:
|
2025-03-28 23:31:44 -04:00
|
|
|
// Truncate the console to a reasonable number of
|
|
|
|
|
// lines. The length is hardwired.
|
|
|
|
|
void Truncate();
|
|
|
|
|
|
|
|
|
|
// Add a newline if there isn't one. Returns true if it changed anything.
|
|
|
|
|
bool MaybeAppendNewline();
|
|
|
|
|
|
|
|
|
|
// Append text. Returns true if it changed anything.
|
|
|
|
|
bool MaybeAppendText(const FString& text);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Append a line of text to the console.
|
2025-12-09 02:42:13 -05:00
|
|
|
UFUNCTION(BlueprintCallable)
|
2025-03-28 23:31:44 -04:00
|
|
|
void Append(const FString& text);
|
|
|
|
|
|
|
|
|
|
// Append a line of text to the console on a line by itself.
|
2025-12-09 02:42:13 -05:00
|
|
|
UFUNCTION(BlueprintCallable)
|
2025-03-28 23:31:44 -04:00
|
|
|
void AppendLine(const FString& text);
|
|
|
|
|
|
|
|
|
|
// Get the console text as a string.
|
2025-12-09 02:42:13 -05:00
|
|
|
UFUNCTION(BlueprintCallable)
|
2025-03-28 23:31:44 -04:00
|
|
|
const FString& Get() const { return Content; }
|
|
|
|
|
|
|
|
|
|
// Return if the dirty flag is set.
|
2025-12-09 02:42:13 -05:00
|
|
|
UFUNCTION(BlueprintCallable)
|
2025-03-28 23:31:44 -04:00
|
|
|
bool IsDirty() const { return Dirty; }
|
|
|
|
|
|
|
|
|
|
// Clear the dirty flag.
|
2025-12-09 02:42:13 -05:00
|
|
|
UFUNCTION(BlueprintCallable)
|
2025-03-28 23:31:44 -04:00
|
|
|
void ClearDirty() { Dirty = false; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|