forked from Dynamitos/Seele
Trying to get metal backend to run
This commit is contained in:
1 parent
32ad82dbd2
commit
3cee2ae9ab
24 files changed
+64
-69
No files matched your search
@@ -1,8 +1,10 @@
|
||||
#include "GameInterface.h"
|
||||
#include "dlfcn.h"
|
||||
#include <filesystem>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
GameInterface::GameInterface(std::string soPath) : lib(NULL), soPath(soPath) {}
|
||||
GameInterface::GameInterface(std::filesystem::path soPath) : lib(NULL), soPath(soPath) {}
|
||||
|
||||
GameInterface::~GameInterface() {}
|
||||
|
||||
@@ -13,6 +15,7 @@ void GameInterface::reload() {
|
||||
destroyInstance(game);
|
||||
dlclose(lib);
|
||||
}
|
||||
std::filesystem::copy(soPath.parent_path().parent_path() / "res" / "shaders", "shaders/game", std::filesystem::copy_options::overwrite_existing);
|
||||
lib = dlopen(soPath.c_str(), RTLD_NOW);
|
||||
createInstance = (decltype(createInstance))dlsym(lib, "createInstance");
|
||||
destroyInstance = (decltype(destroyInstance))dlsym(lib, "destroyInstance");
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#pragma once
|
||||
#include "Game.h"
|
||||
#include "dlfcn.h"
|
||||
#include <filesystem>
|
||||
|
||||
namespace Seele {
|
||||
class GameInterface {
|
||||
public:
|
||||
GameInterface(std::string soPath);
|
||||
GameInterface(std::filesystem::path soPath);
|
||||
~GameInterface();
|
||||
Game* getGame();
|
||||
void reload();
|
||||
|
||||
private:
|
||||
void* lib;
|
||||
std::string soPath;
|
||||
std::filesystem::path soPath;
|
||||
Game* game;
|
||||
Game* (*createInstance)() = nullptr;
|
||||
void (*destroyInstance)(Game*) = nullptr;
|
||||
|
||||
Reference in new issue
Block a user