In slowlib.d3d11.cpp I add SL_LIB_EXPORT before #include "slowlib.h", it must be only in
one file, because I need to export some functions, and want to use SL_API, and SL_API will
import functions in other places.
All slowlib DLLs will export functions for creating objects of Interface classes.
One DLL can have GS, image loader, mesh loader at the same time.
For GS name for function will be slSummonGS, all GS DLLs must have this function.
#ifndef SL_LIB_STATIC
slStringA utf8apppath;
g_framework->m_appPath.to_utf8(utf8apppath);
for (auto& entry : std::filesystem::directory_iterator(utf8apppath.m_data))
{
auto path = entry.path();
if (path.has_extension())
{
auto ex = path.extension();
if (ex == ".dll" || ex == ".DLL")
{
slLog::PrintInfo("[%s]\n", path.generic_string().c_str());
LoadLib(path);
}
}
}
#endif
Now I need to implement old methods from slFramework.
// Get number of Graphics Systems
static uint32_t GetGSCount();
static slString GetGSName(uint32_t);
static slUID GetGSUID(uint32_t);
// Create GS using slUID
static slGS* SummonGS(slUID);
// Create GS using it's name
static slGS* SummonGS(const char*);
// Both
static slGS* SummonGS(slUID, const char*);
Implementation
uint32_t slFramework::GetGSCount()
{
return (uint32_t)g_framework->m_gss.size();
}
slString slFramework::GetGSName(uint32_t i)
{
return g_framework->m_gss[i]->GetName();
}
slUID slFramework::GetGSUID(uint32_t i)
{
return g_framework->m_gss[i]->GetUID();
}
slGS* slFramework::SummonGS(slUID id)
{
for (auto o : g_framework->m_gss)
{
if (CompareUIDs(o->GetUID(),id))
return o;
}
return 0;
}
slGS* slFramework::SummonGS(const char* _name)
{
slString name(_name);
for (auto o : g_framework->m_gss)
{
slString o_name = o->GetName();
if (name == o_name)
return o;
}
return 0;
}
slGS* slFramework::SummonGS(slUID id, const char* _name)
{
slString name(_name);
for (auto o : g_framework->m_gss)
{
if (CompareUIDs(o->GetUID(), id))
{
slString o_name = o->GetName();
if (name == o_name)
return o;
}
}
return 0;
}