Skip to content

Commit

Permalink
Fixed all "D3D11 WARNING: Live"
Browse files Browse the repository at this point in the history
  • Loading branch information
matt77hias committed Feb 22, 2017
1 parent 6990559 commit d59f82e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 28 deletions.
4 changes: 2 additions & 2 deletions MAGE/FPS/src/core/FPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ struct TestSetup : public EngineSetup {
: EngineSetup(hinstance, name) {}
virtual ~TestSetup() = default;

virtual Scene *CreateScene() const override {
return new TestScene();
virtual SharedPtr< Scene > CreateScene() const override {
return SharedPtr< Scene >(new TestScene());
}
};

Expand Down
7 changes: 6 additions & 1 deletion MAGE/MAGE/src/core/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ namespace mage {
// and sets the thread's concurrency model to multithreaded concurrency.
CoInitializeEx(nullptr, COINIT_MULTITHREADED);

// Sets the first scene.
SetScene(setup.CreateScene());

// The engine is fully loaded and ready to go.
SetLoaded();
}
Expand All @@ -62,6 +65,8 @@ namespace mage {
if (IsLoaded()) {
CoUninitialize();
}

delete g_device_enumeration;
}

HRESULT Engine::InitializeSystems(const EngineSetup &setup) {
Expand Down Expand Up @@ -104,7 +109,7 @@ namespace mage {
return S_OK;
}

void Engine::SetScene(Scene *scene) {
void Engine::SetScene(SharedPtr< Scene > scene) {
if (m_scene) {
m_scene->Close();
}
Expand Down
4 changes: 2 additions & 2 deletions MAGE/MAGE/src/core/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace mage {
@return A pointer to the scene to set.
*/
void SetScene(Scene *scene);
void SetScene(SharedPtr< Scene > scene);

protected:

Expand Down Expand Up @@ -199,7 +199,7 @@ namespace mage {
/**
The current scene of this engine.
*/
Scene *m_scene;
SharedPtr< Scene > m_scene;
};

/**
Expand Down
42 changes: 22 additions & 20 deletions MAGE/MAGE/src/core/engine_setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,6 @@ namespace mage {

public:

/**
Constructs an engine setup.
@param[in] hinstance
The application instance handle of the application.
@param[in] name
A reference to the name of the application.
*/
EngineSetup(HINSTANCE hinstance = nullptr, const wstring &name = MAGE_DEFAULT_APPLICATION_NAME)
: m_hinstance(hinstance), m_name(name) {}

/**
Constructs an engine setup from the given engine setup.
@param[in] setup
A reference to the engine setup.
*/
EngineSetup(const EngineSetup &setup) = default;

/**
Destructs this engine setup.
*/
Expand Down Expand Up @@ -77,7 +58,28 @@ namespace mage {
@return A pointer to the first scene of the application.
*/
virtual Scene *CreateScene() const = 0;
virtual SharedPtr< Scene > CreateScene() const = 0;

protected:

/**
Constructs an engine setup.
@param[in] hinstance
The application instance handle of the application.
@param[in] name
A reference to the name of the application.
*/
EngineSetup(HINSTANCE hinstance = nullptr, const wstring &name = MAGE_DEFAULT_APPLICATION_NAME)
: m_hinstance(hinstance), m_name(name) {}

/**
Constructs an engine setup from the given engine setup.
@param[in] setup
A reference to the engine setup.
*/
EngineSetup(const EngineSetup &setup) = default;

private:

Expand Down
2 changes: 1 addition & 1 deletion MAGE/MAGE/src/rendering/device_enumeration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace mage {
/**
A device enumeration.
*/
class DeviceEnumeration {
class DeviceEnumeration final {

friend class Engine;
friend INT_PTR CALLBACK SettingsDialogProcDelegate(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
Expand Down
7 changes: 5 additions & 2 deletions MAGE/MAGE/src/scene/scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ namespace mage {

public:

Scene(const string &name)
: m_name(name), m_world(new World()) {}
~Scene() = default;

const string &GetName() const {
Expand Down Expand Up @@ -104,6 +102,11 @@ namespace mage {
*/
virtual void Close();

protected:

Scene(const string &name)
: m_name(name), m_world(new World()) {}

private:

Scene(const Scene &scene) = delete;
Expand Down

0 comments on commit d59f82e

Please sign in to comment.