Fixed all my pointers

This commit is contained in:
2022-10-19 19:44:47 -07:00
parent f0cbae4cf8
commit acc9d798cb
31 changed files with 289 additions and 141 deletions

View File

@ -16,4 +16,5 @@ target_include_directories(${DAWN_TARGET_NAME}
)
# Subdirs
add_subdirectory(display)
add_subdirectory(scene)

View File

@ -0,0 +1,10 @@
# Copyright (c) 2022 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DAWN_TARGET_NAME}
PRIVATE
RenderPipeline.cpp
)

View File

@ -0,0 +1,26 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "RenderPipeline.hpp"
#include "game/DawnGame.hpp"
using namespace Dawn;
RenderPipeline::RenderPipeline(RenderManager &renderManager) :
renderManager(renderManager)
{
}
void RenderPipeline::init() {
}
void RenderPipeline::render() {
this->renderScene(*this->renderManager.game.scene);
}
RenderPipeline::~RenderPipeline() {
}

View File

@ -0,0 +1,24 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "display/RenderManager.hpp"
#include "scene/Scene.hpp"
#include "scene/components/Components.hpp"
namespace Dawn {
class RenderPipeline {
public:
RenderManager &renderManager;
RenderPipeline(RenderManager &renderManager);
virtual void init();
void render();
virtual void renderScene(Scene &scene) = 0;
virtual void renderSceneCamera(Scene &scene, Camera &camera) = 0;
virtual ~RenderPipeline();
};
}

View File

@ -8,10 +8,19 @@
namespace Dawn {
class DawnGame;
class RenderPipeline;
class IRenderManager {
public:
std::weak_ptr<DawnGame> game;
DawnGame &game;
std::shared_ptr<RenderPipeline> renderPipeline;
/**
* Default constructor for a render manager instance.
*
* @param game Game that this render manager belongs to.
*/
IRenderManager(DawnGame &game) : game(game) {}
/**
* Returns the primary render target (the backbuffer) that draws directly
@ -19,10 +28,14 @@ namespace Dawn {
*
* @return Shared pointer to the backbuffer render target.
*/
virtual std::shared_ptr<RenderTarget> getBackBuffer() = 0;
virtual RenderTarget & getBackBuffer() = 0;
virtual RenderPipeline & getRenderPipeline() = 0;
/**
* Initialize this render manager.
* Initialize / Start the Render Manager.
*
* @param game Game instance this render manager belongs to.
*/
virtual void init() = 0;

View File

@ -14,6 +14,6 @@ namespace Dawn {
*
* @param mesh Mesh to initialize as a triangle.
*/
static void createTriangleMesh(std::shared_ptr<Mesh> mesh);
static void createTriangleMesh(Mesh &mesh);
};
}

View File

@ -15,22 +15,17 @@
namespace Dawn {
class DawnHost;
class DawnGame :
public std::enable_shared_from_this<DawnGame>
{
private:
std::shared_ptr<Scene> scene;
class DawnGame {
public:
std::weak_ptr<DawnHost> host;
std::shared_ptr<Scene> scene;
DawnHost &host;
RenderManager renderManager;
/**
* Construct a new instance of the DawnGame.
*
* @param host Weak pointer to the host that is running this game.
*/
DawnGame(std::weak_ptr<DawnHost> host);
DawnGame(DawnHost &host);
/**
* Initialize the game. This is performed by the host at a time that is
@ -38,6 +33,7 @@ namespace Dawn {
* return an initialize result, where DAWN_GAME_INIT_RESULT_SUCCESS is
* the only "successful" result, anything else is deemed a failure state.
*
* @param host Pointer to the host that is running this game.
* @return The game initialize result.
*/
int32_t init();

View File

@ -29,7 +29,9 @@ namespace Dawn {
*/
class DawnHostData;
class DawnHost {
class DawnHost :
public std::enable_shared_from_this<DawnHost>
{
public:
std::unique_ptr<DawnHostData> data;
@ -49,7 +51,7 @@ namespace Dawn {
* @param game Game instance that this host is running for.
* @return A status code, where DAWN_HOST_INIT_RESULT_SUCCESS is success.
*/
int32_t init(std::weak_ptr<DawnGame> game);
int32_t init(DawnGame &game);
/**
* Request to start the main loop. This method may not exist and may not
@ -61,7 +63,7 @@ namespace Dawn {
* @param game Game instance that this host is running for.
* @return A status code, refer to DAWN_HOST_START_RESULT_{} definitions.
*/
virtual int32_t start(std::weak_ptr<DawnGame> game);
virtual int32_t start(DawnGame &game);
/**
* Requests the host to perform a main-thread update.
@ -70,7 +72,7 @@ namespace Dawn {
* @param delta How much time has passed (in seconds) since the last tick.
* @return A status code, refer to DAWN_HOST_UPDATE_RESULT_{} definitions.
*/
int32_t update(std::weak_ptr<DawnGame> game, float_t delta);
int32_t update(DawnGame &game, float_t delta);
/**
* Request the host to be unloaded. This is a bit different from dispose
@ -79,7 +81,7 @@ namespace Dawn {
*
* @param game Game instance that this host is running for.
*/
void unload(std::weak_ptr<DawnGame> game);
void unload(DawnGame &game);
/**
* Destroy (and unload) all of the DawnHost data from memory.

View File

@ -8,8 +8,7 @@
using namespace Dawn;
Scene::Scene(std::weak_ptr<DawnGame> game) {
this->game = game;
Scene::Scene(DawnGame &game) : game(game) {
this->nextId = 0;
}
@ -30,7 +29,7 @@ void Scene::update() {
std::shared_ptr<SceneItem> Scene::createSceneItem() {
sceneitemid_t id = this->nextId++;
auto item = std::make_shared<SceneItem>(weak_from_this(), id);
auto item = std::make_shared<SceneItem>(*this, id);
this->itemsNotInitialized[id] = item;
return item;
}

View File

@ -9,23 +9,21 @@
namespace Dawn {
class DawnGame;
class Scene :
public std::enable_shared_from_this<Scene>
{
class Scene {
private:
sceneitemid_t nextId;
std::map<sceneitemid_t,std::shared_ptr<SceneItem>> items;
std::map<sceneitemid_t,std::shared_ptr<SceneItem>> itemsNotInitialized;
std::map<sceneitemid_t, std::shared_ptr<SceneItem>> items;
std::map<sceneitemid_t, std::shared_ptr<SceneItem>> itemsNotInitialized;
public:
std::weak_ptr<DawnGame> game;
DawnGame &game;
/**
* Construct a new Scene instance.
*
* @param game Weak pointer to the game that this scene belongs to.
* @param game Reference to the game that this scene belongs to.
*/
Scene(std::weak_ptr<DawnGame> game);
Scene(DawnGame &game);
/**
* Perform a one frame synchronous tick on the current scene. This may
@ -59,6 +57,25 @@ namespace Dawn {
return nullptr;
}
/**
* Finds all exisitng components on the scene (Root Level Only) that has a
* matching component of the given component type.
*
* @tparam Component type to look for.
* @return List of matching compnoents.
*/
template<class T>
std::vector<std::shared_ptr<T>> findComponents() {
std::vector<std::shared_ptr<T>> components;
auto it = this->items.begin();
while(it != this->items.end()) {
auto component = it->second->getComponent<T>();
if(component != nullptr) components.push_back(component);
++it;
}
return components;
}
/**
* Destroys a previously initialized Scene.
*/

View File

@ -8,8 +8,10 @@
using namespace Dawn;
SceneItem::SceneItem(std::weak_ptr<Scene>, sceneitemid_t id) {
this->scene = scene;
SceneItem::SceneItem(Scene &scene, sceneitemid_t id) :
scene(scene),
id(id)
{
this->id = id;
}

View File

@ -11,14 +11,12 @@ namespace Dawn {
class Scene;
class SceneItem :
public std::enable_shared_from_this<SceneItem>
{
class SceneItem {
private:
std::vector<std::shared_ptr<SceneItemComponent>> components;
public:
std::weak_ptr<Scene> scene;
Scene &scene;
sceneitemid_t id;
/**
@ -28,7 +26,7 @@ namespace Dawn {
* @param scene Weak pointer to the Scene that this SceneItem belongs to.
* @param id Scene Item ID that the Scene assigned this SceneItem.
*/
SceneItem(std::weak_ptr<Scene> scene, sceneitemid_t id);
SceneItem(Scene &scene, sceneitemid_t id);
/**
* Called by the Scene the frame after we were constructed so we can begin
@ -48,7 +46,7 @@ namespace Dawn {
*/
template<class T>
std::shared_ptr<T> addComponent() {
auto component = std::make_shared<T>(weak_from_this());
auto component = std::make_shared<T>(*this);
this->components.push_back(component);
return component;
}

View File

@ -10,16 +10,15 @@
using namespace Dawn;
SceneItemComponent::SceneItemComponent(std::weak_ptr<SceneItem> item) {
this->item = item;
SceneItemComponent::SceneItemComponent(SceneItem &item) : item(item) {
}
std::shared_ptr<Scene> SceneItemComponent::getScene() {
return this->item.lock()->scene.lock();
Scene & SceneItemComponent::getScene() {
return this->item.scene;
}
std::shared_ptr<DawnGame> SceneItemComponent::getGame() {
return this->item.lock()->scene.lock()->game.lock();
DawnGame & SceneItemComponent::getGame() {
return this->item.scene.game;
}
SceneItemComponent::~SceneItemComponent() {

View File

@ -13,14 +13,14 @@ namespace Dawn {
class SceneItemComponent {
public:
std::weak_ptr<SceneItem> item;
SceneItem &item;
SceneItemComponent(std::weak_ptr<SceneItem> item);
SceneItemComponent(SceneItem &item);
virtual void start() = 0;
std::shared_ptr<Scene> getScene();
std::shared_ptr<DawnGame> getGame();
Scene & getScene();
DawnGame & getGame();
virtual ~SceneItemComponent();
};

View File

@ -9,7 +9,9 @@
namespace Dawn {
class DummyComponent : public SceneItemComponent {
public:
DummyComponent(std::weak_ptr<SceneItem> item) : SceneItemComponent(item) {
DummyComponent(SceneItem &item) :
SceneItemComponent(item)
{
std::cout << "Dummy Component Initialized" << std::endl;
};

View File

@ -9,7 +9,9 @@
using namespace Dawn;
Camera::Camera(std::weak_ptr<SceneItem> item) : SceneItemComponent(item) {
Camera::Camera(SceneItem &item) :
SceneItemComponent(item)
{
}
void Camera::updateProjection() {
@ -36,17 +38,16 @@ void Camera::updateProjection() {
}
}
std::shared_ptr<RenderTarget> Camera::getRenderTarget() {
RenderTarget & Camera::getRenderTarget() {
if(this->target == nullptr) {
return this->getGame()->renderManager.getBackBuffer();
return this->getGame().renderManager.getBackBuffer();
}
return this->target;
return *this->target;
}
float_t Camera::getAspect() {
auto target = this->getRenderTarget();
return target->getWidth() / target->getHeight();
RenderTarget &target = this->getRenderTarget();
return target.getWidth() / target.getHeight();
}
void Camera::start() {

View File

@ -37,14 +37,14 @@ namespace Dawn {
*
* @param item SceneItem that this component belongs to.
*/
Camera(std::weak_ptr<SceneItem> item);
Camera(SceneItem &item);
/**
* Updates the projection matrix.
*/
void updateProjection();
std::shared_ptr<RenderTarget> getRenderTarget();
RenderTarget & getRenderTarget();
/**
* Returs the aspect ratio of the camera.

View File

@ -7,7 +7,7 @@
using namespace Dawn;
MeshRenderer::MeshRenderer(std::weak_ptr<SceneItem> item) :
MeshRenderer::MeshRenderer(SceneItem &item) :
SceneItemComponent(item)
{

View File

@ -12,7 +12,7 @@ namespace Dawn {
public:
std::shared_ptr<Mesh> mesh = nullptr;
MeshRenderer(std::weak_ptr<SceneItem> item);
MeshRenderer(SceneItem &item);
void start() override;
};

View File

@ -25,7 +25,7 @@ DawnHost::DawnHost() {
this->data->window = nullptr;
}
int32_t DawnHost::init(std::weak_ptr<DawnGame> game) {
int32_t DawnHost::init(DawnGame &game) {
// Init GLFW
if(!glfwInit()) return DAWN_GLFW_INIT_RESULT_INIT_FAILED;
@ -51,22 +51,18 @@ int32_t DawnHost::init(std::weak_ptr<DawnGame> game) {
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
// Initialize the game
if(auto g = game.lock()) {
auto result = g->init();
if(result != DAWN_GAME_INIT_RESULT_SUCCESS) return result;
auto result = game.init();
if(result != DAWN_GAME_INIT_RESULT_SUCCESS) return result;
g->renderManager.renderTarget->setSize(
DAWN_GLFW_WINDOW_WIDTH_DEFAULT,
DAWN_GLFW_WINDOW_HEIGHT_DEFAULT
);
} else {
return DAWN_GLFW_INIT_RESULT_GAME_LOCK_FAILED;
}
game.renderManager.backBuffer.setSize(
DAWN_GLFW_WINDOW_WIDTH_DEFAULT,
DAWN_GLFW_WINDOW_HEIGHT_DEFAULT
);
return DAWN_HOST_INIT_RESULT_SUCCESS;
}
int32_t DawnHost::start(std::weak_ptr<DawnGame> game) {
int32_t DawnHost::start(DawnGame &game) {
double_t time, newTime;
float_t fDelta;
int32_t updateResult;
@ -99,25 +95,21 @@ int32_t DawnHost::start(std::weak_ptr<DawnGame> game) {
return DAWN_HOST_START_RESULT_EXIT_SUCCESS;
}
int32_t DawnHost::update(std::weak_ptr<DawnGame> game, float_t delta) {
if(auto g = game.lock()) {
auto ret = g->update(delta);
switch(ret) {
case DAWN_GAME_UPDATE_RESULT_SUCCESS:
return DAWN_HOST_UPDATE_RESULT_SUCCESS;
case DAWN_GAME_UPDATE_RESULT_EXIT:
return DAWN_HOST_UPDATE_RESULT_EXIT;
int32_t DawnHost::update(DawnGame &game, float_t delta) {
auto ret = game.update(delta);
switch(ret) {
case DAWN_GAME_UPDATE_RESULT_SUCCESS:
return DAWN_HOST_UPDATE_RESULT_SUCCESS;
case DAWN_GAME_UPDATE_RESULT_EXIT:
return DAWN_HOST_UPDATE_RESULT_EXIT;
default:
return ret;
}
default:
return ret;
}
return DAWN_GLFW_UPDATE_RESULT_GAME_LOCK_FAILED;
}
void DawnHost::unload(std::weak_ptr<DawnGame> game) {
void DawnHost::unload(DawnGame &game) {
glfwDestroyWindow(this->data->window);
this->data->window = nullptr;
glfwTerminate();

View File

@ -14,12 +14,9 @@
#define DAWN_GLFW_INIT_RESULT_INIT_FAILED -1
#define DAWN_GLFW_INIT_RESULT_WINDOW_CREATE_FAILED -2
#define DAWN_GLFW_INIT_RESULT_GAME_LOCK_FAILED -3
#define DAWN_GLFW_START_RESULT_UPDATE_FAILED -1
#define DAWN_GLFW_UPDATE_RESULT_GAME_LOCK_FAILED -1
namespace Dawn {
class DawnHostData {
public:

View File

@ -7,10 +7,9 @@
using namespace Dawn;
BackBufferRenderTarget::BackBufferRenderTarget(
std::weak_ptr<RenderManager> renderManager
) {
this->renderManager = renderManager;
BackBufferRenderTarget::BackBufferRenderTarget(RenderManager &renderManager) :
renderManager(renderManager)
{
}
float_t BackBufferRenderTarget::getWidth() {

View File

@ -6,18 +6,19 @@
#pragma once
#include "dawnopengl.hpp"
#include "display/RenderTarget.hpp"
#include "display/RenderManager.hpp"
namespace Dawn {
class RenderManager;
class BackBufferRenderTarget : public RenderTarget {
private:
std::weak_ptr<RenderManager> renderManager;
RenderManager &renderManager;
float_t width = 1;
float_t height = 1;
float_t height = 1;
struct Color clearColor = COLOR_CORNFLOWER_BLUE;
public:
BackBufferRenderTarget(std::weak_ptr<RenderManager> renderManager);
BackBufferRenderTarget(RenderManager &renderManager);
float_t getWidth() override;
float_t getHeight() override;

View File

@ -8,6 +8,7 @@ target_sources(${DAWN_TARGET_NAME}
PRIVATE
RenderManager.cpp
BackBufferRenderTarget.cpp
StandardRenderPipeline.cpp
)
# Subdirs

View File

@ -6,28 +6,31 @@
#include "dawnopengl.hpp"
#include "game/DawnGame.hpp"
#include "display/RenderManager.hpp"
#include "display/BackBufferRenderTarget.hpp"
#include "display/StandardRenderPipeline.hpp"
using namespace Dawn;
RenderManager::RenderManager(std::weak_ptr<DawnGame> game) {
this->game = game;
this->renderTarget=std::make_shared<BackBufferRenderTarget>(weak_from_this());
RenderManager::RenderManager(DawnGame &game) :
IRenderManager(game),
backBuffer(*this)
{
this->standardRenderPipeline=std::make_shared<StandardRenderPipeline>(*this);
}
void RenderManager::init() {
this->standardRenderPipeline->init();
}
std::shared_ptr<RenderTarget> RenderManager::getBackBuffer() {
return this->renderTarget;
RenderTarget & RenderManager::getBackBuffer() {
return this->backBuffer;
}
RenderPipeline & RenderManager::getRenderPipeline() {
return *this->standardRenderPipeline;
}
void RenderManager::update() {
this->getBackBuffer()->bind();
this->getBackBuffer()->clear(
RENDER_TARGET_CLEAR_FLAG_COLOR |
RENDER_TARGET_CLEAR_FLAG_DEPTH
);
this->getRenderPipeline().render();
}
RenderManager::~RenderManager() {

View File

@ -5,26 +5,24 @@
#pragma once
#include "display/_RenderManager.hpp"
#include "display/BackBufferRenderTarget.hpp"
namespace Dawn {
class BackBufferRenderTarget;
class StandardRenderPipeline;
class RenderManager :
public IRenderManager,
public std::enable_shared_from_this<RenderManager>
{
class RenderManager : public IRenderManager {
private:
std::shared_ptr<StandardRenderPipeline> standardRenderPipeline;
public:
std::shared_ptr<BackBufferRenderTarget> renderTarget;
BackBufferRenderTarget backBuffer;
/**
* Construct a new RenderManager for a game instance.
*
* @param game Game instance this render manager belongs to.
*/
RenderManager(std::weak_ptr<DawnGame> game);
std::shared_ptr<RenderTarget> getBackBuffer() override;
RenderManager(DawnGame &game);
RenderTarget & getBackBuffer() override;
RenderPipeline & getRenderPipeline() override;
void init() override;
void update() override;

View File

@ -0,0 +1,55 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "StandardRenderPipeline.hpp"
#include "scene/components/Components.hpp"
using namespace Dawn;
StandardRenderPipeline::StandardRenderPipeline(RenderManager &renderManager) :
RenderPipeline(renderManager)
{
}
void StandardRenderPipeline::renderScene(Scene &scene) {
RenderTarget &backBuffer = this->renderManager.getBackBuffer();
auto cameras = scene.findComponents<Camera>();
std::shared_ptr<Camera> backBufferCamera = nullptr;
// First, render all non-backbuffer cameras.
auto it = cameras.begin();
while(it != cameras.end()) {
RenderTarget &cameraTarget = (*it)->getRenderTarget();
// Leave the backbuffer camera(s) to last, so we skip them.
if(&cameraTarget == &backBuffer) {
backBufferCamera = *it;
} else {
this->renderSceneCamera(scene, **it);
}
++it;
}
// Now render the backbuffer camera.
if(backBufferCamera == nullptr) return;
this->renderSceneCamera(scene, *backBufferCamera);
}
void StandardRenderPipeline::renderSceneCamera(Scene &scene, Camera &camera) {
RenderTarget &renderTarget = camera.getRenderTarget();
renderTarget.bind();
renderTarget.clear(
RENDER_TARGET_CLEAR_FLAG_DEPTH |
RENDER_TARGET_CLEAR_FLAG_COLOR
);
auto meshes = scene.findComponents<MeshRenderer>();
auto it = meshes.begin();
while(it != meshes.end()) {
(*it)->mesh->draw(MESH_DRAW_MODE_TRIANGLES, 0, -1);
++it;
}
}

View File

@ -0,0 +1,18 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnopengl.hpp"
#include "display/RenderPipeline.hpp"
namespace Dawn {
class StandardRenderPipeline : public RenderPipeline {
public:
StandardRenderPipeline(RenderManager &renderManager);
void renderScene(Scene &scene) override;
void renderSceneCamera(Scene &scene, Camera &camera) override;
};
}

View File

@ -8,19 +8,19 @@
using namespace Dawn;
void TriangleMesh::createTriangleMesh(std::shared_ptr<Mesh> mesh) {
mesh->createBuffers(3, 3);
mesh->bufferPositions(0, std::array<glm::vec3, 3>{{
void TriangleMesh::createTriangleMesh(Mesh &mesh) {
mesh.createBuffers(3, 3);
mesh.bufferPositions(0, std::array<glm::vec3, 3>{{
glm::vec3(-1, 0, 0),
glm::vec3(0, 1, 0),
glm::vec3(1, 0, 0)
}});
mesh->bufferCoordinates(0, std::array<glm::vec2, 3>{{
mesh.bufferCoordinates(0, std::array<glm::vec2, 3>{{
glm::vec2(0, 0),
glm::vec2(0, 1),
glm::vec2(1, 0)
}});
mesh->bufferIndices(0, std::array<meshindice_t,3>{{
mesh.bufferIndices(0, std::array<meshindice_t,3>{{
0, 1, 2
}});
}

View File

@ -7,16 +7,16 @@
using namespace Dawn;
DawnGame::DawnGame(std::weak_ptr<DawnHost> host) :
renderManager(weak_from_this())
DawnGame::DawnGame(DawnHost &host) :
host(host),
renderManager(*this)
{
this->host = host;
}
int32_t DawnGame::init() {
this->renderManager.init();
this->scene = std::make_shared<Scene>(weak_from_this());
this->scene = std::make_shared<Scene>(*this);
auto cameraObject = this->scene->createSceneItem();
auto camera = cameraObject->addComponent<Camera>();
@ -24,20 +24,14 @@ int32_t DawnGame::init() {
auto cubeObject = this->scene->createSceneItem();
auto cubeMeshRenderer = cubeObject->addComponent<MeshRenderer>();
cubeMeshRenderer->mesh = std::make_shared<Mesh>();
TriangleMesh::createTriangleMesh(cubeMeshRenderer->mesh);
TriangleMesh::createTriangleMesh(*cubeMeshRenderer->mesh);
return DAWN_GAME_INIT_RESULT_SUCCESS;
}
int32_t DawnGame::update(float_t delta) {
this->renderManager.update();
if(this->scene != nullptr) this->scene->update();
auto meshRenderer = this->scene->findComponent<MeshRenderer>();
if(meshRenderer != nullptr) {
meshRenderer->mesh->draw(MESH_DRAW_MODE_TRIANGLES, 0, -1);
}
this->renderManager.update();
return DAWN_GAME_UPDATE_RESULT_SUCCESS;
}

View File

@ -12,10 +12,10 @@ int32_t main(int32_t argc, char **args) {
// Create the host
auto host = std::make_shared<DawnHost>();
auto game = std::make_shared<DawnGame>(host);
auto game = std::make_shared<DawnGame>(*host);
// Initialize the host and error check
result = host->init(std::weak_ptr<DawnGame>(game));
result = host->init(*game);
switch(result) {
case DAWN_HOST_INIT_RESULT_SUCCESS:
break;
@ -24,7 +24,7 @@ int32_t main(int32_t argc, char **args) {
}
// Request the main loop to start running.
result = host->start(std::weak_ptr<DawnGame>(game));
result = host->start(*game);
switch(result) {
case DAWN_HOST_START_RESULT_SUCCESS:
break;
@ -35,7 +35,7 @@ int32_t main(int32_t argc, char **args) {
}
// Main loop finished without errors, cleanup
host->unload(std::weak_ptr<DawnGame>(game));
host->unload(*game);
// Success
return 0;