New game interface

This commit is contained in:
Dynamitos
2023-02-01 22:13:04 +01:00
parent 0dce84459e
commit 9e1e4076f0
91 changed files with 268 additions and 21014 deletions
@@ -5,7 +5,6 @@ using namespace Seele;
GameInterface::GameInterface(std::string dllPath)
: dllPath(dllPath)
{
reloadGame();
}
GameInterface::~GameInterface()
@@ -13,7 +12,12 @@ GameInterface::~GameInterface()
}
Game* GameInterface::reloadGame()
Game* GameInterface::getGame()
{
return game;
}
void GameInterface::reload(AssetRegistry* registry)
{
if(lib != NULL)
{
@@ -23,6 +27,5 @@ Game* GameInterface::reloadGame()
lib = LoadLibraryA(dllPath.c_str());
createInstance = (decltype(createInstance))GetProcAddress(lib, "createInstance");
destroyInstance = (decltype(destroyInstance))GetProcAddress(lib, "destroyInstance");
game = createInstance();
return game;
game = createInstance(registry);
}
+3 -2
View File
@@ -9,12 +9,13 @@ class GameInterface
public:
GameInterface(std::string dllPath);
~GameInterface();
Game* reloadGame();
Game* getGame();
void reload(AssetRegistry* registry);
private:
HMODULE lib = NULL;
std::string dllPath;
Game* game;
Game* (*createInstance)() = nullptr;
Game* (*createInstance)(AssetRegistry*) = nullptr;
void (*destroyInstance)(Game*) = nullptr;
};
} // namespace Seele
+7 -1
View File
@@ -3,9 +3,12 @@
#include "Window/Window.h"
#include "Component/KeyboardInput.h"
#include "Actor/CameraActor.h"
#include "Asset/AssetRegistry.h"
using namespace Seele;
AssetRegistry* instance = new AssetRegistry();
GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo)
: View(graphics, window, createInfo, "Game")
, gameInterface("C:\\Users\\Dynamitos\\TrackClear\\bin\\TrackCleard.dll")
@@ -20,8 +23,10 @@ GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
))
{
scene = new Scene(graphics);
gameInterface.reload(instance);
gameInterface.getGame()->importAssets();
systemGraph = new SystemGraph();
gameInterface.reloadGame()->setupScene(scene, systemGraph);
gameInterface.getGame()->setupScene(scene, systemGraph);
renderGraph.updateViewport(viewport);
}
@@ -52,6 +57,7 @@ void GameView::commitUpdate()
lightCullingData.lightEnv = scene->getLightBuffer();
basePassData.staticDrawList = scene->getStaticMeshes();
basePassData.sceneDataBuffer = scene->getSceneDataBuffer();
skyboxData.skybox = scene->getSkybox();
#ifdef EDITOR
if(showDebug)
{
+1 -1
View File
@@ -46,7 +46,7 @@ private:
dp::thread_pool<> threadPool;
float updateTime = 0;
#ifdef EDITOR
bool showDebug = true;
bool showDebug = false;
#endif
virtual void keyCallback(Seele::KeyCode code, Seele::InputAction action, Seele::KeyModifier modifier) override;
+4 -1
View File
@@ -3,6 +3,7 @@
#include "Actor/Actor.h"
#include "Window/Window.h"
#include "Asset/AssetRegistry.h"
#include "Asset/FontLoader.h"
#include "UI/System.h"
using namespace Seele;
@@ -15,7 +16,9 @@ InspectorView::InspectorView(Gfx::PGraphics graphics, PWindow window, const View
))
, uiSystem(new UI::System())
{
AssetRegistry::importFile("./fonts/Calibri.ttf");
AssetRegistry::importFont(FontImportArgs{
.filePath = "./fonts/Calibri.ttf",
});
renderGraph.updateViewport(viewport);
uiSystem->updateViewport(viewport);
}
+1 -1
View File
@@ -25,7 +25,7 @@ SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreat
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Ely\\Ely.fbx");
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Cube\\cube.obj");
AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Plane\\plane.fbx");
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Plane\\plane.fbx");
cameraSystem.update(viewportCamera, static_cast<float>(Gfx::currentFrameDelta));
+6 -6
View File
@@ -30,12 +30,12 @@ int main()
sceneViewInfo.dimensions.offset.y = 0;
PGameView sceneView = new GameView(graphics, window, sceneViewInfo);
ViewportCreateInfo inspectorViewInfo;
inspectorViewInfo.dimensions.size.x = 640;
inspectorViewInfo.dimensions.size.y = 720;
inspectorViewInfo.dimensions.offset.x = 640;
inspectorViewInfo.dimensions.offset.y = 0;
PInspectorView inspectorView = new InspectorView(graphics, window, inspectorViewInfo);
//ViewportCreateInfo inspectorViewInfo;
//inspectorViewInfo.dimensions.size.x = 640;
//inspectorViewInfo.dimensions.size.y = 720;
//inspectorViewInfo.dimensions.offset.x = 640;
//inspectorViewInfo.dimensions.offset.y = 0;
//PInspectorView inspectorView = new InspectorView(graphics, window, inspectorViewInfo);
//window->addView(inspectorView);
sceneView->setFocused();