質問編集履歴

3

文章を追加

2022/02/04 07:12

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -146,27 +146,6 @@
146
146
  sword_right_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_right_2.png");
147
147
  sword_right_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_right_3.png");
148
148
 
149
- sword_left_sprite[0] = FrameWork::LoadTexture("Asset/texture/sword_left_0.png");
150
- sword_left_sprite[1] = FrameWork::LoadTexture("Asset/texture/sword_left_1.png");
151
- sword_left_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_left_2.png");
152
- sword_left_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_left_3.png");
153
-
154
- sword_up_sprite[0] = FrameWork::LoadTexture("Asset/texture/sword_up_0.png");
155
- sword_up_sprite[1] = FrameWork::LoadTexture("Asset/texture/sword_up_1.png");
156
- sword_up_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_up_2.png");
157
- sword_up_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_up_3.png");
158
-
159
- sword_down_sprite[0] = FrameWork::LoadTexture("Asset/texture/sword_down_0.png");
160
- sword_down_sprite[1] = FrameWork::LoadTexture("Asset/texture/sword_down_1.png");
161
- sword_down_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_down_2.png");
162
- sword_down_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_down_3.png");
163
-
164
- weapon_right_sprite = FrameWork::LoadTexture("Asset/texture/sword_right.png");
165
- weapon_left_sprite = FrameWork::LoadTexture("Asset/texture/sword_left.png");
166
- weapon_up_sprite = FrameWork::LoadTexture("Asset/texture/sword_up.png");
167
- weapon_down_sprite = FrameWork::LoadTexture("Asset/texture/sword_down.png");
168
-
169
-
170
149
  isThrow = false;
171
150
 
172
151
  state = State::Wait;
@@ -194,4 +173,36 @@
194
173
 
195
174
  ```
196
175
 
197
-
176
+ ##### Makefile
177
+ ```
178
+ PRG :=Game
179
+ SRC_DIR :=FrameWork/source
180
+ SRC_USE_DIR :=source
181
+
182
+ OBJ_DIR :=FrameWork/object
183
+ OBJ_USE_DIR :=object
184
+
185
+ DEP_DIR :=FrameWork/object
186
+ DEP :=$(wildcard $(DEP_DIR)/*.d)
187
+
188
+ SRC :=$(wildcard $(SRC_DIR)/*.cpp)
189
+ SRC_USE :=$(wildcard $(SRC_USE_DIR)/*.cpp)
190
+
191
+ OBJ :=$(addprefix $(OBJ_DIR)/,$(patsubst %.cpp,%.o,$(notdir $(SRC))))
192
+ OBJ_USE :=$(addprefix $(OBJ_USE_DIR)/,$(patsubst %.cpp,%.o,$(notdir $(SRC_USE))))
193
+
194
+ $(PRG): $(OBJ) $(OBJ_USE)
195
+ $(CXX) $^ -o $@ -ldl -lGLESv2 -lGLU -lGL -lglfw3 -pthread -lGL -lGLEW -lfreetype -ldl -lX11
196
+
197
+ $(OBJ_DIR)/%.o: FrameWork/source/%.cpp
198
+ $(CXX) -g -c -MMD -MP $< -o $@
199
+ -include $(DEP)
200
+
201
+ $(OBJ_USE_DIR)/%.o: source/%.cpp
202
+ $(CXX) -g -c -MMD -MP $< -o $@
203
+ -include $(DEP)
204
+
205
+ clean:
206
+ rm -f ./$(OBJ_USE_DIR)/*.o ./$(OBJ_DIR)/*.o *.out ./$(OBJ_DIR)/*.d ./$(OBJ_USE_DIR)/*.d $(PRG)
207
+
208
+ ```

2

提示コードを修正

2022/02/04 05:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -181,3 +181,17 @@
181
181
  }
182
182
 
183
183
  ```
184
+ ##### FrameWork::Texture 構造体
185
+ ```cpp
186
+ //テクスチャファイル
187
+ typedef struct texture
188
+ {
189
+ glm::ivec2 size = glm::ivec2(0,0); //サイズ
190
+ GLuint ID = 0; //テクスチャハンドル
191
+ unsigned char* data; //ピクセルデータ
192
+ }
193
+ Texture;
194
+
195
+ ```
196
+
197
+

1

提示文を追加

2022/02/04 05:45

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,6 @@
1
1
  提示コードですがgdbデバッガにて///コメント部内部の`「Cannot access memory at address」`エラーが発生するのですがこれはどう対処したらいいのでしょうか?下記の提示コードが問題の関数ですが問題点がわかりません。
2
2
 
3
-
3
+ ##### Console
4
4
  ```
5
5
  (gdb) run
6
6
  The program being debugged has been started already.
@@ -118,4 +118,66 @@
118
118
  }
119
119
  ```
120
120
 
121
+ ##### Player.cpp
122
+ ```
123
+ #include "../header/Player.hpp"
121
124
 
125
+ #define SPEED (int)4;
126
+ #define WEAPON_ANIMATION_SPEED ((int)10)
127
+ #define WALK_ANIMATION_SPEED ((int)20)
128
+ #define THROW_SPEED ((int)5)
129
+ #define THROW_MOVE_SPEED ((int)150)
130
+ #define THROW_DISTANCE ((int)300)
131
+ Player::Player() : Actor()
132
+ {
133
+ position = glm::ivec2(0,0);
134
+ throwPosition = glm::ivec2(0,0);
135
+ throwDistance = 0;
136
+ speed = SPEED;
137
+ moveVector = glm::vec2(1,0);
138
+
139
+ up_sprite = FrameWork::LoadTexture("Asset/texture/up.png");
140
+ down_sprite = FrameWork::LoadTexture("Asset/texture/down.png");
141
+ left_sprite = FrameWork::LoadTexture("Asset/texture/left.png");
142
+ right_sprite = FrameWork::LoadTexture("Asset/texture/right.png");
143
+
144
+ sword_right_sprite[0] = FrameWork::LoadTexture("Asset/texture/sword_right_0.png");
145
+ sword_right_sprite[1] = FrameWork::LoadTexture("Asset/texture/sword_right_1.png");
146
+ sword_right_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_right_2.png");
147
+ sword_right_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_right_3.png");
148
+
149
+ sword_left_sprite[0] = FrameWork::LoadTexture("Asset/texture/sword_left_0.png");
150
+ sword_left_sprite[1] = FrameWork::LoadTexture("Asset/texture/sword_left_1.png");
151
+ sword_left_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_left_2.png");
152
+ sword_left_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_left_3.png");
153
+
154
+ sword_up_sprite[0] = FrameWork::LoadTexture("Asset/texture/sword_up_0.png");
155
+ sword_up_sprite[1] = FrameWork::LoadTexture("Asset/texture/sword_up_1.png");
156
+ sword_up_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_up_2.png");
157
+ sword_up_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_up_3.png");
158
+
159
+ sword_down_sprite[0] = FrameWork::LoadTexture("Asset/texture/sword_down_0.png");
160
+ sword_down_sprite[1] = FrameWork::LoadTexture("Asset/texture/sword_down_1.png");
161
+ sword_down_sprite[2] = FrameWork::LoadTexture("Asset/texture/sword_down_2.png");
162
+ sword_down_sprite[3] = FrameWork::LoadTexture("Asset/texture/sword_down_3.png");
163
+
164
+ weapon_right_sprite = FrameWork::LoadTexture("Asset/texture/sword_right.png");
165
+ weapon_left_sprite = FrameWork::LoadTexture("Asset/texture/sword_left.png");
166
+ weapon_up_sprite = FrameWork::LoadTexture("Asset/texture/sword_up.png");
167
+ weapon_down_sprite = FrameWork::LoadTexture("Asset/texture/sword_down.png");
168
+
169
+
170
+ isThrow = false;
171
+
172
+ state = State::Wait;
173
+
174
+ animation_Attack_Time = 0;
175
+ animation_Attack_Clip = 1;
176
+
177
+ animation_Time = 0;
178
+ animation = false;
179
+ isMove = false;
180
+ isAttack = false;
181
+ }
182
+
183
+ ```