質問編集履歴
8
文章を修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
提示コードのStage.hpp部でBlock.hppをインクルードすると以下の提示画像のエラーが発生します。また**Block.hppのインクルードをコメントアウトすると正常にコンパイル出来ます。**これはどうしてでしょうか?
|
1
|
+
提示コードのStage.hpp部でBlock.hppをインクルードすると以下の提示画像のエラーが発生します。また**Block.hppのインクルードをコメントアウトすると正常にコンパイル出来ます。**これはどうしてでしょうか? 全てのヘッダーにインクルードガードを実装してすべてソースファイルも定義しています。なぜなのでしょうか?
|
2
2
|
|
3
3
|
glmはglmライブラリです。
|
4
4
|
|
@@ -6,14 +6,7 @@
|
|
6
6
|
|
7
7
|

|
8
8
|
|
9
|
-
```hpp
|
10
|
-
#include "../Collision.hpp"
|
11
|
-
#include "../Actor_2D.hpp"
|
12
|
-
#include "../Sprite.hpp"
|
13
|
-
```
|
14
9
|
|
15
|
-
|
16
|
-
|
17
10
|
```.hpp
|
18
11
|
// MapChip.hpp
|
19
12
|
#define ___MAPCHIP_HPP_
|
@@ -264,4 +257,83 @@
|
|
264
257
|
void ExitEntryKey(); //ゲーム終了
|
265
258
|
};
|
266
259
|
#endif
|
260
|
+
```
|
261
|
+
|
262
|
+
```hpp
|
263
|
+
//Sprite.hpp
|
264
|
+
#ifndef ___SPRITE_HPP_
|
265
|
+
#define ___SPRITE_HPP_
|
266
|
+
|
267
|
+
//自作ヘッダー
|
268
|
+
#include "Transform_2D.hpp"
|
269
|
+
#include "Shader.hpp"
|
270
|
+
#include "VertexData.hpp"
|
271
|
+
#include "LoadTexture.hpp"
|
272
|
+
|
273
|
+
//標準ヘッダー関係
|
274
|
+
#include "stdio.h"
|
275
|
+
#include <fstream>
|
276
|
+
#include <sstream>
|
277
|
+
#include <iostream>
|
278
|
+
#include <vector>
|
279
|
+
#include <crtdbg.h>
|
280
|
+
|
281
|
+
|
282
|
+
//OpenGL関係
|
283
|
+
#include "GLEW/include/GL/glew.h"
|
284
|
+
#include "gl/GL.h"
|
285
|
+
#include "GLFW/include/GLFW/glfw3.h"
|
286
|
+
|
287
|
+
// OpenCV
|
288
|
+
#include "opencv2/opencv.hpp"
|
289
|
+
|
290
|
+
//数学ライブラリ
|
291
|
+
#include "glm/ext.hpp"
|
292
|
+
#include "glm/glm.hpp"
|
293
|
+
//#include "Entry.hpp"
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
/*###############################################################################################################
|
299
|
+
# スプライト描画
|
300
|
+
#################################################################################################################*/
|
301
|
+
|
302
|
+
class Entry;
|
303
|
+
struct TextureData;
|
304
|
+
class Sprite : public Transform_2D
|
305
|
+
{
|
306
|
+
public:
|
307
|
+
|
308
|
+
Sprite(class Entry* g, std::shared_ptr<TextureData> sp); //コンストラクタ
|
309
|
+
~Sprite(); //デストラクタ
|
310
|
+
Sprite(const Sprite& sp); //コピーコンストラクタ
|
311
|
+
void DrawGraph(glm::ivec2 pos,glm::vec2 start,glm::vec2 end); //
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
glm::vec2 getSize();
|
316
|
+
|
317
|
+
private:
|
318
|
+
|
319
|
+
|
320
|
+
VertexAttribute_2D vertex[6]; //頂点データ
|
321
|
+
|
322
|
+
class Entry* Entry; //Entry クラス
|
323
|
+
|
324
|
+
|
325
|
+
glm::vec2 mPicSize; //画像サイズ
|
326
|
+
|
327
|
+
|
328
|
+
//OpenGL 関係
|
329
|
+
GLuint VAO;
|
330
|
+
GLuint VBO;
|
331
|
+
GLuint IBO;
|
332
|
+
GLuint TextureID; //テクスチャID
|
333
|
+
|
334
|
+
std::shared_ptr<class Shader> shader; //シェーダープログラム
|
335
|
+
class Entry *Owner;//Entryクラス
|
336
|
+
};
|
337
|
+
|
338
|
+
#endif;
|
267
339
|
```
|
7
文章と提示コードを修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,94 +1,140 @@
|
|
1
|
-
提示コードで
|
1
|
+
提示コードのStage.hpp部でBlock.hppをインクルードすると以下の提示画像のエラーが発生します。また**Block.hppのインクルードをコメントアウトすると正常にコンパイル出来ます。**これはどうしてでしょうか? 以下の提示インクルードコードは流石に関係ないので載せません。文字数の関係もありますが。これはどうしたらいいでしょうか? 全てのヘッダーにインクルードガードを実装してすべてソースファイルも定義しています。なぜなのでしょうか?
|
2
2
|
|
3
|
+
glmはglmライブラリです。
|
3
4
|
|
4
|
-
エラー「 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
5
|
-
エラー C2061 構文エラー: 識別子 'TextureUV' OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\Block.hpp 22
|
6
|
-
」
|
7
5
|
|
8
|
-
エラー「 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
9
|
-
エラー C2065 'MapChip': 定義されていない識別子です。 OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\Block.hpp 32
|
10
|
-
」
|
11
6
|
|
12
|
-
|
7
|
+

|
13
|
-
エラー C2065 'Sprite': 定義されていない識別子です。 OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\MapChip.hpp 33
|
14
|
-
」
|
15
8
|
|
16
|
-
|
17
9
|
```hpp
|
10
|
+
#include "../Collision.hpp"
|
11
|
+
#include "../Actor_2D.hpp"
|
18
|
-
|
12
|
+
#include "../Sprite.hpp"
|
19
|
-
|
13
|
+
```
|
20
|
-
#define BLOCK__HPP_
|
21
14
|
|
22
|
-
#include "MapChip.hpp"///////////////////////////////////////////
|
23
|
-
#include "../LoadTexture.hpp"////////////////////////////////////
|
24
|
-
#include "../Actor_2D.hpp"///////////////////////////////////////
|
25
15
|
|
26
16
|
|
17
|
+
```.hpp
|
27
|
-
|
18
|
+
// MapChip.hpp
|
28
|
-
#
|
19
|
+
#define ___MAPCHIP_HPP_
|
20
|
+
|
29
21
|
#include <iostream>
|
22
|
+
#include "glm/glm.hpp"
|
30
23
|
|
24
|
+
// 自作 関係
|
25
|
+
#include "../LoadTexture.hpp"
|
26
|
+
#include "../Collision.hpp"
|
31
|
-
|
27
|
+
#include "../Actor_2D.hpp"
|
28
|
+
#include "../Sprite.hpp"
|
32
29
|
|
30
|
+
|
31
|
+
|
32
|
+
/*####################################################
|
33
|
+
* マップチップ 描画クラス
|
34
|
+
######################################################*/
|
35
|
+
|
36
|
+
class Sprite;
|
37
|
+
struct TextureData;
|
38
|
+
|
39
|
+
class MapChip : public Actor_2D
|
40
|
+
{
|
33
41
|
public:
|
34
|
-
|
42
|
+
MapChip(Entry* e, std::shared_ptr<TextureData> data, glm::ivec2 pos, TextureUV size, bool col); //
|
43
|
+
MapChip(); //
|
35
|
-
|
44
|
+
MapChip(const MapChip& m); //
|
36
|
-
|
45
|
+
~MapChip(); //
|
37
|
-
~Block();
|
38
46
|
|
39
47
|
void Update() override;
|
40
48
|
void Draw() override;
|
41
49
|
|
50
|
+
Box_Collision_2D mCol;
|
51
|
+
|
42
52
|
private:
|
43
53
|
|
44
|
-
std::
|
54
|
+
std::shared_ptr<Sprite> mSprite;
|
55
|
+
std::shared_ptr<TextureData> Data;
|
56
|
+
|
57
|
+
TextureUV UV;
|
58
|
+
glm::ivec2 colSize;
|
59
|
+
|
60
|
+
|
45
61
|
};
|
46
|
-
|
47
62
|
#endif
|
48
63
|
```
|
49
64
|
|
50
|
-
```hpp
|
65
|
+
```.hpp
|
51
|
-
//
|
66
|
+
//Block.hpp
|
52
67
|
|
53
|
-
#ifndef
|
68
|
+
#ifndef ___BLOCK_HPP
|
54
|
-
#define
|
69
|
+
#define ___BLOCK_HPP
|
55
70
|
|
71
|
+
#include "../Actor_2D.hpp"
|
56
|
-
#include "
|
72
|
+
#include "../Entry.hpp"
|
73
|
+
#include "../LoadTexture.hpp"
|
74
|
+
#include "MapChip.hpp"
|
57
75
|
|
58
|
-
|
76
|
+
|
59
|
-
|
77
|
+
class Block : public Actor_2D
|
60
78
|
{
|
79
|
+
public:
|
61
|
-
glm::
|
80
|
+
Block(Entry* e, std::shared_ptr<TextureData> data, TextureUV uv, glm::ivec2 pos);
|
62
|
-
|
81
|
+
~Block();
|
63
82
|
|
83
|
+
void Update() override;
|
64
|
-
|
84
|
+
void Draw() override;
|
65
85
|
|
86
|
+
std::vector<MapChip> block;
|
87
|
+
|
88
|
+
};
|
89
|
+
|
90
|
+
|
91
|
+
#endif
|
92
|
+
|
93
|
+
```
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
```.hpp
|
98
|
+
//Stage.hpp
|
99
|
+
|
100
|
+
#ifndef ___STAGE_HPP_
|
101
|
+
#define ___STAGE_HPP_
|
102
|
+
|
103
|
+
|
104
|
+
#include <glm/glm.hpp>
|
105
|
+
#include <iostream>
|
106
|
+
#include <vector>
|
107
|
+
|
108
|
+
#include "Block.hpp"
|
109
|
+
|
66
|
-
class
|
110
|
+
class Stage
|
67
111
|
{
|
68
112
|
public:
|
69
|
-
Actor_2D(); //コンストラクタ
|
70
|
-
~Actor_2D(); //デストラクタ
|
71
113
|
|
114
|
+
Stage(Entry * e); //コンストラクタ
|
72
|
-
|
115
|
+
~Stage(); //デストラクタ
|
73
|
-
virtual void Draw() = 0;
|
74
|
-
protected:
|
75
116
|
|
76
|
-
glm::ivec2 mPosition; //座標
|
77
|
-
glm::ivec2 mScale; //スケール
|
78
|
-
|
117
|
+
void Update();
|
79
|
-
|
80
|
-
|
118
|
+
void Draw();
|
81
119
|
|
120
|
+
|
121
|
+
private:
|
122
|
+
|
123
|
+
|
124
|
+
std::vector<Block> block;
|
125
|
+
|
82
126
|
class Entry* Owner;
|
83
|
-
|
127
|
+
|
84
128
|
};
|
85
129
|
|
130
|
+
|
86
131
|
#endif
|
87
132
|
|
88
133
|
```
|
134
|
+
|
135
|
+
|
89
136
|
```hpp
|
90
137
|
//LoadTexture.hpp
|
91
|
-
|
92
138
|
#ifndef ___TEXTURE_HPP_
|
93
139
|
#define ___TEXTURE_HPP_
|
94
140
|
|
@@ -102,7 +148,7 @@
|
|
102
148
|
|
103
149
|
|
104
150
|
// 描画UV座標を指定
|
105
|
-
|
151
|
+
|
106
152
|
typedef struct TextureUV
|
107
153
|
{
|
108
154
|
glm::vec2 start;
|
@@ -111,7 +157,6 @@
|
|
111
157
|
}TextureUV;
|
112
158
|
|
113
159
|
// テクスチャデータ
|
114
|
-
struct TextureData;
|
115
160
|
typedef struct TextureData
|
116
161
|
{
|
117
162
|
std::shared_ptr<std::vector<Byte>> mData; //画像データ
|
@@ -132,51 +177,91 @@
|
|
132
177
|
#endif
|
133
178
|
|
134
179
|
```
|
135
|
-
```hpp
|
136
|
-
//MapChip.hpp
|
137
180
|
|
181
|
+
```.hpp
|
182
|
+
//Entry.hpp
|
138
|
-
#ifndef
|
183
|
+
#ifndef ___ENTRY_H_
|
139
|
-
#define
|
184
|
+
#define ___ENTRY_H_
|
185
|
+
|
186
|
+
#define SCREEN_WIDTH ((float)(16.0f * 60.0f)) //画面の横
|
187
|
+
#define SCREEN_HEIGHT ((float)(9.0f * 60.0f)) //画面の縦
|
188
|
+
#define PI ((float)3.14159265359f) //円周率
|
189
|
+
|
190
|
+
|
191
|
+
//自作ヘッダー 関係
|
192
|
+
#include "Camera.hpp"
|
193
|
+
#include "Text.hpp"
|
194
|
+
#include "Sprite.hpp"
|
195
|
+
#include "Input.hpp"
|
196
|
+
//#include "Sound.hpp"
|
197
|
+
//#include "LoadTexture.hpp"
|
198
|
+
//#include "Rectangle.hpp"
|
199
|
+
//#include "Circle.hpp"
|
200
|
+
#include "Actor_2D.hpp"
|
201
|
+
|
202
|
+
// テスト 関係
|
203
|
+
#include "../Header/Game/Scene.hpp"
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
//標準ヘッダー関係
|
211
|
+
#include "stdio.h"
|
140
212
|
#include <iostream>
|
213
|
+
#include <vector>
|
141
|
-
#include
|
214
|
+
#include <time.h>
|
215
|
+
#include <random>
|
142
216
|
|
217
|
+
//OpenGL関係
|
218
|
+
#include <GLEW/include/GL/glew.h>
|
219
|
+
#include <gl/GL.h>
|
220
|
+
#include <GLFW/include/GLFW/glfw3.h>
|
143
221
|
|
222
|
+
//OpenAL関係
|
144
|
-
#include
|
223
|
+
#include <OpenAL/include/al.h>
|
145
|
-
#include "../Collision.hpp"
|
146
|
-
#include
|
224
|
+
#include <OpenAL/include/alc.h>
|
147
|
-
#include "../Sprite.hpp"
|
148
225
|
|
226
|
+
//OpenCV 関係
|
227
|
+
#include <opencv2/opencv.hpp>
|
149
228
|
|
229
|
+
//数学ライブラリ
|
230
|
+
#include "glm/ext.hpp"
|
150
231
|
|
232
|
+
|
151
|
-
/*####################################################
|
233
|
+
/*###############################################################################################################
|
152
|
-
|
234
|
+
# GLmain
|
153
|
-
######################################################*/
|
235
|
+
#################################################################################################################*/
|
236
|
+
|
154
|
-
class
|
237
|
+
class Entry
|
155
238
|
{
|
239
|
+
|
156
240
|
public:
|
157
|
-
MapChip(Entry* e, std::shared_ptr<TextureData> data, glm::ivec2 pos, TextureUV size, bool col); //
|
158
|
-
MapChip(); //
|
159
|
-
MapChip(const MapChip& m); //
|
160
|
-
~MapChip(); //
|
161
241
|
|
242
|
+
Entry(); //コンストラクタ
|
243
|
+
~Entry(); //デスストラクタ
|
244
|
+
bool Initialization(); //初期化
|
245
|
+
bool RunLoop(); //メインループ
|
162
|
-
void Update()
|
246
|
+
void Update(); //計算
|
163
|
-
void
|
247
|
+
void GenerateOutput(); //描画
|
248
|
+
|
249
|
+
GLFWwindow* GL_Window = nullptr; //OpenGLコンテキスト
|
250
|
+
ALCdevice* AL_Device = nullptr; //デバイス
|
251
|
+
ALCcontext* AL_Context = nullptr; //コンテキスト
|
252
|
+
|
253
|
+
glm::ivec2 getWindowSize(); //画面サイズを取得
|
164
254
|
|
255
|
+
private: // ####################################################################################################################################################################
|
165
|
-
|
256
|
+
std::unique_ptr<class Input> mInput;
|
166
257
|
|
167
258
|
|
168
|
-
|
259
|
+
std::unique_ptr<class Scene> scene; //
|
169
260
|
|
170
|
-
std::shared_ptr<Sprite> mSprite;
|
171
|
-
std::shared_ptr<TextureData> Data;
|
172
261
|
|
173
|
-
TextureUV UV;
|
174
|
-
glm::ivec2 colSize;
|
175
262
|
|
176
|
-
|
263
|
+
bool mIsRunLoop; //メインループ
|
264
|
+
void ExitEntryKey(); //ゲーム終了
|
177
265
|
};
|
178
|
-
|
179
266
|
#endif
|
180
|
-
|
181
|
-
|
182
267
|
```
|
6
提示コードを修正、文章も修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,62 +1,94 @@
|
|
1
|
-
提示コードですが
|
1
|
+
提示コードですがBlock.hppのコード部で以下のエラーが発生します。**定義されいませんと表示されますがしっかり定義されています**。インクルードされているのですがなぜでしょうか?原因がどうしてもわかりません。**インクルードでインクルードされていないた確かめました。またインクルードカードも確認しました**がやはり原因がわかりませんどうすればいいのでしょか?
|
2
|
-
下記のコードでstruct TextureUVは定義済みなのですがなぜ未定義と表示されるのでしょうか?原因がわかりません。
|
3
|
-
Sprite.hppはの載せましたが他は標準ヘッダーしかインクルードしてないので流石に関係ないと思います。
|
4
2
|
|
5
3
|
|
4
|
+
エラー「 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
5
|
+
エラー C2061 構文エラー: 識別子 'TextureUV' OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\Block.hpp 22
|
6
|
+
」
|
6
7
|
|
7
8
|
エラー「 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
8
|
-
エラー
|
9
|
+
エラー C2065 'MapChip': 定義されていない識別子です。 OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\Block.hpp 32
|
9
10
|
」
|
10
11
|
|
12
|
+
エラー「 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
13
|
+
エラー C2065 'Sprite': 定義されていない識別子です。 OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\MapChip.hpp 33
|
14
|
+
」
|
15
|
+
|
16
|
+
|
11
17
|
```hpp
|
12
|
-
//
|
18
|
+
// Block.hpp
|
13
|
-
#ifndef
|
19
|
+
#ifndef BLOCK__HPP_
|
14
|
-
#define
|
20
|
+
#define BLOCK__HPP_
|
15
|
-
#include <iostream>
|
16
|
-
#include "glm/glm.hpp"
|
17
21
|
|
22
|
+
#include "MapChip.hpp"///////////////////////////////////////////
|
23
|
+
#include "../LoadTexture.hpp"////////////////////////////////////
|
24
|
+
#include "../Actor_2D.hpp"///////////////////////////////////////
|
18
25
|
|
19
|
-
#include "../LoadTexture.hpp"
|
20
|
-
#include "../Collision.hpp"
|
21
|
-
#include "../Actor_2D.hpp"
|
22
|
-
#include "../Sprite.hpp"
|
23
26
|
|
27
|
+
#include <array>
|
28
|
+
#include <vector>
|
29
|
+
#include <iostream>
|
24
30
|
|
31
|
+
class Block : Actor_2D{
|
25
32
|
|
26
|
-
/*####################################################
|
27
|
-
* マップチップ 描画クラス
|
28
|
-
######################################################*/
|
29
|
-
class MapChip : public Actor_2D
|
30
|
-
{
|
31
33
|
public:
|
32
|
-
|
34
|
+
Block(Entry* e, glm::ivec2 pos, std::shared_ptr<TextureData> data, TextureUV uv, bool col);
|
33
|
-
MapChip(); //
|
34
|
-
|
35
|
+
Block(const Block &b);
|
35
|
-
|
36
|
+
Block& operator = (const Block& b);
|
37
|
+
~Block();
|
36
38
|
|
37
39
|
void Update() override;
|
38
40
|
void Draw() override;
|
39
41
|
|
40
|
-
|
42
|
+
private:
|
41
43
|
|
44
|
+
std::vector<MapChip> mBlock;
|
45
|
+
};
|
42
46
|
|
43
|
-
|
47
|
+
#endif
|
48
|
+
```
|
44
49
|
|
45
|
-
|
50
|
+
```hpp
|
46
|
-
|
51
|
+
//Actor_2D.hpp
|
47
52
|
|
48
|
-
|
53
|
+
#ifndef ___ACTOR_HPP__
|
49
|
-
|
54
|
+
#define ___ACTOR_HPP__
|
50
55
|
|
56
|
+
#include "glm/glm.hpp"
|
51
57
|
|
58
|
+
// 描画UV座標
|
59
|
+
typedef struct DrawUV
|
60
|
+
{
|
61
|
+
glm::vec2 start; //ここから
|
62
|
+
glm::vec2 end; //ここまで
|
63
|
+
|
64
|
+
}DrawUV;
|
65
|
+
|
66
|
+
class Actor_2D
|
67
|
+
{
|
68
|
+
public:
|
69
|
+
Actor_2D(); //コンストラクタ
|
70
|
+
~Actor_2D(); //デストラクタ
|
71
|
+
|
72
|
+
virtual void Update() = 0;
|
73
|
+
virtual void Draw() = 0;
|
74
|
+
protected:
|
75
|
+
|
76
|
+
glm::ivec2 mPosition; //座標
|
77
|
+
glm::ivec2 mScale; //スケール
|
78
|
+
float mRadian; //回転
|
79
|
+
|
80
|
+
glm::ivec2 mVector; //方向
|
81
|
+
|
82
|
+
class Entry* Owner;
|
83
|
+
private:
|
52
84
|
};
|
53
85
|
|
54
86
|
#endif
|
55
87
|
|
56
88
|
```
|
57
|
-
|
58
89
|
```hpp
|
59
90
|
//LoadTexture.hpp
|
91
|
+
|
60
92
|
#ifndef ___TEXTURE_HPP_
|
61
93
|
#define ___TEXTURE_HPP_
|
62
94
|
|
@@ -100,83 +132,51 @@
|
|
100
132
|
#endif
|
101
133
|
|
102
134
|
```
|
103
|
-
|
104
|
-
|
105
135
|
```hpp
|
106
|
-
//
|
136
|
+
//MapChip.hpp
|
107
|
-
#ifndef ___SPRITE_HPP_
|
108
|
-
#define ___SPRITE_HPP_
|
109
137
|
|
110
|
-
//自作ヘッダー
|
111
|
-
#include "Transform_2D.hpp"
|
112
|
-
#include "Shader.hpp"
|
113
|
-
#include "VertexData.hpp"
|
114
|
-
#include "LoadTexture.hpp"
|
115
|
-
|
116
|
-
//標準ヘッダー関係
|
117
|
-
#include "stdio.h"
|
118
|
-
#
|
138
|
+
#ifndef ___MAPCHIP_HPP_
|
119
|
-
#
|
139
|
+
#define ___MAPCHIP_HPP_
|
120
140
|
#include <iostream>
|
121
|
-
#include <vector>
|
122
|
-
#include <crtdbg.h>
|
123
|
-
|
124
|
-
|
125
|
-
//OpenGL関係
|
126
|
-
#include "GLEW/include/GL/glew.h"
|
127
|
-
#include "gl/GL.h"
|
128
|
-
#include "GLFW/include/GLFW/glfw3.h"
|
129
|
-
|
130
|
-
// OpenCV
|
131
|
-
#include "opencv2/opencv.hpp"
|
132
|
-
|
133
|
-
//数学ライブラリ
|
134
|
-
#include "glm/ext.hpp"
|
135
141
|
#include "glm/glm.hpp"
|
136
|
-
//#include "Entry.hpp"
|
137
142
|
|
138
143
|
|
144
|
+
#include "../LoadTexture.hpp"
|
145
|
+
#include "../Collision.hpp"
|
146
|
+
#include "../Actor_2D.hpp"
|
147
|
+
#include "../Sprite.hpp"
|
139
148
|
|
140
149
|
|
141
|
-
/*###############################################################################################################
|
142
|
-
# スプライト描画
|
143
|
-
#################################################################################################################*/
|
144
150
|
|
151
|
+
/*####################################################
|
145
|
-
|
152
|
+
* マップチップ 描画クラス
|
146
|
-
|
153
|
+
######################################################*/
|
147
|
-
class
|
154
|
+
class MapChip : public Actor_2D
|
148
155
|
{
|
149
156
|
public:
|
150
|
-
|
151
|
-
|
157
|
+
MapChip(Entry* e, std::shared_ptr<TextureData> data, glm::ivec2 pos, TextureUV size, bool col); //
|
158
|
+
MapChip(); //
|
159
|
+
MapChip(const MapChip& m); //
|
152
|
-
~
|
160
|
+
~MapChip(); //
|
153
|
-
Sprite(const Sprite& sp); //コピーコンストラクタ
|
154
|
-
void DrawGraph(glm::ivec2 pos,glm::vec2 start,glm::vec2 end); //
|
155
|
-
|
156
161
|
|
162
|
+
void Update() override;
|
163
|
+
void Draw() override;
|
157
164
|
|
158
|
-
|
165
|
+
Box_Collision_2D mCol;
|
159
166
|
|
167
|
+
|
160
168
|
private:
|
161
169
|
|
162
|
-
|
163
|
-
VertexAttribute_2D vertex[6]; //頂点データ
|
164
|
-
|
165
|
-
|
170
|
+
std::shared_ptr<Sprite> mSprite;
|
171
|
+
std::shared_ptr<TextureData> Data;
|
166
172
|
|
167
|
-
|
173
|
+
TextureUV UV;
|
168
|
-
glm::
|
174
|
+
glm::ivec2 colSize;
|
169
175
|
|
170
176
|
|
171
|
-
//OpenGL 関係
|
172
|
-
GLuint VAO;
|
173
|
-
GLuint VBO;
|
174
|
-
GLuint IBO;
|
175
|
-
GLuint TextureID; //テクスチャID
|
176
|
-
|
177
|
-
std::shared_ptr<class Shader> shader; //シェーダープログラム
|
178
|
-
class Entry *Owner;//Entryクラス
|
179
177
|
};
|
180
178
|
|
181
|
-
#endif
|
179
|
+
#endif
|
180
|
+
|
181
|
+
|
182
182
|
```
|
5
提示コードを修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
エラー C2079 'MapChip::UV' が 未定義の struct 'TextureUV' で使用しています。 OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\MapChip.hpp 37
|
9
9
|
」
|
10
10
|
|
11
|
-
```
|
11
|
+
```hpp
|
12
12
|
//MapChip.cpp
|
13
13
|
#ifndef ___MAPCHIP_HPP_
|
14
14
|
#define ___MAPCHIP_HPP_
|
4
文章を修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
提示コードですがコンパイルエラの以下のエラーが発生してしまいコンパイル出来ません、これはどうすればいいのでしょうか?
|
2
2
|
下記のコードでstruct TextureUVは定義済みなのですがなぜ未定義と表示されるのでしょうか?原因がわかりません。
|
3
|
+
Sprite.hppはの載せましたが他は標準ヘッダーしかインクルードしてないので流石に関係ないと思います。
|
3
4
|
|
4
5
|
|
5
6
|
|
6
|
-
|
7
|
-
|
8
7
|
エラー「 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
9
8
|
エラー C2079 'MapChip::UV' が 未定義の struct 'TextureUV' で使用しています。 OpenGL C:\Users\yw325\Desktop\OpenGL\OpenGL\Header\Game\MapChip.hpp 37
|
10
9
|
」
|
@@ -100,4 +99,84 @@
|
|
100
99
|
|
101
100
|
#endif
|
102
101
|
|
102
|
+
```
|
103
|
+
|
104
|
+
|
105
|
+
```hpp
|
106
|
+
//Sprite.hpp
|
107
|
+
#ifndef ___SPRITE_HPP_
|
108
|
+
#define ___SPRITE_HPP_
|
109
|
+
|
110
|
+
//自作ヘッダー
|
111
|
+
#include "Transform_2D.hpp"
|
112
|
+
#include "Shader.hpp"
|
113
|
+
#include "VertexData.hpp"
|
114
|
+
#include "LoadTexture.hpp"
|
115
|
+
|
116
|
+
//標準ヘッダー関係
|
117
|
+
#include "stdio.h"
|
118
|
+
#include <fstream>
|
119
|
+
#include <sstream>
|
120
|
+
#include <iostream>
|
121
|
+
#include <vector>
|
122
|
+
#include <crtdbg.h>
|
123
|
+
|
124
|
+
|
125
|
+
//OpenGL関係
|
126
|
+
#include "GLEW/include/GL/glew.h"
|
127
|
+
#include "gl/GL.h"
|
128
|
+
#include "GLFW/include/GLFW/glfw3.h"
|
129
|
+
|
130
|
+
// OpenCV
|
131
|
+
#include "opencv2/opencv.hpp"
|
132
|
+
|
133
|
+
//数学ライブラリ
|
134
|
+
#include "glm/ext.hpp"
|
135
|
+
#include "glm/glm.hpp"
|
136
|
+
//#include "Entry.hpp"
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
/*###############################################################################################################
|
142
|
+
# スプライト描画
|
143
|
+
#################################################################################################################*/
|
144
|
+
|
145
|
+
class Entry;
|
146
|
+
struct TextureData;
|
147
|
+
class Sprite : public Transform_2D
|
148
|
+
{
|
149
|
+
public:
|
150
|
+
|
151
|
+
Sprite(class Entry* g, std::shared_ptr<TextureData> sp); //コンストラクタ
|
152
|
+
~Sprite(); //デストラクタ
|
153
|
+
Sprite(const Sprite& sp); //コピーコンストラクタ
|
154
|
+
void DrawGraph(glm::ivec2 pos,glm::vec2 start,glm::vec2 end); //
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
glm::vec2 getSize();
|
159
|
+
|
160
|
+
private:
|
161
|
+
|
162
|
+
|
163
|
+
VertexAttribute_2D vertex[6]; //頂点データ
|
164
|
+
|
165
|
+
class Entry* Entry; //Entry クラス
|
166
|
+
|
167
|
+
|
168
|
+
glm::vec2 mPicSize; //画像サイズ
|
169
|
+
|
170
|
+
|
171
|
+
//OpenGL 関係
|
172
|
+
GLuint VAO;
|
173
|
+
GLuint VBO;
|
174
|
+
GLuint IBO;
|
175
|
+
GLuint TextureID; //テクスチャID
|
176
|
+
|
177
|
+
std::shared_ptr<class Shader> shader; //シェーダープログラム
|
178
|
+
class Entry *Owner;//Entryクラス
|
179
|
+
};
|
180
|
+
|
181
|
+
#endif;
|
103
182
|
```
|
3
文章を編集しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,27 +10,20 @@
|
|
10
10
|
」
|
11
11
|
|
12
12
|
```cpp
|
13
|
+
//MapChip.cpp
|
13
14
|
#ifndef ___MAPCHIP_HPP_
|
14
15
|
#define ___MAPCHIP_HPP_
|
16
|
+
#include <iostream>
|
15
|
-
#include "
|
17
|
+
#include "glm/glm.hpp"
|
16
18
|
|
17
19
|
|
18
|
-
//#include "Scene.hpp"
|
19
|
-
#include "
|
20
|
+
#include "../LoadTexture.hpp"
|
20
|
-
#include <iostream>
|
21
|
-
|
22
21
|
#include "../Collision.hpp"
|
23
22
|
#include "../Actor_2D.hpp"
|
23
|
+
#include "../Sprite.hpp"
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
// 前方宣言
|
28
|
-
class Entry;
|
29
|
-
class Sprite;
|
30
|
-
struct TextureUV;
|
31
|
-
struct TextureData;
|
32
|
-
class Box_Collision_2D;
|
33
|
-
|
34
27
|
/*####################################################
|
35
28
|
* マップチップ 描画クラス
|
36
29
|
######################################################*/
|
@@ -47,9 +40,7 @@
|
|
47
40
|
|
48
41
|
Box_Collision_2D mCol;
|
49
42
|
|
50
|
-
|
51
43
|
|
52
|
-
|
53
44
|
private:
|
54
45
|
|
55
46
|
std::shared_ptr<Sprite> mSprite;
|
@@ -65,7 +56,8 @@
|
|
65
56
|
|
66
57
|
```
|
67
58
|
|
68
|
-
```
|
59
|
+
```hpp
|
60
|
+
//LoadTexture.hpp
|
69
61
|
#ifndef ___TEXTURE_HPP_
|
70
62
|
#define ___TEXTURE_HPP_
|
71
63
|
|
2
文章を修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
#include "../LoadTexture.hpp"
|
16
16
|
|
17
17
|
|
18
|
-
#include "Scene.hpp"
|
18
|
+
//#include "Scene.hpp"
|
19
19
|
#include "glm/glm.hpp"
|
20
20
|
#include <iostream>
|
21
21
|
|
@@ -63,7 +63,6 @@
|
|
63
63
|
|
64
64
|
#endif
|
65
65
|
|
66
|
-
|
67
66
|
```
|
68
67
|
|
69
68
|
```cpp
|
1
文章を修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,15 +12,18 @@
|
|
12
12
|
```cpp
|
13
13
|
#ifndef ___MAPCHIP_HPP_
|
14
14
|
#define ___MAPCHIP_HPP_
|
15
|
+
#include "../LoadTexture.hpp"
|
15
16
|
|
17
|
+
|
16
18
|
#include "Scene.hpp"
|
17
19
|
#include "glm/glm.hpp"
|
18
20
|
#include <iostream>
|
19
21
|
|
20
22
|
#include "../Collision.hpp"
|
21
|
-
#include "../LoadTexture.hpp"
|
22
23
|
#include "../Actor_2D.hpp"
|
23
24
|
|
25
|
+
|
26
|
+
|
24
27
|
// 前方宣言
|
25
28
|
class Entry;
|
26
29
|
class Sprite;
|
@@ -28,7 +31,6 @@
|
|
28
31
|
struct TextureData;
|
29
32
|
class Box_Collision_2D;
|
30
33
|
|
31
|
-
|
32
34
|
/*####################################################
|
33
35
|
* マップチップ 描画クラス
|
34
36
|
######################################################*/
|
@@ -36,23 +38,32 @@
|
|
36
38
|
{
|
37
39
|
public:
|
38
40
|
MapChip(Entry* e, std::shared_ptr<TextureData> data, glm::ivec2 pos, TextureUV size, bool col); //
|
41
|
+
MapChip(); //
|
42
|
+
MapChip(const MapChip& m); //
|
39
43
|
~MapChip(); //
|
40
44
|
|
41
45
|
void Update() override;
|
42
46
|
void Draw() override;
|
43
47
|
|
44
48
|
Box_Collision_2D mCol;
|
45
|
-
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
46
53
|
private:
|
47
54
|
|
48
|
-
std::
|
55
|
+
std::shared_ptr<Sprite> mSprite;
|
56
|
+
std::shared_ptr<TextureData> Data;
|
57
|
+
|
49
58
|
TextureUV UV;
|
59
|
+
glm::ivec2 colSize;
|
50
60
|
|
51
61
|
|
52
62
|
};
|
53
63
|
|
54
64
|
#endif
|
55
65
|
|
66
|
+
|
56
67
|
```
|
57
68
|
|
58
69
|
```cpp
|