initial commit
This commit is contained in:
0
Source/SaneSlate/FloatRing.cpp
Normal file
0
Source/SaneSlate/FloatRing.cpp
Normal file
48
Source/SaneSlate/FloatRing.h
Normal file
48
Source/SaneSlate/FloatRing.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include "SaneSlateCommon.h"
|
||||
#include "FloatRing.generated.h"
|
||||
|
||||
SaneSlate_NS_BEGIN
|
||||
template<int32 RingSize>
|
||||
struct FloatRing {
|
||||
constexpr static int32 Size = RingSize;
|
||||
float Array[ Size ];
|
||||
int32 CurrentIndex = 0;
|
||||
void Add(float Value) {
|
||||
if (CurrentIndex >= Size) CurrentIndex = 0;
|
||||
Array[ CurrentIndex ] = Value;
|
||||
++ CurrentIndex;
|
||||
}
|
||||
};
|
||||
SaneSlate_NS_END
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FSS_FloatRing_64 {
|
||||
GENERATED_BODY()
|
||||
UPROPERTY() float Array[64];
|
||||
UPROPERTY() int32 CurrentIndex = 0;
|
||||
FSS_ImGuiFloatRing_64() {
|
||||
FMemory::Memzero(Array, sizeof(Array));
|
||||
}
|
||||
void Add(float Value) {
|
||||
if (CurrentIndex >= 64) CurrentIndex = 0;
|
||||
Array[CurrentIndex] = Value;
|
||||
++ CurrentIndex;
|
||||
}
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FSS_FloatRing_128 {
|
||||
GENERATED_BODY()
|
||||
UPROPERTY() float Array[128];
|
||||
UPROPERTY() int32 CurrentIndex = 0;
|
||||
FSS_FloatRing_128() {
|
||||
FMemory::Memzero(Array, sizeof(Array));
|
||||
}
|
||||
void Add(float Value) {
|
||||
if (CurrentIndex >= 128) CurrentIndex = 0;
|
||||
Array[CurrentIndex] = Value;
|
||||
++ CurrentIndex;
|
||||
}
|
||||
};
|
||||
1
Source/SaneSlate/SaneSlateLog.cpp
Normal file
1
Source/SaneSlate/SaneSlateLog.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "SaneSlateLog.h"
|
||||
118
Source/SaneSlate/SaneSlateLog.h
Normal file
118
Source/SaneSlate/SaneSlateLog.h
Normal file
@@ -0,0 +1,118 @@
|
||||
#pragma once
|
||||
|
||||
#include "SaneSlateCommon.h"
|
||||
#include "SaneSlateEngineMinimal.h"
|
||||
|
||||
#include "SaneSlateLog.generated.h"
|
||||
|
||||
// Straight from the Engine
|
||||
UENUM(BlueprintType)
|
||||
enum class EUnrealLogVerbosity : uint8
|
||||
{
|
||||
/** Not used */
|
||||
NoLogging = 0,
|
||||
|
||||
/** Always prints a fatal error to console (and log file) and crashes (even if logging is disabled) */
|
||||
// Fatal,
|
||||
// Just use GASA_Fatal...
|
||||
|
||||
/**
|
||||
* Prints an error to console (and log file).
|
||||
* Commandlets and the editor collect and report errors. Error messages result in commandlet failure.
|
||||
*/
|
||||
Error = ELogVerbosity::Error,
|
||||
|
||||
/**
|
||||
* Prints a warning to console (and log file).
|
||||
* Commandlets and the editor collect and report warnings. Warnings can be treated as an error.
|
||||
*/
|
||||
Warning,
|
||||
|
||||
/** Prints a message to console (and log file) */
|
||||
Display,
|
||||
|
||||
/** Prints a message to a log file (does not print to console) */
|
||||
Log,
|
||||
|
||||
/**
|
||||
* Prints a verbose message to a log file (if Verbose logging is enabled for the given category,
|
||||
* usually used for detailed logging)
|
||||
*/
|
||||
Verbose,
|
||||
|
||||
/**
|
||||
* Prints a verbose message to a log file (if VeryVerbose logging is enabled,
|
||||
* usually used for detailed logging that would otherwise spam output)
|
||||
*/
|
||||
VeryVerbose,
|
||||
};
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogSaneSlate, Log, All);
|
||||
|
||||
SaneSlate_NS_BEGIN
|
||||
|
||||
using ELogV = EUnrealLogVerbosity;
|
||||
|
||||
#if NO_LOGGING
|
||||
using FLogCategoryParam = FNoLoggingCategory;
|
||||
#else
|
||||
using FLogCategoryParam = FLogCategoryBase;
|
||||
#endif
|
||||
|
||||
struct LogParams
|
||||
{
|
||||
bool bToScreen;
|
||||
bool bDisplayNewerOnTop;
|
||||
uint64 ScreenMsgKey;
|
||||
bool DumpStack;
|
||||
FLogCategoryParam& Category;
|
||||
int32 Line;
|
||||
ANSICHAR const* File;
|
||||
ANSICHAR const* Func;
|
||||
};
|
||||
|
||||
inline
|
||||
void LogToFile(FString Message
|
||||
, ELogV Verbosity = ELogV::Log
|
||||
, bool DumpStack = false
|
||||
, FLogCategoryParam& Category = LogSaneSlate
|
||||
, int32 Line = __builtin_LINE()
|
||||
, ANSICHAR const* File = __builtin_FILE()
|
||||
, ANSICHAR const* Func = __builtin_FUNCTION() )
|
||||
{
|
||||
#if !UE_BUILD_SHIPPING && !NO_LOGGING
|
||||
ELogVerbosity::Type EngineVerbosity = (ELogVerbosity::Type) Verbosity;
|
||||
|
||||
static UE::Logging::Private::FStaticBasicLogDynamicData LOG_Dynamic;
|
||||
static UE::Logging::Private::FStaticBasicLogRecord
|
||||
LOG_Static(TEXT("%s -- %hs %hs(%d)"), File, Line, EngineVerbosity, LOG_Dynamic);
|
||||
|
||||
if ((EngineVerbosity & ELogVerbosity::VerbosityMask) <= ELogVerbosity::COMPILED_IN_MINIMUM_VERBOSITY)
|
||||
{
|
||||
if ((EngineVerbosity & ELogVerbosity::VerbosityMask) <= Category.GetVerbosity())
|
||||
{
|
||||
if ( ! Category.IsSuppressed(EngineVerbosity))
|
||||
{
|
||||
if (DumpStack)
|
||||
FDebug::DumpStackTraceToLog(EngineVerbosity);
|
||||
BasicLog(Category, &LOG_Static, *Message, File, Func, Line);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Log(FString Message
|
||||
, ELogV Verbosity = ELogV::Log
|
||||
, bool bToScreen = false
|
||||
, float TimeToDisplay = 5.f
|
||||
, FColor DisplayColor = FColor::Cyan
|
||||
, bool bDisplayNewerOnTop = true
|
||||
, uint64 ScreenMsgKey = -1
|
||||
, bool DumpStack = false
|
||||
, FLogCategoryParam& Category = LogSaneSlate
|
||||
, int32 Line = __builtin_LINE()
|
||||
, ANSICHAR const* File = __builtin_FILE()
|
||||
, ANSICHAR const* Func = __builtin_FUNCTION() );
|
||||
|
||||
SaneSlate_NS_END
|
||||
Reference in New Issue
Block a user