Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/NovelRT.Interop/Ecs/Audio/NrtEcsAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
#include "NrtAudioEmitterComponent.h"
#include "NrtAudioEmitterStateComponent.h"
#include "NrtAudioSystem.h"
#include "NrtEcsAudioComponents.h"

#endif // NOVELRT_INTEROP_ECS_AUDIO_H
21 changes: 21 additions & 0 deletions include/NovelRT.Interop/Ecs/Audio/NrtEcsAudioComponents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_AUDIO_ECSAUDIOCOMPONENTS_H
#define NOVELRT_INTEROP_ECS_AUDIO_ECSAUDIOCOMPONENTS_H

#include "../../NrtTypedefs.h"

#ifdef __cplusplus
extern "C"
{
#endif

NrtAtom Nrt_Components_GetAudioEmitterComponentId();
NrtAtom Nrt_Components_GetAudioEmitterStateComponentId();

#ifdef __cplusplus
}
#endif

#endif // NOVELRT_INTEROP_ECS_AUDIO_ECSAUDIOCOMPONENTS_H
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_GRAPHICS_NRTDEFAULTRENDERINGSYSTEM_H
#define NOVELRT_INTEROP_ECS_GRAPHICS_NRTDEFAULTRENDERINGSYSTEM_H
#ifndef NOVELRT_INTEROP_ECS_GRAPHICS_DEFAULTRENDERINGSYSTEM_H
#define NOVELRT_INTEROP_ECS_GRAPHICS_DEFAULTRENDERINGSYSTEM_H

#include "../../NrtTypedefs.h"

Expand All @@ -16,10 +16,40 @@ extern "C"

NrtResult Nrt_DefaultRenderingSystem_ForceVertexTextureFutureResolution(NrtDefaultRenderingSystemHandle system);

// TODO: Implement GetOrLoadTexture, CreateSpriteEntity and CreateSpriteEntityOutsideOfSystem
NrtResult Nrt_DefaultRenderingSystem_GetOrLoadTexture(NrtDefaultRenderingSystemHandle system,
const char* textureName,
NrtFutureResultOfTextureInfoHandle* outputTextureFuture);

NrtResult Nrt_DefaultRenderingSystem_GetExistingTextureById(NrtDefaultRenderingSystemHandle system,
NrtAtom id,
NrtTextureInfoHandle* outputTexture);

NrtResult Nrt_DefaultRenderingSystem_GetExistingTextureByName(NrtDefaultRenderingSystemHandle system,
const char* name,
NrtTextureInfoHandle* outputTexture);

// Even after calling a DeleteTexture method, TextureInfo_Destroy still
// needs to be called by the user once done with it!

NrtResult Nrt_DefaultRenderingSystem_DeleteTextureByHandle(NrtDefaultRenderingSystemHandle system,
NrtTextureInfoHandle texture);

NrtResult Nrt_DefaultRenderingSystem_DeleteTextureByName(NrtDefaultRenderingSystemHandle system, const char* name);

NrtResult Nrt_DefaultRenderingSystem_DeleteTextureById(NrtDefaultRenderingSystemHandle system, NrtAtom id);

NrtResult Nrt_DefaultRenderingSystem_CreateSpriteEntity(NrtDefaultRenderingSystemHandle system,
NrtTextureInfoHandle texture,
NrtCatalogueHandle catalogue,
NrtEntityId* outputEntityId);

NrtResult Nrt_DefaultRenderingSystem_CreateSpriteEntityOutsideOfSystem(NrtDefaultRenderingSystemHandle system,
NrtTextureInfoHandle texture,
NrtSystemSchedulerHandle scheduler,
NrtEntityId* outputEntityId);

#ifdef __cplusplus
}
#endif

#endif // NOVELRT_INTEROP_ECS_GRAPHICS_NRTDEFAULTRENDERINGSYSTEM_H
#endif // NOVELRT_INTEROP_ECS_GRAPHICS_DEFAULTRENDERINGSYSTEM_H
2 changes: 2 additions & 0 deletions include/NovelRT.Interop/Ecs/Graphics/NrtEcsGraphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
#define NOVELRT_INTEROP_ECS_GRAPHICS_NRTECSGRAPHICS_H

#include "NrtDefaultRenderingSystem.h"
#include "NrtEcsGraphicsComponents.h"
#include "NrtTextureInfo.h"

#endif // NOVELRT_INTEROP_ECS_GRAPHICS_NRTECSGRAPHICS_H
21 changes: 21 additions & 0 deletions include/NovelRT.Interop/Ecs/Graphics/NrtEcsGraphicsComponents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_GRAPHICS_ECSGRAPHICSCOMPONENTS_H
#define NOVELRT_INTEROP_ECS_GRAPHICS_ECSGRAPHICSCOMPONENTS_H

#include "../../NrtTypedefs.h"

#ifdef __cplusplus
extern "C"
{
#endif

NrtAtom Nrt_Components_GetRenderComponentTypeId();

#ifdef __cplusplus
}
#endif


#endif // NOVELRT_INTEROP_ECS_GRAPHICS_ECSGRAPHICSCOMPONENTS_H
11 changes: 11 additions & 0 deletions include/NovelRT.Interop/Ecs/Graphics/NrtEcsGraphicsTypedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ extern "C"

typedef struct NrtDefaultRenderingSystem* NrtDefaultRenderingSystemHandle;

// Component types

typedef struct {
NrtAtom vertexDataId;
NrtAtom textureId;
NrtAtom pipelineId;
NrtAtom primitiveInfoId;
bool requiresCustomRendering;
bool markedForDeletion;
} NrtRenderComponent;

#ifdef __cplusplus
}
#endif
Expand Down
30 changes: 30 additions & 0 deletions include/NovelRT.Interop/Ecs/Graphics/NrtTextureInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_GRAPHICS_TEXTUREINFO_H
#define NOVELRT_INTEROP_ECS_GRAPHICS_TEXTUREINFO_H

#include "../../NrtTypedefs.h"

#ifdef __cplusplus
extern "C"
{
#endif

NrtResult Nrt_TextureInfo_Destroy(NrtTextureInfoHandle texture);

char* Nrt_TextureInfo_GetTextureName(NrtTextureInfoHandle texture);

uint32_t Nrt_TextureInfo_GetTextureWidth(NrtTextureInfoHandle texture);

uint32_t Nrt_TextureInfo_GetTextureHeight(NrtTextureInfoHandle texture);

NrtAtom Nrt_TextureInfo_GetEcsId(NrtTextureInfoHandle texture);

NrtBool Nrt_TextureInfo_Equals(NrtTextureInfoHandle lhs, NrtTextureInfoHandle rhs);

#ifdef __cplusplus
}
#endif

#endif // NOVELRT_INTEROP_ECS_GRAPHICS_TEXTUREINFO_H
10 changes: 10 additions & 0 deletions include/NovelRT.Interop/Ecs/Input/NrtEcsInput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_INPUT_ECSINPUT_H
#define NOVELRT_INTEROP_ECS_INPUT_ECSINPUT_H

#include "NrtEcsInputComponents.h"
#include "NrtEcsInputTypedefs.h"

#endif // NOVELRT_INTEROP_ECS_INPUT_ECSINPUT_H
20 changes: 20 additions & 0 deletions include/NovelRT.Interop/Ecs/Input/NrtEcsInputComponents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_INPUT_ECSINPUTCOMPONENTS_H
#define NOVELRT_INTEROP_ECS_INPUT_ECSINPUTCOMPONENTS_H

#include "../../NrtTypedefs.h"

#ifdef __cplusplus
extern "C"
{
#endif

NrtAtom Nrt_Components_GetInputEventComponentTypeId();

#ifdef __cplusplus
}
#endif

#endif // NOVELRT_INTEROP_ECS_INPUT_ECSINPUTCOMPONENTS_H
34 changes: 34 additions & 0 deletions include/NovelRT.Interop/Ecs/Input/NrtEcsInputTypedefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_INPUT_NRTECSINPUTTYPEDEFS_H
#define NOVELRT_INTEROP_ECS_INPUT_NRTECSINPUTTYPEDEFS_H

#include "../../NrtTypedefs.h"

#ifdef __cplusplus
extern "C"
{
#endif

// Components
// Note that int32_t is used instead of NrtKeyState, as, in C,
// enums are *not* guaranteed to be exactly the size of an int.
// Even though it is in 99.99% of the cases due to system ABI,
// we better enforce the size given by the C++ NovelRT API.
// See KeyState definition:
// enum class KeyState : int32_t <---

typedef struct {
NrtAtom actionId;
// Uses the NrtKeyState enum.
int32_t state;
float mousePositionX;
float mousePositionY;
} NrtInputEventComponent;

#ifdef __cplusplus
}
#endif

#endif // NOVELRT_INTEROP_ECS_INPUT_NRTECSINPUTTYPEDEFS_H
1 change: 1 addition & 0 deletions include/NovelRT.Interop/Ecs/NrtEcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "NrtComponentCache.h"
#include "NrtConfigurator.h"
#include "NrtEntityCache.h"
#include "NrtEcsComponents.h"
#include "NrtEntityIdVector.h"
#include "NrtSparseSetMemoryContainer.h"
#include "NrtSystemScheduler.h"
Expand Down
23 changes: 23 additions & 0 deletions include/NovelRT.Interop/Ecs/NrtEcsComponents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_ECS_ECSCOMPONENTS_H
#define NOVELRT_INTEROP_ECS_ECSCOMPONENTS_H

#include "../NrtTypedefs.h"

#ifdef __cplusplus
extern "C"
{
#endif

NrtAtom Nrt_Components_GetTransformComponentTypeId();
NrtAtom Nrt_Components_GetEntityGraphComponentTypeId();
NrtAtom Nrt_Components_LinkedEntityListNodeComponentTypeId();

#ifdef __cplusplus
}
#endif


#endif // NOVELRT_INTEROP_ECS_ECSCOMPONENTS_H
28 changes: 28 additions & 0 deletions include/NovelRT.Interop/Ecs/NrtEcsTypedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,34 @@ extern "C"
typedef NrtAtom NrtEntityId;
typedef NrtAtom NrtComponentTypeId;

// Default components, equivalents in C structs
// When a component is modified in DefaultComponentTypes.h,
// it must also be updated there.

// Note that we do not use the NrtBool type,
// as it doesn't have the same as a standard C/C++ bool.

typedef struct
{
NrtGeoVector3F positionAndLayer;
NrtGeoVector2F scale;
float rotationInRadians;
} NrtTransformComponent;

typedef struct
{
bool isValid;
NrtEntityId parent;
NrtEntityId childrenStartNode;
} NrtEntityGraphComponent;

typedef struct
{
bool isValid;
NrtEntityId parent;
NrtEntityId childrenStartNode;
} NrtLinkedEntityListNodeComponent;

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions include/NovelRT.Interop/Graphics/NrtGraphicsTypedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ extern "C"

typedef struct NrtGraphicsProvider* NrtGraphicsProviderHandle;

typedef struct NrtTextureInfo* NrtTextureInfoHandle;

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions include/NovelRT.Interop/NrtTypedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ extern "C"
#include "Audio/NrtAudioTypedefs.h"
#include "Ecs/Audio/NrtEcsAudioTypedefs.h"
#include "Ecs/Graphics/NrtEcsGraphicsTypedefs.h"
#include "Ecs/Input/NrtEcsInputTypedefs.h"
#include "Ecs/NrtEcsTypedefs.h"
#include "Graphics/NrtGraphicsTypedefs.h"
#include "Input/NrtInputTypedefs.h"
#include "PluginManagement/NrtPluginManagementTypedefs.h"
#include "ResourceManagement/NrtResourceManagementTypedefs.h"
#include "SceneGraph/NrtSceneGraphTypedefs.h"
#include "Windowing/NrtWindowingTypedefs.h"
#include "Threading/NrtThreadingTypedefs.h"

// clang-format on

Expand Down
24 changes: 24 additions & 0 deletions include/NovelRT.Interop/Threading/NrtFutureResult.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_THREADING_FUTURERESULT_H
#define NOVELRT_INTEROP_THREADING_FUTURERESULT_H

#include "../NrtTypedefs.h"

#ifdef __cplusplus
extern "C"
{
#endif

// FutureResult<TextureInfo>
NrtResult Nrt_FutureResultOfTextureInfo_Destroy(NrtFutureResultOfTextureInfoHandle handle);

NrtBool Nrt_FutureResultOfTextureInfo_TryGetValue(NrtFutureResultOfTextureInfoHandle handle,
NrtTextureInfoHandle* outValue);

#ifdef __cplusplus
}
#endif

#endif // NOVELRT_INTEROP_THREADING_FUTURERESULT_H
18 changes: 18 additions & 0 deletions include/NovelRT.Interop/Threading/NrtThreadingTypedefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#ifndef NOVELRT_INTEROP_THREADING_THREADINGTYPEDEFS_H
#define NOVELRT_INTEROP_THREADING_THREADINGTYPEDEFS_H

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct NrtFutureResultOfTextureInfo* NrtFutureResultOfTextureInfoHandle;

#ifdef __cplusplus
}
#endif

#endif // NOVELRT_INTEROP_THREADING_THREADINGTYPEDEFS_H
Loading