図1100a
図1100b
以下はDx12版のソリューションの内容です。
図1100c
このように、Dx11とDx12の違いはライブラリのDx11FullLibとDx12FullLib、そしてDx11LibとDx12Libのみ違います。
#pragma once
#include "stdafx.h"
namespace basecross {
//--------------------------------------------------------------------------------------
// ゲームステージクラス
//--------------------------------------------------------------------------------------
class GameStage : public Stage {
//ビューの作成
void CreateViewLight();
public:
//構築と破棄
GameStage() :Stage() {}
virtual ~GameStage() {}
//初期化
virtual void OnCreate()override;
};
}
//end basecross
//初期化
virtual void OnCreate()override;
#include "stdafx.h"
#include "Project.h"
namespace basecross {
//--------------------------------------------------------------------------------------
// ゲームステージクラス実体
//--------------------------------------------------------------------------------------
void GameStage::CreateViewLight() {
auto PtrView = CreateView<SingleView>();
//ビューのカメラの設定
auto PtrCamera = ObjectFactory::Create<Camera>();
PtrView->SetCamera(PtrCamera);
PtrCamera->SetEye(Vec3(0.0f, 5.0f, -5.0f));
PtrCamera->SetAt(Vec3(0.0f, 0.0f, 0.0f));
//マルチライトの作成
auto PtrMultiLight = CreateLight<MultiLight>();
//デフォルトのライティングを指定
PtrMultiLight->SetDefaultLighting();
}
void GameStage::OnCreate() {
try {
//ビューとライトの作成
CreateViewLight();
}
catch (...) {
throw;
}
}
}
//end basecross
#pragma once
#include "stdafx.h"
namespace basecross{
//--------------------------------------------------------------------------------------
/// ゲームシーン
//--------------------------------------------------------------------------------------
class Scene : public SceneBase{
public:
//--------------------------------------------------------------------------------------
/*!
@brief コンストラクタ
*/
//--------------------------------------------------------------------------------------
Scene() :SceneBase(){}
//--------------------------------------------------------------------------------------
/*!
@brief デストラクタ
*/
//--------------------------------------------------------------------------------------
virtual ~Scene();
//--------------------------------------------------------------------------------------
/*!
@brief 初期化
@return なし
*/
//--------------------------------------------------------------------------------------
virtual void OnCreate() override;
//--------------------------------------------------------------------------------------
/*!
@brief イベント取得
@return なし
*/
//--------------------------------------------------------------------------------------
virtual void OnEvent(const shared_ptr<Event>& event) override;
};
}
//end basecross
#include "stdafx.h"
#include "Project.h"
namespace basecross{
//--------------------------------------------------------------------------------------
/// ゲームシーン
//--------------------------------------------------------------------------------------
void Scene::OnCreate(){
try {
//クリアする色を設定
Col4 Col;
Col.set(31.0f / 255.0f, 30.0f / 255.0f, 71.0f / 255.0f, 255.0f / 255.0f);
SetClearColor(Col);
//自分自身にイベントを送る
//これにより各ステージやオブジェクトがCreate時にシーンにアクセスできる
PostEvent(0.0f, GetThis<ObjectInterface>(), GetThis<Scene>(), L"ToGameStage");
}
catch (...) {
throw;
}
}
Scene::~Scene() {
}
void Scene::OnEvent(const shared_ptr<Event>& event) {
if (event->m_MsgStr == L"ToGameStage") {
//最初のアクティブステージの設定
ResetActiveStage<GameStage>();
}
}
}
//end basecross
//自分自身にイベントを送る
//これにより各ステージやオブジェクトがCreate時にシーンにアクセスできる
PostEvent(0.0f, GetThis<ObjectInterface>(), GetThis<Scene>(), L"ToGameStage");
#pragma once
#include "stdafx.h"
namespace basecross{
//--------------------------------------------------------------------------------------
/// ゲームシーン
//--------------------------------------------------------------------------------------
class Scene : public SceneBase{
public:
//--------------------------------------------------------------------------------------
/*!
@brief コンストラクタ
*/
//--------------------------------------------------------------------------------------
Scene() :SceneBase(){}
//--------------------------------------------------------------------------------------
/*!
@brief デストラクタ
*/
//--------------------------------------------------------------------------------------
virtual ~Scene(){}
//--------------------------------------------------------------------------------------
/*!
@brief 初期化
@return なし
*/
//--------------------------------------------------------------------------------------
virtual void OnCreate() override;
};
}
//end basecross
#include "stdafx.h"
#include "Project.h"
namespace basecross{
//--------------------------------------------------------------------------------------
/// ゲームシーン
//--------------------------------------------------------------------------------------
void Scene::OnCreate(){
try {
//クリアする色を設定
Col4 Col;
Col.set(31.0f / 255.0f,30.0f / 255.0f,71.0f / 255.0f,255.0f / 255.0f);
SetClearColor(Col);
//最初のアクティブステージの設定
ResetActiveStage<GameStage>();
}
catch (...) {
throw;
}
}
}
//end basecross