-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameManager.h
More file actions
174 lines (131 loc) · 3.85 KB
/
GameManager.h
File metadata and controls
174 lines (131 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#pragma once
#include<chrono>
#include <thread>
#include<memory>
#include"DescriptorSetFactory.h"
#include"FrameBufferFactory.h"
#include"GpuBufferFactory.h"
#include"DescriptorSetLayoutFactory.h"
#include"PipelineLayoutFactory.h"
#include"PipelineFactory.h"
#include"RenderPassFactory.h"
#include"ShaderFactory.h"
#include"TextureFactory.h"
#include"CommandBufferFactory.h"
#include"ColiderFactory.h"
#include"GltfModelFactory.h"
#include"MaterialBuilder.h"
#include"SwapChain.h"
#include"Render.h"
#include"SkyDomeFactory.h"
#include"InputSystem.h"
#include"TransformComp.h"
#include"ColiderComp.h"
#include"GltfModelComp.h"
#include"MeshRendererComp.h"
#include"PhysicComp.h"
#include"LightComp.h"
#include"CameraComp.h"
#include"TargetEntityComp.h"
#include"SkyDomeComp.h"
#include"InputComp.h"
#include"ECSManager.h"
//fps制御などのゲーム全体の制御を担当する
class GameManager
{
private:
static GameManager* gameManager;
GLFWwindow* window;
std::shared_ptr<VulkanCore> vulkanCore;
//ECSマネージャー
std::shared_ptr<ECSManager> ecsManager;
//ビルダー
std::shared_ptr<DescriptorSetBuilder> descriptorSetBuilder;
std::shared_ptr<FrameBufferBuilder> frameBufferBuilder;
std::shared_ptr<GpuBufferBuilder> bufferBuilder;
std::shared_ptr<DescriptorSetLayoutBuilder> descriptorSetLayoutBuilder;
std::shared_ptr<PipelineLayoutBuilder> pipelineLayoutBuilder;
std::shared_ptr<PipelineBuilder> pipelineBuilder;
std::shared_ptr<RenderPassBuilder> renderPassBuilder;
std::shared_ptr<TextureBuilder> textureBuilder;
std::shared_ptr<SkyDomeBuilder> skydomeBuilder;
//ファクトリー
std::shared_ptr<DescriptorSetFactory> descriptorSetFactory;
std::shared_ptr<FrameBufferFactory> frameBufferFactory;
std::shared_ptr<GpuBufferFactory> bufferFactory;
std::shared_ptr<DescriptorSetLayoutFactory> descriptorSetLayoutFactory;
std::shared_ptr<PipelineLayoutFactory> pipelineLayoutFactory;
std::shared_ptr<PipelineFactory> pipelineFactory;
std::shared_ptr<RenderPassFactory> renderPassFactory;
std::shared_ptr<ShaderFactory> shaderFactory;
std::shared_ptr<TextureFactory> textureFactory;
std::shared_ptr<SkyDomeFactory> skydomeFactory;
std::shared_ptr<CommandBufferFactory> commandBufferFactory;
std::shared_ptr<ColiderFactory> coliderFactory;
//キー入力を受け取る
std::shared_ptr<InputSystem> inputSystem;
//スワップチェーンのクラス
std::shared_ptr<SwapChain> swapChain;
//レンダー用のコマンドバッファ
std::vector<std::shared_ptr<CommandBuffer>> renderCommand;
//レンダークラス
std::shared_ptr<Render> render;
//マテリアルビルダー
std::shared_ptr<MaterialBuilder> materialBuilder;
//Gltfモデルファクトリー
std::shared_ptr<GltfModelFactory> modelFactory;
//シーン全体のライト
std::shared_ptr<SceneLight> sceneLight;
//最大フレームレート
const int fps = 60;
//最大フレームレート時のフレームの経過時間
float frameDuration;
//時間の計測用変数
std::chrono::system_clock::time_point start, end;
//計測したフレーム時間
long long elapsed;
//ゲーム全体の上ベクトル
const glm::vec3 upVector = { 0.0f,-1.0f,0.0f };
//インスタンスを作成する
void createInstance();
//ビルダーの用意
void createBuilder();
//ファクトリーの用意
void createFactory();
//レンダー用コマンドバッファの作成
void createRenderCommand();
void setLoadUI();
//コンポーネントの初回処理
void OnStart();
//コンポーネントの更新処理
void OnUpdate();
//更新処理後の処理
void OnLateUpdate();
//オブジェクトのレンダリング
void Rendering();
//フレーム終了時の処理
void OnFrameEnd();
public:
static GameManager* GetInstance()
{
if (!gameManager)
{
gameManager = new GameManager();
}
return gameManager;
}
void setWindow(GLFWwindow* w)
{
window = w;
}
//ゲームのフレームレートの設定やステージの読み込みを行う
void initGame();
//シーンの作成
void createScene();
//メインループ
void mainGameLoop();
//ステージから出る
void exitScene();
//ゲーム全体の終了処理
void FinishGame();
};