Attempt using dllimport/dllexport

This commit is contained in:
maverickdgg 2022-09-29 07:59:04 +08:00
parent a9ff693646
commit b1a799cf05
5 changed files with 44 additions and 6 deletions

View File

@ -32,6 +32,8 @@
#include "Assets/SHAssetManager.h"
#include "Tools/SHLogger.h"
using namespace SHADE;
namespace Sandbox
@ -110,6 +112,8 @@ namespace Sandbox
//TODO: Change true to window is open
while (!window.WindowShouldClose())
{
auto id = SystemFamily::GetID<SHTransformSystem>();
SHLOG_INFO("Transform system id in application : {} {}", id, SystemFamily::currentID);
SHFrameRateController::UpdateFRC();
SHSceneManager::UpdateSceneManager();
SHSceneManager::SceneUpdate(1/60.0f);

View File

@ -0,0 +1,15 @@
#pragma once
#define COMPULING_THE_DLL
#include "SHFamily.h"
#include "SHpch.h"
namespace SHADE
{
//initialize currentID as 0
}

View File

@ -18,12 +18,12 @@
namespace SHADE
{
template<typename BaseClass>
class SHFamilyID
{
private:
//this is used to keep track of the new current ID to be assign to a new Derived class type.
static ComponentTypeID currentID;
/*!*************************************************************************
* \brief Construct a new SHFamilyID object
@ -46,6 +46,9 @@ namespace SHADE
}
public:
//this is used to keep track of the new current ID to be assign to a new Derived class type.
static MY_DLL_EXPORT ComponentTypeID currentID;
/*!*************************************************************************
* \brief
* Checks if this identifier is cuurrently in use / valid.
@ -59,7 +62,6 @@ namespace SHADE
{
return(id < currentID);
}
/*!*************************************************************************
* \brief
* Get the ID of a derived class type.
@ -75,9 +77,13 @@ namespace SHADE
static ComponentTypeID id = currentID++;
return id;
}
};
//initialize currentID as 0
#ifdef COMPILING_THE_DLL
template<typename BaseClass>
ComponentTypeID SHFamilyID<BaseClass>::currentID = 0;
#endif
}

View File

@ -26,4 +26,14 @@ const EntityIndex MAX_EID = 51000;
#define ENABLE_IF_UINT(_TYPE, _RETURN)\
typename std::enable_if<(std::is_integral<_TYPE>::value && !std::is_signed<_TYPE>::value),_RETURN>::type
#ifdef COMPILING_THE_DLL
#ifndef MY_DLL_EXPORT
#define MY_DLL_EXPORT __declspec(dllexport)
#endif
#else
#ifndef MY_DLL_EXPORT
#define MY_DLL_EXPORT __declspec(dllimport)
#endif
#endif
#endif

View File

@ -23,6 +23,8 @@
#include "SHEditor.hpp"
#include "SHEditorWidgets.hpp"
#include "Math/Transform/SHTransformSystem.h"
//#==============================================================#
//|| Editor Window Includes ||
//#==============================================================#
@ -104,7 +106,8 @@ namespace SHADE
{
(void)dt;
NewFrame();
auto id = SystemFamily::GetID<SHTransformSystem>();
SHLOG_INFO("Transform system id in Editor Update : {} {}", id, SystemFamily::currentID);
for (const auto& window : editorWindows | std::views::values)
{
if(window->isOpen)