質問編集履歴
3
情報の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -262,6 +262,8 @@
|
|
262
262
|
|
263
263
|
Reader()を生成している箇所について
|
264
264
|
|
265
|
+
GameScene.cpp(26)
|
266
|
+
|
265
267
|
|
266
268
|
|
267
269
|
GameScene.h
|
@@ -296,7 +298,7 @@
|
|
296
298
|
|
297
299
|
std::shared_ptr<Field> m_field;
|
298
300
|
|
299
|
-
std::shared_ptr<Reader> m_reader;
|
301
|
+
std::shared_ptr<Reader> m_reader;
|
300
302
|
|
301
303
|
|
302
304
|
|
@@ -332,6 +334,224 @@
|
|
332
334
|
|
333
335
|
```
|
334
336
|
|
337
|
+
|
338
|
+
|
339
|
+
GameScene.cpp
|
340
|
+
|
341
|
+
```C++
|
342
|
+
|
343
|
+
#include "GameScene.h"
|
344
|
+
|
345
|
+
#include <DxLib.h>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
using namespace std;
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
const char* GameScene::ParameterTagStage = "ParameterTagStage";
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
std::shared_ptr<MethodBox> GameScene::m_methodBoxRed; //staticメンバの実体
|
358
|
+
|
359
|
+
std::shared_ptr<MethodBox> GameScene::m_methodBoxBlue;
|
360
|
+
|
361
|
+
std::shared_ptr<MethodBox> GameScene::m_methodBoxIf;
|
362
|
+
|
363
|
+
std::shared_ptr<MethodBox> GameScene::m_methodBoxWhile;
|
364
|
+
|
365
|
+
std::shared_ptr<MethodBox> GameScene::m_dummy;
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
//このシーンで使用するオブジェクトの生成
|
370
|
+
|
371
|
+
GameScene::GameScene(SceneChangedListener* _impl, const Parameter& _parameter) : SceneBace(_impl, _parameter)
|
372
|
+
|
373
|
+
{
|
374
|
+
|
375
|
+
m_level = _parameter.get(ParameterTagStage);
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
switch (m_level)
|
380
|
+
|
381
|
+
{
|
382
|
+
|
383
|
+
case Define::enumStage::Demo:
|
384
|
+
|
385
|
+
m_methodBoxRed = make_shared<MethodBox>(200, 200, 160, 50, "赤い丸を表示", &Method::RedCircle);
|
386
|
+
|
387
|
+
m_methodBoxBlue = make_shared<MethodBox>(500, 200, 160, 50, "青い丸を表示", &Method::BlueCircle);
|
388
|
+
|
389
|
+
m_methodBoxIf = make_shared<MethodBox>(100, 100, 280, 50, "赤丸が表示されているなら", &Method::SwitchIfState);
|
390
|
+
|
391
|
+
m_methodBoxWhile = make_shared<MethodBox>(500, 100, 100, 50, "ずっと", &Method::ContinueState);
|
392
|
+
|
393
|
+
m_reader = make_shared<Reader>(); //ここでReaderを生成
|
394
|
+
|
395
|
+
break;
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
case Define::enumStage::Tutorial:
|
400
|
+
|
401
|
+
break;
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
default:
|
406
|
+
|
407
|
+
break;
|
408
|
+
|
409
|
+
}
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
m_field = make_shared<Field>();
|
414
|
+
|
415
|
+
m_dummy = make_shared<MethodBox>(1, 1, 0, 0, "", &Method::Dummy);
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
}
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
//現在のシーンのフレーム処理
|
424
|
+
|
425
|
+
void GameScene::update()
|
426
|
+
|
427
|
+
{
|
428
|
+
|
429
|
+
switch (m_level)
|
430
|
+
|
431
|
+
{
|
432
|
+
|
433
|
+
case Define::enumStage::Demo:
|
434
|
+
|
435
|
+
m_methodBoxRed->update();
|
436
|
+
|
437
|
+
m_methodBoxBlue->update();
|
438
|
+
|
439
|
+
m_methodBoxIf->update();
|
440
|
+
|
441
|
+
m_methodBoxWhile->update();
|
442
|
+
|
443
|
+
m_reader->update();
|
444
|
+
|
445
|
+
break;
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
case Define::enumStage::Tutorial:
|
450
|
+
|
451
|
+
break;
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
case Define::enumStage::Exe:
|
456
|
+
|
457
|
+
m_reader->update();
|
458
|
+
|
459
|
+
break;
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
default:
|
464
|
+
|
465
|
+
break;
|
466
|
+
|
467
|
+
}
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
m_field->update();
|
472
|
+
|
473
|
+
m_dummy->update();
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
if (CheckHitKey(KEY_INPUT_ESCAPE))
|
478
|
+
|
479
|
+
{
|
480
|
+
|
481
|
+
m_SceneChanged->SceneBack();
|
482
|
+
|
483
|
+
}
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
//現在のシーンの描画処理
|
490
|
+
|
491
|
+
void GameScene::draw() const
|
492
|
+
|
493
|
+
{
|
494
|
+
|
495
|
+
switch (m_level)
|
496
|
+
|
497
|
+
{
|
498
|
+
|
499
|
+
case Define::enumStage::Demo:
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
m_methodBoxRed->draw();
|
504
|
+
|
505
|
+
m_methodBoxBlue->draw();
|
506
|
+
|
507
|
+
m_methodBoxIf->draw();
|
508
|
+
|
509
|
+
m_methodBoxWhile->draw();
|
510
|
+
|
511
|
+
m_reader->draw();
|
512
|
+
|
513
|
+
m_reader->ReadButton(Define::ReadButton_X1, Define::ReadButton_Y1, 75, 75, "実行");
|
514
|
+
|
515
|
+
break;
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
case Define::enumStage::Tutorial:
|
520
|
+
|
521
|
+
DrawString(100, 100, "準備中", GetColor(255, 255, 255));
|
522
|
+
|
523
|
+
break;
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
case Define::enumStage::Exe:
|
528
|
+
|
529
|
+
break;
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
default:
|
536
|
+
|
537
|
+
break;
|
538
|
+
|
539
|
+
}
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
m_field->draw();
|
544
|
+
|
545
|
+
m_dummy->draw();
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
}
|
552
|
+
|
553
|
+
```
|
554
|
+
|
335
555
|
### 試したこと
|
336
556
|
|
337
557
|
|
2
情報の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -258,6 +258,80 @@
|
|
258
258
|
|
259
259
|
|
260
260
|
|
261
|
+
以下追記:
|
262
|
+
|
263
|
+
Reader()を生成している箇所について
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
GameScene.h
|
268
|
+
|
269
|
+
```C++
|
270
|
+
|
271
|
+
#pragma once
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
#include <memory>
|
276
|
+
|
277
|
+
#include "SceneBase.h"
|
278
|
+
|
279
|
+
#include "MethodBox.h"
|
280
|
+
|
281
|
+
#include "Reader.h"
|
282
|
+
|
283
|
+
#include "Field.h"
|
284
|
+
|
285
|
+
#include "Task.h"
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
class GameScene : public SceneBace
|
290
|
+
|
291
|
+
{
|
292
|
+
|
293
|
+
private:
|
294
|
+
|
295
|
+
int m_level;
|
296
|
+
|
297
|
+
std::shared_ptr<Field> m_field;
|
298
|
+
|
299
|
+
std::shared_ptr<Reader> m_reader; //ここでReaderを生成
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
public:
|
304
|
+
|
305
|
+
const static char* ParameterTagStage;
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
GameScene(SceneChangedListener* _impl, const Parameter& _parameter);
|
310
|
+
|
311
|
+
virtual ~GameScene() = default;
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
void update() override;
|
316
|
+
|
317
|
+
void draw() const override;
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
static std::shared_ptr<MethodBox> m_methodBoxRed;
|
322
|
+
|
323
|
+
static std::shared_ptr<MethodBox> m_methodBoxBlue;
|
324
|
+
|
325
|
+
static std::shared_ptr<MethodBox> m_methodBoxIf;
|
326
|
+
|
327
|
+
static std::shared_ptr<MethodBox> m_methodBoxWhile;
|
328
|
+
|
329
|
+
static std::shared_ptr<MethodBox> m_dummy;
|
330
|
+
|
331
|
+
};
|
332
|
+
|
333
|
+
```
|
334
|
+
|
261
335
|
### 試したこと
|
262
336
|
|
263
337
|
|
1
情報の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,22 @@
|
|
16
16
|
|
17
17
|
C2512 Reader::Readerクラス、構造体、共用体に既定のコンストラクターがありません
|
18
18
|
|
19
|
+
|
20
|
+
|
21
|
+
追記:エラーが出ているのはxutility(138行目)です。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
//FUNCTION TEMPLATE _Construct_in_place
|
26
|
+
|
27
|
+
template<class _Ty, class... _Types>
|
28
|
+
|
29
|
+
void _Construct_in_place(_Ty& Obj, _Types&&... _Args)noexcept(is_nothrow_constructible_v<_Ty, _Types...>{
|
30
|
+
|
31
|
+
::new(_Voidify_iter(_STD addressof(Obj))) _Ty(_STD forward<_Types>(_Args)...); //この行_Tyで「指定された引数によるテンプレートのインスタンス化でエラーが発生しました」と警告が出ている
|
32
|
+
|
33
|
+
}
|
34
|
+
|
19
35
|
```
|
20
36
|
|
21
37
|
|