Skip to content

Commit cb18918

Browse files
committed
Revert "🧬 Bring me to life"
This reverts commit 5bf7ea0.
1 parent 5bf7ea0 commit cb18918

16 files changed

Lines changed: 29 additions & 192 deletions

File tree

‎Engine.sharpmake.cs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ public override void ConfigureWin64(Configuration conf, CommonTarget target)
185185

186186
conf.LibraryPaths.Add(Path.Combine("[project.SharpmakeCsPath]", $"ThirdParty/Lib/Assimp/{target.Optimization}"));
187187
conf.LibraryPaths.Add(Path.Combine("[project.SharpmakeCsPath]", $"ThirdParty/Lib/SDL/Win64/{CommonTarget.GetThirdPartyOptimization(target.Optimization)}"));
188-
conf.LibraryFiles.Add("winmm.lib");
189-
conf.LibraryFiles.Add("winhttp.lib");
190188

191189
// Ultralight UI
192190
if (Globals.IsUltralightEnabled)
@@ -298,8 +296,6 @@ public override void ConfigureUWP(Configuration conf, CommonTarget target)
298296

299297
conf.LibraryPaths.Add(Path.Combine("[project.SharpmakeCsPath]", $"ThirdParty/Lib/Assimp/{target.Optimization}"));
300298
conf.LibraryPaths.Add(Path.Combine("[project.SharpmakeCsPath]", $"ThirdParty/Lib/SDL/UWP/{CommonTarget.GetThirdPartyOptimization(target.Optimization)}"));
301-
conf.LibraryFiles.Add("winmm.lib");
302-
conf.LibraryFiles.Add("winhttp.lib");
303299

304300
// Ultralight UI
305301
if (Globals.IsUltralightEnabled)

‎Modules/Dementia/Source/CLog.h‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "Singleton.h"
66
#include <vector>
77
/*
8-
CLog.h
8+
Logger.h
99
A utility class for creating and managing logs for the engine. You can change the
1010
log file name and priority levels to control what info gets saved and where.
1111
*/
@@ -24,20 +24,6 @@ log file name and priority levels to control what info gets saved and where.
2424
":" + std::to_string(__LINE__) + \
2525
"]\n\t[" + __FUNCTION__ + "]\n\t", \
2626
__VA_ARGS__ )
27-
/// Info log
28-
#define INFO(category, message) \
29-
CLog::Log(CLog::LogType::Info, \
30-
std::string(category) + " [" + std::string(__FILE__).substr(std::string(__FILE__).find_last_of("/\\") + 1) + \
31-
":" + std::to_string(__LINE__) + "] " + message)
32-
33-
/// Info log with category
34-
#define INFO_FMT(category, formatStr, ...) \
35-
CLog::LogFmt(CLog::LogType::Info, \
36-
std::string(category) + " [" + \
37-
std::string(__FILE__).substr(std::string(__FILE__).find_last_of("/\\") + 1) + \
38-
":" + std::to_string(__LINE__) + "] " + formatStr, \
39-
__VA_ARGS__)
40-
4127

4228
class CLog
4329
{

‎Modules/Dementia/Source/File.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class File
3535
return Data;
3636
}
3737

38-
INFO_FMT("[File IO]", "Loaded File : %s", FilePath.GetLocalPathString().c_str() );
38+
// #TODO: Perhaps having the macro for this accepts a string view?
39+
CLog::Log( CLog::LogType::Info, "[File IO] Loaded File: " + FilePath.GetLocalPathString() );
3940

4041
IsOpen = true;
4142

‎Modules/Moonlight/Source/Graphics/Texture.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace Moonlight
9696
m_mips = imageContainer->m_numMips;
9797

9898
#if USING ( ME_DEBUG )
99-
//BRUH_FMT( "%i, %s", TexHandle.idx, compiledTexture.FullPath.c_str() );
99+
BRUH_FMT( "%i, %s", TexHandle.idx, compiledTexture.FullPath.c_str() );
100100
#endif
101101
return true;
102102
}

‎Modules/ScriptCore/ScriptCore.sharpmake.cs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.IO;
22
using Sharpmake;
3-
using static Sharpmake.Options;
43

54
[Generate]
65
public class ScriptCore : CSharpProject
@@ -34,11 +33,6 @@ public virtual void ConfigureAll(Configuration conf, CommonTarget target)
3433
CSharpProjectExtensions.AddAspNetReferences(conf);
3534
//conf.ReferencesByPath.Add(@"[project.SharpmakeCsPath]/Engine/Tools/Sharpmake/Sharpmake.dll");
3635
//conf.ReferencesByPath.Add(@"[project.SharpmakeCsPath]/Engine/Tools/Sharpmake/Sharpmake.Generators.dll");
37-
38-
conf.Options.Add(Options.CSharp.DebugSymbols.Enabled);
39-
conf.Options.Add(Options.CSharp.DebugType.Pdbonly);
40-
//conf.CustomAdditionalOptions.Add("/p:DebugType=portable");
41-
//conf.CustomAdditionalOptions.Add("/p:DebugSymbols=true");
4236
}
4337
}
4438

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
31

4-
public class MEObject
5-
{
6-
7-
}
8-
9-
public abstract class Component : MEObject
2+
public abstract class Component
103
{
114
public Entity Parent { get; internal set; }
12-
13-
public T GetComponent<T>() where T : Component, new()
14-
{
15-
if (Parent == null)
16-
{
17-
return null;
18-
}
19-
20-
return Parent.GetComponent<T>();
21-
}
22-
23-
public bool HasComponent<T>() where T : Component
24-
{
25-
if (Parent == null)
26-
{
27-
return false;
28-
}
29-
30-
return Parent.HasComponent<T>();
31-
}
325
}

‎Modules/ScriptCore/Source/Entity.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal Entity(EntityID inID)
2323
EntID = inID;
2424
}
2525

26-
public bool HasComponent<T>() where T : Component
26+
public bool HasComponent<T>() where T : Component, new()
2727
{
2828
Type type = typeof(T);
2929
return Entity_HasComponent(EntID, type);

‎Modules/ScriptCore/Source/Utils/ImGui.cs‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,24 @@ public static bool Begin(string Name)
99
return ImGui_Begin(Name);
1010
}
1111

12-
1312
[MethodImplAttribute(MethodImplOptions.InternalCall)]
1413
extern static void ImGui_End();
1514
public static void End()
1615
{
1716
ImGui_End();
1817
}
1918

20-
2119
[MethodImplAttribute(MethodImplOptions.InternalCall)]
2220
extern static void ImGui_Text(string inString);
2321
public static void Text(string inString)
2422
{
2523
ImGui_Text(inString);
2624
}
2725

28-
2926
[MethodImplAttribute(MethodImplOptions.InternalCall)]
3027
extern static void ImGui_Checkbox(string inString, ref bool inValue);
3128
public static void Checkbox(string inString, ref bool inValue)
3229
{
3330
ImGui_Checkbox(inString, ref inValue);
3431
}
35-
36-
37-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
38-
extern static bool ImGui_Button(string inString);
39-
public static bool Button(string inString)
40-
{
41-
return ImGui_Button(inString);
42-
}
4332
}

‎Modules/ScriptCore/Source/Utils/Web.cs‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎Source/Components/Scripting/ScriptComponent.cpp‎

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
#include "Components/Transform.h"
1313
#include "Components/Camera.h"
1414
#include "Engine/Engine.h"
15-
#include "Components/UI/BasicUIView.h"
16-
#include "Scripting/MonoUtils.h"
17-
#include <Web\HttpDownload.h>
18-
#include "File.h"
19-
#include <mono\metadata\appdomain.h>
20-
2115

2216
#if USING( ME_SCRIPTING )
2317
static std::unordered_map<MonoType*, std::function<bool( EntityHandle )>> s_EntityHasComponentFuncs;
@@ -38,10 +32,7 @@ static void RegisterComponent()
3832
YIKES( "Could not find component type {}" );
3933
return;
4034
}
41-
s_EntityHasComponentFuncs[managedType] = []( EntityHandle entity )
42-
{
43-
return entity->HasComponent<Component>();
44-
};
35+
s_EntityHasComponentFuncs[managedType] = []( EntityHandle entity ) { return entity->HasComponent<Component>(); };
4536
}( ), ... );
4637
}
4738
#endif
@@ -54,19 +45,14 @@ ScriptComponent::ScriptComponent()
5445
// Did you update your bgfx .hpp shaders at all??
5546
mono_add_internal_call( "Transform::Entity_GetTranslation", (void*)Transform_GetTranslation );
5647
mono_add_internal_call( "Transform::Entity_GetTranslation", (void*)Transform_GetTranslation );
57-
mono_add_internal_call( "Transform::Transform_GetScale", (void*)Transform_GetScale );
58-
mono_add_internal_call( "Transform::Transform_SetScale", (void*)Transform_SetScale );
5948
mono_add_internal_call( "Camera::Camera_GetClearColor", (void*)Camera_GetClearColor );
6049
mono_add_internal_call( "Camera::Camera_SetClearColor", (void*)Camera_SetClearColor );
6150
mono_add_internal_call( "Input::IsKeyDown", (void*)Input_IsKeyDown );
6251

6352
mono_add_internal_call( "Entity::Entity_HasComponent", (void*)Entity_HasComponent );
64-
mono_add_internal_call( "BasicUIView::BasicUIView_ExecuteJS", (void*)BasicUIView_ExecuteJS );
65-
mono_add_internal_call( "HTTP::HTTP_DownloadFile", (void*)HTTP_DownloadFile );
6653
// does this go into the other components?
6754
RegisterComponent<Transform>();
6855
RegisterComponent<Camera>();
69-
RegisterComponent<BasicUIView>();
7056
#endif
7157
}
7258

@@ -90,18 +76,15 @@ void ScriptComponent::Init()
9076
for( const auto& [name, fieldInstance] : fieldMap )
9177
{
9278
Instance->SetFieldValueInternal( name, (void*)fieldInstance.Buffer );
79+
ScriptName = foundClass->first;
80+
Instance->OnCreate();
9381
}
9482
}
95-
ScriptName = foundClass->first;
96-
97-
// Call OnCreate exactly ONCE after initialization:
98-
Instance->OnCreate();
9983
}
10084
}
10185
#endif
10286
}
10387

104-
10588
#if USING( ME_EDITOR )
10689

10790
void ScriptComponent::OnEditorInspect()
@@ -135,7 +118,6 @@ void ScriptComponent::OnEditorInspect()
135118
ImGui::Text( ScriptName.c_str() );
136119

137120
// Add a inspect settings option passed in
138-
// #TODO: questionable??
139121
if( true )//if ( static_cast<EditorApp*>( GetEngine().GetGame() )->IsGameRunning() )
140122
{
141123
ScriptClass& scriptClass = ScriptEngine::GetEntityClass( ScriptName );
@@ -310,18 +292,6 @@ void ScriptComponent::Transform_SetTranslation( EntityID id, Vector3* inPos )
310292
handle->GetComponent<Transform>().SetPosition( *inPos );
311293
}
312294

313-
void ScriptComponent::Transform_GetScale( EntityID id, Vector3* outPosition )
314-
{
315-
EntityHandle handle( id, ScriptEngine::sScriptData.worldPtr );
316-
*outPosition = handle->GetComponent<Transform>().GetScale();
317-
}
318-
319-
void ScriptComponent::Transform_SetScale( EntityID id, Vector3* inPos )
320-
{
321-
EntityHandle handle( id, ScriptEngine::sScriptData.worldPtr );
322-
handle->GetComponent<Transform>().SetScale( *inPos );
323-
}
324-
325295
void ScriptComponent::Camera_GetClearColor( EntityID id, Vector3* outPosition )
326296
{
327297
EntityHandle handle( id, ScriptEngine::sScriptData.worldPtr );
@@ -334,37 +304,8 @@ void ScriptComponent::Camera_SetClearColor( EntityID id, Vector3* inPos )
334304
handle->GetComponent<Camera>().ClearColor = *inPos;
335305
}
336306

337-
338-
void ScriptComponent::BasicUIView_ExecuteJS( EntityID id, MonoString* inString )
339-
{
340-
EntityHandle handle( id, ScriptEngine::sScriptData.worldPtr );
341-
if( handle )
342-
{
343-
handle->GetComponent<BasicUIView>().ExecuteScript( MonoUtils::MonoStringToUTF8( inString ) );
344-
}
345-
}
346-
347-
348-
MonoString* ScriptComponent::HTTP_DownloadFile( MonoString* inURL, MonoString* inDirectory )
349-
{
350-
char* str = mono_string_to_utf8( inURL );
351-
char* inDirectoryMono = mono_string_to_utf8( inDirectory );
352-
Path outPath = Path( inDirectoryMono );
353-
if( Web::DownloadFile( str, outPath ) )
354-
{
355-
return mono_string_new( mono_domain_get(), File( outPath ).Read().c_str() );
356-
}
357-
return nullptr;
358-
}
359-
360-
361307
bool ScriptComponent::Entity_HasComponent( EntityID id, MonoReflectionType* inType )
362308
{
363-
if( id.IsNull() )
364-
{
365-
return false;
366-
}
367-
368309
EntityHandle handle( id, ScriptEngine::sScriptData.worldPtr );
369310

370311
MonoType* managedType = mono_reflection_type_get_type( inType );

0 commit comments

Comments
 (0)