mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
React test
This commit is contained in:
@@ -4,7 +4,8 @@ namespace GlitchyEditor.Ultralight;
|
||||
|
||||
class UltralightEntityHierarchyWindow : UltralightWindow
|
||||
{
|
||||
public this() : base("Entity Hierarchy", "file:///pages/EntityHierarchy.html")
|
||||
public this() : base("Entity Hierarchy", "file:///react-ui-prototype/dist/index.html")
|
||||
//public this() : base("Entity Hierarchy", "file:///another-react-test/index.html")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ abstract class UltralightWindow
|
||||
|
||||
ulViewSetDOMReadyCallback(_view, => OnDOMReady, userData);
|
||||
ulViewSetFailLoadingCallback(_view, => OnFailedLoading, userData);
|
||||
|
||||
ulViewSetAddConsoleMessageCallback(_view, => OnAddConsoleMessage, userData);
|
||||
}
|
||||
|
||||
#endregion Init
|
||||
@@ -273,5 +275,36 @@ abstract class UltralightWindow
|
||||
Log.EngineLogger.Error("Error while loading view.");
|
||||
}
|
||||
|
||||
private static void OnAddConsoleMessage(void* user_data, C_View* caller, ULMessageSource source, ULMessageLevel level, C_String* message, uint32 line_number, uint32 column_number, C_String* source_id)
|
||||
{
|
||||
UltralightWindow window = (UltralightWindow)Internal.UnsafeCastToObject(user_data);
|
||||
window.OnAddConsoleMessage(caller, source, level, message, line_number, column_number, source_id);
|
||||
}
|
||||
|
||||
protected virtual void OnAddConsoleMessage(C_View* caller, ULMessageSource source, ULMessageLevel level, C_String* message, uint32 line_number, uint32 column_number, C_String* source_id)
|
||||
{
|
||||
GlitchLog.LogLevel logLevel = .Info;
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case .kMessageLevel_Debug:
|
||||
logLevel = .Debug;
|
||||
case .kMessageLevel_Info:
|
||||
logLevel = .Info;
|
||||
case .kMessageLevel_Warning:
|
||||
logLevel = .Warning;
|
||||
case .kMessageLevel_Error:
|
||||
logLevel = .Error;
|
||||
default:
|
||||
logLevel = .Info;
|
||||
}
|
||||
|
||||
StringView messageView = .(ulStringGetData(message), ulStringGetLength(message));
|
||||
StringView sourceIdView = .(ulStringGetData(source_id), ulStringGetLength(source_id));
|
||||
String prettyMessage = scope $"Ultralight ({source}) from \"{sourceIdView}\" in Line: {line_number}, Column: {column_number}. Message: {messageView}";
|
||||
|
||||
Log.ClientLogger.Log(logLevel, prettyMessage);
|
||||
}
|
||||
|
||||
#endregion Ultralight Callbacks
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ class UltralightLayer : Layer
|
||||
{
|
||||
ULConfig config = ulCreateConfig();
|
||||
|
||||
ULString logPath = ulCreateString(@"D:\Development\Projects\Beef\GlitchyEngine\GlitchyEditor\ul.log");
|
||||
ulEnableDefaultLogger(logPath);
|
||||
ulDestroyString(logPath);
|
||||
|
||||
ulEnablePlatformFontLoader();
|
||||
|
||||
ULString fileSystemPath = ulCreateString(@"D:\Development\Projects\Beef\GlitchyEngine\GlitchyEditor\assets");
|
||||
|
||||
Reference in New Issue
Block a user