Replacing std::format with fmt::format
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
if(WIN32)
|
||||
add_subdirectory(Windows/)
|
||||
elseif(APPLE)
|
||||
add_subdirectory(Mac/)
|
||||
else()
|
||||
add_subdirectory(Linux/)
|
||||
endif()
|
||||
@@ -18,7 +18,7 @@ Game* GameInterface::getGame()
|
||||
return game;
|
||||
}
|
||||
|
||||
void GameInterface::reload(AssetRegistry* registry)
|
||||
void GameInterface::reload()
|
||||
{
|
||||
if(lib != NULL)
|
||||
{
|
||||
@@ -28,5 +28,5 @@ void GameInterface::reload(AssetRegistry* registry)
|
||||
lib = dlopen(soPath.c_str(), RTLD_NOW);
|
||||
createInstance = (decltype(createInstance))dlsym(lib, "createInstance");
|
||||
destroyInstance = (decltype(destroyInstance))dlsym(lib, "destroyInstance");
|
||||
game = createInstance(registry);
|
||||
game = createInstance();
|
||||
}
|
||||
@@ -10,12 +10,12 @@ public:
|
||||
GameInterface(std::string soPath);
|
||||
~GameInterface();
|
||||
Game* getGame();
|
||||
void reload(AssetRegistry* registry);
|
||||
void reload();
|
||||
private:
|
||||
void* lib;
|
||||
std::string soPath;
|
||||
Game* game;
|
||||
Game* (*createInstance)(AssetRegistry*) = nullptr;
|
||||
Game* (*createInstance)() = nullptr;
|
||||
void (*destroyInstance)(Game*) = nullptr;
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -0,0 +1,10 @@
|
||||
target_sources(Engine
|
||||
PRIVATE
|
||||
GameInterface.h
|
||||
GameInterface.cpp)
|
||||
|
||||
|
||||
target_sources(Engine
|
||||
PUBLIC FILE_SET HEADERS
|
||||
FILES
|
||||
GameInterface.h)
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "GameInterface.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
GameInterface::GameInterface(std::string soPath)
|
||||
: lib(NULL)
|
||||
, soPath(soPath)
|
||||
{
|
||||
}
|
||||
|
||||
GameInterface::~GameInterface()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Game* GameInterface::getGame()
|
||||
{
|
||||
return game;
|
||||
}
|
||||
|
||||
void GameInterface::reload()
|
||||
{
|
||||
if(lib != NULL)
|
||||
{
|
||||
destroyInstance(game);
|
||||
dlclose(lib);
|
||||
}
|
||||
lib = dlopen(soPath.c_str(), RTLD_NOW);
|
||||
createInstance = (decltype(createInstance))dlsym(lib, "createInstance");
|
||||
destroyInstance = (decltype(destroyInstance))dlsym(lib, "destroyInstance");
|
||||
game = createInstance();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "Game.h"
|
||||
#include "dlfcn.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
class GameInterface
|
||||
{
|
||||
public:
|
||||
GameInterface(std::string soPath);
|
||||
~GameInterface();
|
||||
Game* getGame();
|
||||
void reload();
|
||||
private:
|
||||
void* lib;
|
||||
std::string soPath;
|
||||
Game* game;
|
||||
Game* (*createInstance)() = nullptr;
|
||||
void (*destroyInstance)(Game*) = nullptr;
|
||||
};
|
||||
} // namespace Seele
|
||||
Reference in New Issue
Block a user