mirror of
https://github.com/antopilo/Nuake.git
synced 2026-01-06 06:09:52 +03:00
Updated Coral version to .Net 8
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "Jolt/Jolt.h"
|
#include "Jolt/Jolt.h"
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
namespace JPH
|
namespace JPH
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace Nuake {
|
namespace Nuake {
|
||||||
|
|
||||||
void Log(Coral::NativeString string)
|
void Log(Coral::String string)
|
||||||
{
|
{
|
||||||
Logger::Log(string.ToString(), ".net", VERBOSE);
|
Logger::Log(string, ".net", VERBOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineNetAPI::RegisterMethods()
|
void EngineNetAPI::RegisterMethods()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "src/Core/Input.h"
|
#include "src/Core/Input.h"
|
||||||
|
|
||||||
#include <Coral/NativeArray.hpp>
|
#include <Coral/Array.hpp>
|
||||||
|
|
||||||
namespace Nuake {
|
namespace Nuake {
|
||||||
|
|
||||||
@@ -28,10 +28,10 @@ namespace Nuake {
|
|||||||
return Input::IsKeyPressed(keyCode);
|
return Input::IsKeyPressed(keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Coral::NativeArray<float> GetMousePosition()
|
Coral::Array<float> GetMousePosition()
|
||||||
{
|
{
|
||||||
Vector2 mousePosition = Input::GetMousePosition();
|
Vector2 mousePosition = Input::GetMousePosition();
|
||||||
return { mousePosition.x, mousePosition.y};
|
return Coral::Array<float>::New({ mousePosition.x, mousePosition.y });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "src/Core/Core.h"
|
#include "src/Core/Core.h"
|
||||||
#include "src/Core/Logger.h"
|
#include "src/Core/Logger.h"
|
||||||
|
|
||||||
#include <Coral/NativeString.hpp>
|
#include <Coral/String.hpp>
|
||||||
|
|
||||||
namespace Nuake {
|
namespace Nuake {
|
||||||
|
|
||||||
|
|||||||
@@ -22,22 +22,20 @@
|
|||||||
|
|
||||||
#include "src/Physics/PhysicsManager.h"
|
#include "src/Physics/PhysicsManager.h"
|
||||||
|
|
||||||
#include <Coral/NativeArray.hpp>
|
#include <Coral/Array.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace Nuake {
|
namespace Nuake {
|
||||||
|
|
||||||
uint32_t GetEntity(Coral::NativeString entityName)
|
uint32_t GetEntity(Coral::String entityName)
|
||||||
{
|
{
|
||||||
auto scene = Engine::GetCurrentScene();
|
auto scene = Engine::GetCurrentScene();
|
||||||
|
if (!scene->EntityExists(entityName))
|
||||||
std::string entityNameString = entityName.ToString();
|
|
||||||
if (!scene->EntityExists(entityNameString))
|
|
||||||
{
|
{
|
||||||
return UINT32_MAX; // Error code: entity not found.
|
return UINT32_MAX; // Error code: entity not found.
|
||||||
}
|
}
|
||||||
|
|
||||||
return scene->GetEntity(entityNameString).GetHandle();
|
return scene->GetEntity(entityName).GetHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum ComponentTypes
|
static enum ComponentTypes
|
||||||
@@ -120,7 +118,7 @@ namespace Nuake {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Coral::NativeArray<float> TransformGetGlobalPosition(int entityId)
|
Coral::Array<float> TransformGetGlobalPosition(int entityId)
|
||||||
{
|
{
|
||||||
Entity entity = { (entt::entity)(entityId), Engine::GetCurrentScene().get() };
|
Entity entity = { (entt::entity)(entityId), Engine::GetCurrentScene().get() };
|
||||||
|
|
||||||
@@ -128,7 +126,7 @@ namespace Nuake {
|
|||||||
{
|
{
|
||||||
auto& component = entity.GetComponent<TransformComponent>();
|
auto& component = entity.GetComponent<TransformComponent>();
|
||||||
const auto& globalPosition = component.GetGlobalPosition();
|
const auto& globalPosition = component.GetGlobalPosition();
|
||||||
Coral::NativeArray<float> result = { globalPosition.x, globalPosition.y, globalPosition.z };
|
Coral::Array<float> result = Coral::Array<float>::New({ globalPosition.x, globalPosition.y, globalPosition.z });
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +143,7 @@ namespace Nuake {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Coral::NativeArray<float> CameraGetDirection(int entityId)
|
Coral::Array<float> CameraGetDirection(int entityId)
|
||||||
{
|
{
|
||||||
Entity entity = { (entt::entity)(entityId), Engine::GetCurrentScene().get() };
|
Entity entity = { (entt::entity)(entityId), Engine::GetCurrentScene().get() };
|
||||||
|
|
||||||
@@ -153,7 +151,7 @@ namespace Nuake {
|
|||||||
{
|
{
|
||||||
auto& component = entity.GetComponent<CameraComponent>();
|
auto& component = entity.GetComponent<CameraComponent>();
|
||||||
const Vector3 camDirection = component.CameraInstance->GetDirection();
|
const Vector3 camDirection = component.CameraInstance->GetDirection();
|
||||||
return { camDirection.x, camDirection.y, camDirection.z };
|
return Coral::Array<float>::New({ camDirection.x, camDirection.y, camDirection.z });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +185,7 @@ namespace Nuake {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Play(int entityId, Coral::NativeString animation)
|
void Play(int entityId, Coral::String animation)
|
||||||
{
|
{
|
||||||
Entity entity = Entity((entt::entity)(entityId), Engine::GetCurrentScene().get());
|
Entity entity = Entity((entt::entity)(entityId), Engine::GetCurrentScene().get());
|
||||||
|
|
||||||
@@ -203,7 +201,7 @@ namespace Nuake {
|
|||||||
int animIndex = 0;
|
int animIndex = 0;
|
||||||
for (const auto& anim : model->GetAnimations())
|
for (const auto& anim : model->GetAnimations())
|
||||||
{
|
{
|
||||||
if (anim->GetName() == animation.ToString())
|
if (anim->GetName() == animation)
|
||||||
{
|
{
|
||||||
model->PlayAnimation(animIndex);
|
model->PlayAnimation(animIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <Coral/HostInstance.hpp>
|
#include <Coral/HostInstance.hpp>
|
||||||
#include <Coral/GC.hpp>
|
#include <Coral/GC.hpp>
|
||||||
#include <Coral/NativeArray.hpp>
|
#include <Coral/Array.hpp>
|
||||||
#include <Coral/Attribute.hpp>
|
#include <Coral/Attribute.hpp>
|
||||||
|
|
||||||
|
|
||||||
@@ -130,13 +130,15 @@ namespace Nuake
|
|||||||
|
|
||||||
for (auto& type : m_GameAssembly.GetTypes())
|
for (auto& type : m_GameAssembly.GetTypes())
|
||||||
{
|
{
|
||||||
Logger::Log(std::string("Detected type: ") + std::string(type->GetName()), ".net");
|
Logger::Log(std::string("Detected type: ") + std::string(type->GetFullName()), ".net");
|
||||||
Logger::Log(std::string("Detected base type: ") + std::string(type->GetBaseType().GetName()), ".net");
|
Logger::Log(std::string("Detected base type: ") + std::string(type->GetBaseType().GetFullName()), ".net");
|
||||||
|
|
||||||
const std::string baseTypeName = std::string(type->GetBaseType().GetName());
|
const std::string baseTypeName = std::string(type->GetBaseType().GetFullName());
|
||||||
if (baseTypeName == "Entity")
|
if (baseTypeName == "Nuake.Net.Entity")
|
||||||
{
|
{
|
||||||
m_GameEntityTypes[std::string(type->GetName())] = type; // We have found an entity script.
|
auto typeSplits = String::Split(type->GetFullName(), '.');
|
||||||
|
std::string shortenedTypeName = typeSplits[typeSplits.size() - 1];
|
||||||
|
m_GameEntityTypes[shortenedTypeName] = type; // We have found an entity script.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +200,6 @@ namespace Nuake
|
|||||||
size_t classNameLength = semiColonPos - classNameStartIndex;
|
size_t classNameLength = semiColonPos - classNameStartIndex;
|
||||||
|
|
||||||
const std::string className = fileContent.substr(classNameStartIndex, classNameLength);
|
const std::string className = fileContent.substr(classNameStartIndex, classNameLength);
|
||||||
|
|
||||||
if(m_GameEntityTypes.find(className) == m_GameEntityTypes.end())
|
if(m_GameEntityTypes.find(className) == m_GameEntityTypes.end())
|
||||||
{
|
{
|
||||||
// The class name parsed in the file was not found in the game's DLL.
|
// The class name parsed in the file was not found in the game's DLL.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
project "NuakeNet"
|
project "NuakeNet"
|
||||||
language "C#"
|
language "C#"
|
||||||
dotnetframework "net7.0"
|
dotnetframework "net8.0"
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
clr "Unsafe"
|
clr "Unsafe"
|
||||||
|
|
||||||
|
|||||||
22
premake5.lua
22
premake5.lua
@@ -180,7 +180,7 @@ project "NuakeRuntime"
|
|||||||
"%{prj.name}/../Nuake/src/Vendors/wren/src/include",
|
"%{prj.name}/../Nuake/src/Vendors/wren/src/include",
|
||||||
"%{prj.name}/../Nuake/dependencies/JoltPhysics/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}/JoltPhysics/",
|
"%{prj.name}/../Nuake/dependencies/JoltPhysics/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}/JoltPhysics/",
|
||||||
"%{prj.name}/../Nuake/dependencies/soloud/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}",
|
"%{prj.name}/../Nuake/dependencies/soloud/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}",
|
||||||
"%{prj.name}/../Nuake/dependencies/Coral/NetCore/7.0.7/"
|
"%{prj.name}/../Nuake/dependencies/Coral/NetCore/"
|
||||||
}
|
}
|
||||||
|
|
||||||
links
|
links
|
||||||
@@ -193,8 +193,6 @@ project "NuakeRuntime"
|
|||||||
"JoltPhysics",
|
"JoltPhysics",
|
||||||
"soloud",
|
"soloud",
|
||||||
"Coral.Native",
|
"Coral.Native",
|
||||||
"nethost",
|
|
||||||
"libnethost"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filter "system:windows"
|
filter "system:windows"
|
||||||
@@ -211,11 +209,7 @@ project "NuakeRuntime"
|
|||||||
externalincludedirs { "%{prj.name}/../Nuake/dependencies/Coral/Coral.Native/Include/" }
|
externalincludedirs { "%{prj.name}/../Nuake/dependencies/Coral/Coral.Native/Include/" }
|
||||||
|
|
||||||
postbuildcommands {
|
postbuildcommands {
|
||||||
'{ECHO} Copying "%{wks.location}/NetCore/7.0.7/nethost.dll" to "%{cfg.targetdir}"',
|
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/Coral.Managed/Coral.Managed.runtimeconfig.json" "%{wks.location}/%{prj.name}"'
|
||||||
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/NetCore/7.0.7/nethost.dll" "%{cfg.targetdir}"',
|
|
||||||
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/Coral.Managed/Coral.Managed.runtimeconfig.json" "%{wks.location}/%{prj.name}"',
|
|
||||||
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/Coral.Managed/Build/%{cfg.buildcfg}-%{cfg.system}/Coral.Managed.dll" "%{wks.location}/%{prj.name}"',
|
|
||||||
'{COPYFILE} "%{wks.location}/NuakeNet/bin/%{cfg.buildcfg}/NuakeNet.dll" "%{wks.location}/%{prj.name}"'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filter "system:linux"
|
filter "system:linux"
|
||||||
@@ -318,7 +312,7 @@ project "Editor"
|
|||||||
"%{prj.name}/../Nuake/src/Vendors/wren/src/include",
|
"%{prj.name}/../Nuake/src/Vendors/wren/src/include",
|
||||||
"%{prj.name}/../Nuake/dependencies/JoltPhysics/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}/JoltPhysics/",
|
"%{prj.name}/../Nuake/dependencies/JoltPhysics/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}/JoltPhysics/",
|
||||||
"%{prj.name}/../Nuake/dependencies/soloud/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}",
|
"%{prj.name}/../Nuake/dependencies/soloud/bin/%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}",
|
||||||
"%{prj.name}/../Nuake/dependencies/Coral/NetCore/7.0.7/"
|
"%{prj.name}/../Nuake/dependencies/Coral/NetCore/"
|
||||||
}
|
}
|
||||||
|
|
||||||
links
|
links
|
||||||
@@ -330,9 +324,7 @@ project "Editor"
|
|||||||
"Freetype",
|
"Freetype",
|
||||||
"JoltPhysics",
|
"JoltPhysics",
|
||||||
"soloud",
|
"soloud",
|
||||||
"Coral.Native",
|
"Coral.Native"
|
||||||
"nethost",
|
|
||||||
"libnethost"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filter "system:Windows"
|
filter "system:Windows"
|
||||||
@@ -353,11 +345,7 @@ project "Editor"
|
|||||||
externalincludedirs { "%{prj.name}/../Nuake/dependencies/Coral/Coral.Native/Include/" }
|
externalincludedirs { "%{prj.name}/../Nuake/dependencies/Coral/Coral.Native/Include/" }
|
||||||
|
|
||||||
postbuildcommands {
|
postbuildcommands {
|
||||||
'{ECHO} Copying "%{wks.location}/NetCore/7.0.7/nethost.dll" to "%{cfg.targetdir}"',
|
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/Coral.Managed/Coral.Managed.runtimeconfig.json" "%{wks.location}/%{prj.name}"'
|
||||||
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/NetCore/7.0.7/nethost.dll" "%{cfg.targetdir}"',
|
|
||||||
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/Coral.Managed/Coral.Managed.runtimeconfig.json" "%{wks.location}/%{prj.name}"',
|
|
||||||
'{COPYFILE} "%{wks.location}/Nuake/dependencies/Coral/Coral.Managed/Build/%{cfg.buildcfg}-%{cfg.system}/Coral.Managed.dll" "%{wks.location}/%{prj.name}"',
|
|
||||||
'{COPYFILE} "%{wks.location}/NuakeNet/bin/%{cfg.buildcfg}/NuakeNet.dll" "%{wks.location}/%{prj.name}"'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user