This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "precompile/precompiled.h" | |
#include "HorizonLog.h" | |
#include <Windows.h> | |
#include <tchar.h> | |
namespace horizon{ | |
void logMessageImplementInternal(const std::string& msg){ | |
WCHAR wszBuf[HORIZON_LOG_MAX_LEN] = { 0 }; | |
MultiByteToWideChar(CP_UTF8, 0, msg.c_str(), -1, wszBuf, sizeof(wszBuf)); | |
OutputDebugStringW(wszBuf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class HorizonDevNull | |
{ | |
} horizon_dev_null; | |
//BOOST_LOG_FUNCTION() | |
//BOOST_LOG_FUNCTION() | |
#define HORIZON_LOG_FUNCTION " [" << __FILE__ << "(" << __LINE__ << ")" << ": " << BOOST_CURRENT_FUNCTION << "] " | |
#if defined(NDEBUG) || defined(_NDEBUG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace logging = boost::log; | |
namespace attrs = boost::log::attributes; | |
namespace src = boost::log::sources; | |
namespace sinks = boost::log::sinks; | |
namespace expr = boost::log::expressions; | |
namespace keywords = boost::log::keywords; | |
void HorizonCore::initDefaultLog(const std::string& fileLogFullPath, | |
horizon::HorizonLogImpFunc_t&& logFunc, | |
boost::log::trivial::severity_level logFilterLevel, | |
boost::log::trivial::severity_level fileLogFilterLevel){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void logMessageImplement(const std::string& msg) { | |
FString str = UTF8_TO_TCHAR(msg.c_str()); | |
UE_LOG(LogTemp, Log, TEXT("%s"), *str); | |
// FPlatformMisc::LowLevelOutputDebugString(TEXT("HorizonLogBasicBackend test")); | |
//FPlatformMisc::LowLevelOutputDebugString(UTF8_TO_TCHAR(msg.c_str())); | |
} | |
FString savedPath = FPaths::ConvertRelativePathToFull(FPaths::GameLogDir()); | |
std::string logFilePath = std::string(TCHAR_TO_UTF8(*savedPath)) + "HorizonLog.txt"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define HORIZON_LOG_BUFFER_LEN 4*1024 //4KB | |
using HorizonLogImpFunc_t = std::function<void(const std::string&)>; | |
class HorizonLogBasicFormatedBackend : public boost::log::sinks::basic_formatted_sink_backend < char > { | |
public: | |
void consume(const boost::log::record_view& rec, string_type const& msg); | |
inline void setLogMessageImplemen(HorizonLogImpFunc_t&& impl) { logMessageImplement = std::move(impl); }; | |
private: | |
void logMessage(const boost::log::record_view& rec, const std::string& msg); | |
private: | |
HorizonLogImpFunc_t logMessageImplement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HorizonLogBasicFormatedBackend : public boost::log::sinks::basic_formatted_sink_backend < char > { | |
public: | |
void consume(const boost::log::record_view& rec, string_type const& msg); | |
inline void setLogMessageImplemen(HorizonLogImpFunc_t&& impl) { logMessageImplement = std::move(impl); }; | |
private: | |
void logMessage(const boost::log::record_view& rec, const std::string& msg); | |
private: | |
HorizonLogImpFunc_t logMessageImplement; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if PLATFORM_WINDOWS | |
#include "windows/WindowsWindow.h" | |
#include "SharedPointer.h" | |
#endif //PLATFORM_WINDOWS | |
#include "AllowWindowsPlatformTypes.h" | |
void AHopePlayerController::AdjustWindow() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AMyPlayerController::AMyPlayerController() | |
{ | |
ConstructorHelpers::FClassFinder<UUserWidget> PutNameHere(TEXT("/Game/UMG/NewWidgetBlueprint")); | |
if (PutNameHere.Class) { | |
UserWidgetClass = PutNameHere.Class; | |
} | |
} | |
void AMyPlayerController::BeginPlay() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
FStringAssetReference testAssetRef = "/Game/UMG/NewWidgetBlueprint"; | |
UObject* pObject = testAssetRef.TryLoad(); | |
UWidgetBlueprint* pWidgetBlueprint = Cast<UWidgetBlueprint>(pObject); | |
auto widget = CreateWidget<UUserWidget>(this, pWidgetBlueprint->GeneratedClass); | |
// do something | |
//widget->AddToViewport(); | |
FString pathName1 = FPackageName::LongPackageNameToFilename(pObject->GetPathName(), FPackageName::GetAssetPackageExtension()); | |
FString pathName2 = FPackageName::LongPackageNameToFilename(pObject->GetOutermost()->GetPathName(), FPackageName::GetAssetPackageExtension()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- ContentRootToPath Num=10 TArray<FPathPair,FDefaultAllocator> | |
+ [0] {RootPath=L"/Paper2D/" ContentPath=L"../../../Engine/Plugins/2D/Paper2D/Content/" } FPathPair | |
+ [1] {RootPath=L"/Engine/" ContentPath=L"../../../Engine/Content/" } FPathPair | |
+ [2] {RootPath=L"/Engine/" ContentPath=L"../../../Engine/Shaders/" } FPathPair | |
+ [3] {RootPath=L"/Game/" ContentPath=L"C:/Users/Dorgon/Documents/Unreal Projects/MyProject/Content/" } FPathPair | |
+ [4] {RootPath=L"/Script/" ContentPath=L"C:/Users/Dorgon/Documents/Unreal Projects/MyProject/Script/" } FPathPair | |
+ [5] {RootPath=L"/Temp/" ContentPath=L"C:/Users/Dorgon/Documents/Unreal Projects/MyProject/Saved/" } FPathPair | |
+ [6] {RootPath=L"/Game/" ContentPath=L"../../../MyProject/Content/" } FPathPair | |
+ [7] {RootPath=L"/Script/" ContentPath=L"../../../MyProject/Script/" } FPathPair | |
+ [8] {RootPath=L"/Temp/" ContentPath=L"../../../MyProject/Saved/" } FPathPair |
OlderNewer