質問編集履歴

3

タイトルを変更

2019/12/08 11:48

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- メモリが読めません例外エの原因が知りたい
1
+ バッファオーバーの原因が知りたい
test CHANGED
File without changes

2

質問内容にその他の情報を追加しました。

2019/12/08 11:47

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -8,14 +8,402 @@
8
8
 
9
9
 
10
10
 
11
-
11
+ start.h
12
12
 
13
13
  ```ここに言語を入力
14
14
 
15
15
 
16
16
 
17
+
18
+
19
+ /*シーン管理*/
20
+
21
+ enum class SceneType
22
+
23
+ {
24
+
25
+ Title,
26
+
27
+ Game,
28
+
29
+ GameOver,
30
+
31
+ Pause
32
+
33
+ };
34
+
35
+
36
+
37
+ extern SceneType nowScene;
38
+
39
+
40
+
41
+ class Scene
42
+
43
+ {
44
+
45
+ private:
46
+
47
+
48
+
49
+
50
+
51
+ std::unique_ptr<Title> t;
52
+
53
+ std::unique_ptr<Game> g;
54
+
55
+
56
+
57
+
58
+
59
+ public:
60
+
61
+
62
+
63
+ Scene();
64
+
65
+
66
+
67
+ void Update();
68
+
69
+ void Draw_Update();
70
+
71
+
72
+
73
+ ~Scene();
74
+
75
+ };
76
+
77
+
78
+
79
+ #endif
80
+
81
+ ```
82
+
83
+
84
+
85
+ start.cpp
86
+
87
+ ```ここに言語を入力
88
+
89
+
90
+
91
+
92
+
17
93
  /*コンストラクタ*/
18
94
 
95
+ Scene::Scene():
96
+
97
+ // nowScene(Scene::Title),
98
+
99
+ t(std::make_unique<Title>()),
100
+
101
+ g(std::make_unique<Game>())
102
+
103
+ {
104
+
105
+
106
+
107
+ }
108
+
109
+
110
+
111
+ //SceneType nowScene = SceneType::Title;
112
+
113
+ SceneType nowScene = SceneType::Title;
114
+
115
+
116
+
117
+ /*計算*/
118
+
119
+ void Scene::Update()
120
+
121
+ {
122
+
123
+ switch(nowScene)
124
+
125
+ {
126
+
127
+ case SceneType::Title:
128
+
129
+ {
130
+
131
+ t->Update();
132
+
133
+ break;
134
+
135
+ };
136
+
137
+
138
+
139
+ case SceneType::Game:
140
+
141
+ {
142
+
143
+ g->Update();
144
+
145
+ break;
146
+
147
+ }
148
+
149
+
150
+
151
+
152
+
153
+ }
154
+
155
+
156
+
157
+ }
158
+
159
+
160
+
161
+ /*描画*/
162
+
163
+ void Scene::Draw_Update()
164
+
165
+ {
166
+
167
+ switch (nowScene)
168
+
169
+ {
170
+
171
+ case SceneType::Title:
172
+
173
+ {
174
+
175
+ t->Draw_Update();
176
+
177
+ break;
178
+
179
+ };
180
+
181
+
182
+
183
+ case SceneType::Game:
184
+
185
+ {
186
+
187
+ g->Draw_Update();
188
+
189
+ break;
190
+
191
+ }
192
+
193
+
194
+
195
+
196
+
197
+ }
198
+
199
+ }
200
+
201
+
202
+
203
+ /*デストラクタ*/
204
+
205
+ Scene::~Scene()
206
+
207
+ {
208
+
209
+
210
+
211
+ }
212
+
213
+
214
+
215
+
216
+
217
+ ```
218
+
219
+
220
+
221
+
222
+
223
+ Game.h
224
+
225
+ ```ここに言語を入力
226
+
227
+ #ifndef ___GAME_h
228
+
229
+ #define ___GAME_h
230
+
231
+ #include <array>
232
+
233
+ #include <memory>
234
+
235
+ /*
236
+
237
+ 画面サイズ: 1280,720
238
+
239
+ ステージサイズ: 288,504
240
+
241
+ */
242
+
243
+
244
+
245
+ #define STAGE_X 12
246
+
247
+ #define STAGE_Y 21
248
+
249
+
250
+
251
+ #define STAGE_FRAME -1
252
+
253
+ #define CELL 24
254
+
255
+ #define STAGE_EMPTY 0
256
+
257
+
258
+
259
+ class Game
260
+
261
+ {
262
+
263
+ private:
264
+
265
+ /*画像情報*/
266
+
267
+ int Image_Block[8];//ブロック各種
268
+
269
+ int Image_gback_ground;//背景
270
+
271
+ int Image_frameY;//背景
272
+
273
+ int Image_frameX;//背景
274
+
275
+
276
+
277
+ /*データ*/
278
+
279
+ int Data_Block[8][4][4][4];
280
+
281
+
282
+
283
+ class Position
284
+
285
+ {
286
+
287
+ public:
288
+
289
+ int x;
290
+
291
+ int y;
292
+
293
+ Position(): x(0),y(0){ }
294
+
295
+
296
+
297
+ };
298
+
299
+
300
+
301
+ /*キー状態*/
302
+
303
+ enum class keyState
304
+
305
+ {
306
+
307
+
308
+
309
+ Left,
310
+
311
+ Right,
312
+
313
+ Down,
314
+
315
+ Rotation,
316
+
317
+ eHold,
318
+
319
+ Invalid,
320
+
321
+ Pause,
322
+
323
+
324
+
325
+ };
326
+
327
+
328
+
329
+ // std::array<std::array<int, 12>,21> stage = {{
330
+
331
+ int stage[STAGE_Y][STAGE_X] = {
332
+
333
+ {-1,0,0,0,0,0,0,0,0,0,0,-1},
334
+
335
+ //////////////////////行数の問題で割愛
336
+
337
+ {-1,0,0,0,0,0,0,0,0,0,0,-1},
338
+
339
+ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
340
+
341
+ };
342
+
343
+
344
+
345
+ int blockHold; //ホールドしてるブロックを記録
346
+
347
+ keyState* key; //キー入力管理
348
+
349
+ keyState* keyAction; //キー入力管理
350
+
351
+ keyState* keyPause; //キー入力管理
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+ //Position *move; //プレイヤ座標
360
+
361
+ std::unique_ptr<Position> move; //プレイヤ座標
362
+
363
+ int nRote; //回転
364
+
365
+ int nowNumber; //ブロック
366
+
367
+ const int color_index[7]; //色情報 
368
+
369
+
370
+
371
+ public:
372
+
373
+ Game();
374
+
375
+ void Update();
376
+
377
+ void Draw_Update();
378
+
379
+ ~Game();
380
+
381
+
382
+
383
+ private:
384
+
385
+
386
+
387
+
388
+
389
+ //割愛
390
+
391
+ };
392
+
393
+
394
+
395
+ #endif
396
+
397
+
398
+
399
+ ```
400
+
401
+ ```ここに言語を入力
402
+
403
+
404
+
405
+ /*コンストラクタ*/
406
+
19
407
  Game::Game():
20
408
 
21
409
  Data_Block
@@ -26,467 +414,749 @@
26
414
 
27
415
  {
28
416
 
29
- {1,1,1,1},
30
-
31
- {0,0,0,0},
32
-
33
- {0,0,0,0},
34
-
35
- {0,0,0,0},
36
-
37
- },
38
-
39
-
40
-
41
- {
42
-
43
- {0,0,0,1},
44
-
45
- {0,0,0,1},
46
-
47
- {0,0,0,1},
48
-
49
- {0,0,0,1},
50
-
51
- },
52
-
53
-
54
-
55
- {
56
-
57
-
58
-
59
- {1,1,1,1},
60
-
61
- {0,0,0,0},
62
-
63
- {0,0,0,0},
64
-
65
- {0,0,0,0},
66
-
67
- },
68
-
69
-
70
-
71
- {
417
+
418
+
419
+ },
420
+
421
+              ////////////////文字数の関係で割愛
422
+
423
+ {
424
+
425
+ {1,1,0,0},
426
+
427
+ {0,0,0,0},
428
+
429
+ {0,0,0,0},
430
+
431
+ },
432
+
433
+
434
+
435
+ {
436
+
437
+ {1,0,0,0},
438
+
439
+ {1,1,0,0},
440
+
441
+ {0,1,0,0},
442
+
443
+ {0,0,0,0},
444
+
445
+ },
446
+
447
+ },
448
+
449
+
450
+
451
+ {
452
+
453
+ {
454
+
455
+ {1,1,0,0},
456
+
457
+ {0,1,1,0},
458
+
459
+ {0,0,0,0},
460
+
461
+ {0,0,0,0},
462
+
463
+ },
464
+
465
+
466
+
467
+ {
468
+
469
+ {0,1,0,0},
470
+
471
+ {1,1,0,0},
472
+
473
+ {1,0,0,0},
474
+
475
+ {0,0,0,0},
476
+
477
+ },
478
+
479
+
480
+
481
+ {
482
+
483
+
484
+
485
+ {1,1,0,0},
486
+
487
+ {0,1,1,0},
488
+
489
+ {0,0,0,0},
490
+
491
+ {0,0,0,0},
492
+
493
+ },
494
+
495
+
496
+
497
+ {
498
+
499
+ {0,1,0,0},
500
+
501
+ {1,1,0,0},
502
+
503
+ {1,0,0,0},
504
+
505
+ {0,0,0,0},
506
+
507
+ },
508
+
509
+ },
510
+
511
+
512
+
513
+ {
514
+
515
+ {
516
+
517
+ {1,0,0,0},
518
+
519
+ {1,1,1,0},
520
+
521
+ {0,0,0,0},
522
+
523
+ {0,0,0,0},
524
+
525
+ },
526
+
527
+
528
+
529
+ {
530
+
531
+ {1,1,0,0},
532
+
533
+ {1,0,0,0},
534
+
535
+ {1,0,0,0},
536
+
537
+ {0,0,0,0},
538
+
539
+ },
540
+
541
+
542
+
543
+ {
544
+
545
+ {1,1,1,0},
72
546
 
73
547
  {0,0,1,0},
74
548
 
549
+ {0,0,0,0},
550
+
551
+ {0,0,0,0},
552
+
553
+ },
554
+
555
+
556
+
557
+ {
558
+
559
+ {0,1,0,0},
560
+
561
+ {0,1,0,0},
562
+
563
+ {1,1,0,0},
564
+
565
+ {0,0,0,0},
566
+
567
+ },
568
+
569
+ },
570
+
571
+ {
572
+
573
+ {
574
+
75
575
  {0,0,1,0},
76
576
 
577
+ {1,1,1,0},
578
+
77
- {0,0,1,0},
579
+ {0,0,0,0},
78
-
580
+
79
- {0,0,1,0},
581
+ {0,0,0,0},
582
+
583
+ },
584
+
585
+
586
+
587
+ {
588
+
589
+ {1,0,0,0},
590
+
591
+ {1,0,0,0},
592
+
593
+ {1,1,0,0},
594
+
595
+ {0,0,0,0},
596
+
597
+
598
+
599
+ },
600
+
601
+ {
602
+
603
+ {1,1,1,0},
604
+
605
+ {1,0,0,0},
606
+
607
+ {0,0,0,0},
608
+
609
+ {0,0,0,0},
610
+
611
+
612
+
613
+ },
614
+
615
+ {
616
+
617
+ {1,1,0,0},
618
+
619
+ {0,1,0,0},
620
+
621
+ {0,1,0,0},
622
+
623
+ {0,0,0,0},
624
+
625
+
80
626
 
81
627
  },
82
628
 
83
629
  },
84
630
 
85
-
86
-
87
631
  {
88
632
 
89
633
  {
90
634
 
635
+ {0,1,0,0},
636
+
637
+ {1,1,1,0},
638
+
639
+ {0,0,0,0},
640
+
641
+ {0,0,0,0},
642
+
643
+ },
644
+
645
+
646
+
647
+ {
648
+
649
+ {1,0,0,0},
650
+
91
651
  {1,1,0,0},
92
652
 
653
+ {1,0,0,0},
654
+
655
+ {0,0,0,0},
656
+
657
+
658
+
659
+ },
660
+
661
+ {
662
+
663
+ {1,1,1,0},
664
+
665
+ {0,1,0,0},
666
+
667
+ {0,0,0,0},
668
+
669
+ {0,0,0,0},
670
+
671
+
672
+
673
+ },
674
+
675
+ {
676
+
677
+ {0,1,0,0},
678
+
93
679
  {1,1,0,0},
94
680
 
681
+ {0,1,0,0},
682
+
95
- {0,0,0,0},
683
+ {0,0,0,0},
96
-
97
- {0,0,0,0},
684
+
98
-
99
- },
685
+
100
-
101
-
102
-
103
- {
104
-
105
- {1,1,0,0},
106
-
107
- {1,1,0,0},
108
-
109
- {0,0,0,0},
110
-
111
- {0,0,0,0},
112
-
113
- },
114
-
115
-
116
-
117
- {
118
-
119
-
120
-
121
- {1,1,0,0},
122
-
123
- {1,1,0,0},
124
-
125
- {0,0,0,0},
126
-
127
- {0,0,0,0},
128
-
129
- },
130
-
131
-
132
-
133
- {
134
-
135
- {1,1,0,0},
136
-
137
- {1,1,0,0},
138
-
139
- {0,0,0,0},
140
-
141
- {0,0,0,0},
142
686
 
143
687
  },
144
688
 
145
689
  },
146
690
 
147
-
691
+ },
692
+
693
+
694
+
695
+ move(new Position()),
696
+
697
+ key(new keyState),
698
+
699
+ keyAction(new keyState),
700
+
701
+ keyPause(new keyState),
702
+
703
+ nRote(0),
704
+
705
+ color_index{ 5,3,4,1,6,2,7 }
706
+
707
+ {
708
+
709
+
710
+
711
+ srand((unsigned int)time(NULL));
712
+
713
+ LoadDivGraph("Tetris/resource/Block_tmp_24px.png", 8, 4, 2, 24, 24, Image_Block);
714
+
715
+ Image_frameX = LoadGraph("Tetris/resource/Image_frameX.png");
716
+
717
+ Image_frameY = LoadGraph("Tetris/resource/Image_frameY.png");
718
+
719
+ // nowNumber = rand() % 7 == 0;
720
+
721
+ set_Rand();
722
+
723
+ move->x = 4;
724
+
725
+ move->y = 1;
726
+
727
+
728
+
729
+ }
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+ // -------------------------------------------------------------------------------
738
+
739
+ // 計算
740
+
741
+ // -------------------------------------------------------------------------------
742
+
743
+
744
+
745
+ /*ブロック種類の乱数を引く*/
746
+
747
+ void Game::set_Rand()
748
+
749
+ {
750
+
751
+ //ofs << move->x << ",aaaaaaaa, " << move->y << endl;
752
+
753
+
754
+
755
+ while(nowNumber % 7 != 0){
756
+
757
+ ofs<<nowNumber<<endl;
758
+
759
+ nowNumber = rand() % 7;
760
+
761
+ }
762
+
763
+ }
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+ /*ブロックを生成*/
772
+
773
+ void Game::Create_Block()
774
+
775
+ {
776
+
777
+
778
+
779
+ //set_Rand();
780
+
781
+ ofs << "aaaaaaaaaaa"<< endl;
782
+
783
+
784
+
785
+ //ofs << &move->x << "," << &move->y << endl;
786
+
787
+ //int a = move->x;
788
+
789
+ //ofs << a<< endl;
790
+
791
+
792
+
793
+ //move->x = 4;
794
+
795
+ //move->y = 0;
796
+
797
+
798
+
799
+ }
800
+
801
+
802
+
803
+ /*ブロック削除*/
804
+
805
+ void Game::Block_Clear()
806
+
807
+ {
808
+
809
+
810
+
811
+ }
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+ /*ブロック落下と移動管理*/
822
+
823
+ bool Game::Block_Down()
824
+
825
+ {
826
+
827
+
828
+
829
+ move->y += 1;
830
+
831
+ if (Collision_X() == true)
832
+
833
+ {
834
+
835
+ move->y += - 1;
836
+
837
+ return true;
838
+
839
+ }else{
840
+
841
+ move->y += 1;
842
+
843
+ return false;
844
+
845
+ }
846
+
847
+ }
848
+
849
+
850
+
851
+
852
+
853
+ /*指定したピースの座標にブロックがあるかどうか?*/
854
+
855
+ bool Game::get_isBlock(int n, int r, Position p)
856
+
857
+ {
858
+
859
+ return Data_Block[n][r][p.y][p.x];
860
+
861
+ }
862
+
863
+
864
+
865
+ /*ステージ座標に何があるか返す 1 壁 2 ブロック 0 何もなし*/
866
+
867
+ int Game::get_Stage(int x,int y)
868
+
869
+ {
870
+
871
+ return stage[y][x];
872
+
873
+ }
874
+
875
+
876
+
877
+ /*ステージにブロック情報を入れてる*/
878
+
879
+ void Game::set_Stage(int x,int y,int c)
880
+
881
+ {
882
+
883
+ stage[y][x] = c;
884
+
885
+ }
886
+
887
+
888
+
889
+ /*当たり判定*/
890
+
891
+ bool Game::Collision_X()
892
+
893
+ {
894
+
895
+ Position p;
896
+
897
+ for (int y = 0; y < 4; y++)
898
+
899
+ {
900
+
901
+ for (int x = 0; x < 4; x++)
902
+
903
+ {
904
+
905
+ p.x = x;
906
+
907
+ p.y = y;
908
+
909
+ if( get_isBlock(nowNumber,nRote,p) == true && get_Stage(move->x + x,move->y + y) != 0 )
910
+
911
+ {
912
+
913
+ return true;
914
+
915
+ }
916
+
917
+ }
918
+
919
+ }
920
+
921
+
922
+
923
+ return false;
924
+
925
+ }
926
+
927
+
928
+
929
+
930
+
931
+ /*ブロックを固定する*/
932
+
933
+ void Game::Put_Block()
934
+
935
+ {
936
+
937
+ int dx = move->x;
938
+
939
+ int dy = move->y;
940
+
941
+ for(int py = 0; py < 4; py++)
942
+
943
+ {
944
+
945
+ for(int px = 0; px < 4; px++)
148
946
 
149
947
  {
150
948
 
949
+ //ofs << move->x << " , " << move->y << endl;
950
+
951
+ //ofs << color_index[nowNumber] <<endl;
952
+
953
+
954
+
955
+ //set_Stage((move->x + px), (move->y + py), color_index[nowNumber]);
956
+
957
+ set_Stage( (dx + px) ,(dy + py),color_index[nowNumber]);
958
+
959
+ // ofs << "eee" << endl;
960
+
961
+
962
+
963
+ }
964
+
965
+ }
966
+
967
+ }
968
+
969
+
970
+
971
+ /*キー入力受付・移動処理・当たり判定*/
972
+
973
+ void Game::Control()
974
+
151
- {
975
+ {
152
-
976
+
153
- {0,1,1,0},
977
+ if (Fps::keyboard(KEY_INPUT_LEFT) == 1)
154
-
155
- {1,1,0,0},
978
+
156
-
157
- {0,0,0,0},
158
-
159
- {0,0,0,0},
160
-
161
- },
162
-
163
-
164
-
165
- {
979
+ {
980
+
166
-
981
+ // *key = keyState::Left;
982
+
167
- {1,0,0,0},
983
+ move->x += -1;
168
-
984
+
169
- {1,1,0,0},
985
+ if(Collision_X() == true)
170
-
171
- {0,1,0,0},
172
-
173
- {0,0,0,0},
174
-
175
- },
176
-
177
-
178
-
179
- {
180
-
181
-
182
-
183
- {0,1,1,0},
184
-
185
- {1,1,0,0},
186
-
187
- {0,0,0,0},
188
-
189
- {0,0,0,0},
190
-
191
- },
192
-
193
-
194
-
195
- {
196
-
197
- {1,0,0,0},
198
-
199
- {1,1,0,0},
200
-
201
- {0,1,0,0},
202
-
203
- {0,0,0,0},
204
-
205
- },
206
-
207
- },
208
-
209
-
210
986
 
211
987
  {
212
988
 
989
+ move->x += 1;
990
+
991
+ }
992
+
993
+
994
+
995
+ }
996
+
997
+ else if (Fps::keyboard(KEY_INPUT_RIGHT) == 1)
998
+
213
- {
999
+ {
1000
+
214
-
1001
+ //*key = keyState::Right;
1002
+
215
- {1,1,0,0},
1003
+ move->x += 1;
216
-
1004
+
1005
+
1006
+
217
- {0,1,1,0},
1007
+ if (Collision_X() == true)
218
-
219
- {0,0,0,0},
220
-
221
- {0,0,0,0},
222
-
223
- },
224
-
225
-
226
-
227
- {
228
-
229
- {0,1,0,0},
230
-
231
- {1,1,0,0},
232
-
233
- {1,0,0,0},
234
-
235
- {0,0,0,0},
236
-
237
- },
238
-
239
-
240
-
241
- {
242
-
243
-
244
-
245
- {1,1,0,0},
246
-
247
- {0,1,1,0},
248
-
249
- {0,0,0,0},
250
-
251
- {0,0,0,0},
252
-
253
- },
254
-
255
-
256
-
257
- {
258
-
259
- {0,1,0,0},
260
-
261
- {1,1,0,0},
262
-
263
- {1,0,0,0},
264
-
265
- {0,0,0,0},
266
-
267
- },
268
-
269
- },
270
-
271
-
272
1008
 
273
1009
  {
274
1010
 
275
- {
276
-
277
- {1,0,0,0},
278
-
279
- {1,1,1,0},
280
-
281
- {0,0,0,0},
282
-
283
- {0,0,0,0},
284
-
285
- },
286
-
287
-
288
-
289
- {
290
-
291
- {1,1,0,0},
292
-
293
- {1,0,0,0},
294
-
295
- {1,0,0,0},
296
-
297
- {0,0,0,0},
298
-
299
- },
300
-
301
-
302
-
303
- {
304
-
305
- {1,1,1,0},
306
-
307
- {0,0,1,0},
308
-
309
- {0,0,0,0},
310
-
311
- {0,0,0,0},
312
-
313
- },
314
-
315
-
316
-
317
- {
318
-
319
- {0,1,0,0},
320
-
321
- {0,1,0,0},
322
-
323
- {1,1,0,0},
324
-
325
- {0,0,0,0},
326
-
327
- },
328
-
329
- },
330
-
331
- {
332
-
333
- {
334
-
335
- {0,0,1,0},
336
-
337
- {1,1,1,0},
338
-
339
- {0,0,0,0},
340
-
341
- {0,0,0,0},
342
-
343
- },
344
-
345
-
346
-
347
- {
348
-
349
- {1,0,0,0},
350
-
351
- {1,0,0,0},
352
-
353
- {1,1,0,0},
354
-
355
- {0,0,0,0},
356
-
357
-
358
-
359
- },
360
-
361
- {
362
-
363
- {1,1,1,0},
364
-
365
- {1,0,0,0},
366
-
367
- {0,0,0,0},
368
-
369
- {0,0,0,0},
370
-
371
-
372
-
373
- },
374
-
375
- {
376
-
377
- {1,1,0,0},
378
-
379
- {0,1,0,0},
380
-
381
- {0,1,0,0},
382
-
383
- {0,0,0,0},
384
-
385
-
386
-
387
- },
388
-
389
- },
390
-
391
- {
392
-
393
- {
394
-
395
- {0,1,0,0},
396
-
397
- {1,1,1,0},
398
-
399
- {0,0,0,0},
400
-
401
- {0,0,0,0},
402
-
403
- },
404
-
405
-
406
-
407
- {
408
-
409
- {1,0,0,0},
410
-
411
- {1,1,0,0},
412
-
413
- {1,0,0,0},
414
-
415
- {0,0,0,0},
416
-
417
-
418
-
419
- },
420
-
421
- {
422
-
423
- {1,1,1,0},
424
-
425
- {0,1,0,0},
426
-
427
- {0,0,0,0},
428
-
429
- {0,0,0,0},
430
-
431
-
432
-
433
- },
434
-
435
- {
436
-
437
- {0,1,0,0},
438
-
439
- {1,1,0,0},
440
-
441
- {0,1,0,0},
442
-
443
- {0,0,0,0},
444
-
445
-
446
-
447
- },
448
-
449
- },
450
-
451
- },
452
-
453
-
454
-
455
- move(new Position()),
456
-
457
- key(new keyState),
458
-
459
- keyAction(new keyState),
460
-
461
- keyPause(new keyState),
462
-
463
- nRote(0),
464
-
465
- color_index{ 5,3,4,1,6,2,7 }
466
-
467
- {
468
-
469
-
470
-
471
- srand((unsigned int)time(NULL));
472
-
473
- LoadDivGraph("Tetris/resource/Block_tmp_24px.png", 8, 4, 2, 24, 24, Image_Block);
474
-
475
- Image_frameX = LoadGraph("Tetris/resource/Image_frameX.png");
476
-
477
- Image_frameY = LoadGraph("Tetris/resource/Image_frameY.png");
478
-
479
- // nowNumber = rand() % 7 == 0;
480
-
481
- set_Rand();
482
-
483
- move->x = 4;
484
-
485
- move->y = 1;
486
-
487
-
488
-
489
- }
1011
+
1012
+
1013
+ move->x += -1;
1014
+
1015
+ }
1016
+
1017
+
1018
+
1019
+
1020
+
1021
+ }else if(Fps::keyboard(KEY_INPUT_DOWN) == 1)
1022
+
1023
+ {
1024
+
1025
+ *key = keyState::Down;
1026
+
1027
+
1028
+
1029
+ }
1030
+
1031
+ else{
1032
+
1033
+ //*key = keyState::Invalid;
1034
+
1035
+ // move->x = 0;
1036
+
1037
+ }
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+
1044
+
1045
+ /*Xで回転*/
1046
+
1047
+ if (Fps::keyboard(KEY_INPUT_X) > 0)
1048
+
1049
+ {
1050
+
1051
+ *keyAction = keyState::Rotation;
1052
+
1053
+ }
1054
+
1055
+
1056
+
1057
+ /*Pキーで一時停止*/
1058
+
1059
+ if (Fps::keyboard(KEY_INPUT_P) > 0)
1060
+
1061
+ {
1062
+
1063
+ *keyPause = keyState::Pause;
1064
+
1065
+ }
1066
+
1067
+
1068
+
1069
+ /*落下管理*/
1070
+
1071
+ if(Fps::now() % 10 == 0)
1072
+
1073
+ {
1074
+
1075
+ if (Block_Down() == true ){
1076
+
1077
+
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+ //DrawFormatString(100, 100, GetColor(255, 255, 255), " %d, %d", move->x, move->y, true);
1084
+
1085
+
1086
+
1087
+ Put_Block();
1088
+
1089
+ Create_Block();
1090
+
1091
+ }
1092
+
1093
+ }
1094
+
1095
+
1096
+
1097
+
1098
+
1099
+
1100
+
1101
+ }
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+ /*回転処理*/
1110
+
1111
+ void Game::Rotate()
1112
+
1113
+ {
1114
+
1115
+
1116
+
1117
+ }
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+ //***********************************************
1124
+
1125
+ void Game::Update()
1126
+
1127
+ {
1128
+
1129
+
1130
+
1131
+ //stage[2][3] = 9;
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+ Control();
1138
+
1139
+ // Block_Clear();
1140
+
1141
+
1142
+
1143
+ //DrawFormatString(200, 200, GetColor(255, 255, 255), " nowNumber %d", nowNumber, true);
1144
+
1145
+
1146
+
1147
+
1148
+
1149
+ //DrawFormatString(0,0,GetColor(255,255,255),"move: %d,%d",move->x,move->y,true);
1150
+
1151
+ }
1152
+
1153
+ //***********************************************
1154
+
1155
+
1156
+
1157
+
1158
+
1159
+
490
1160
 
491
1161
 
492
1162
 
@@ -496,580 +1166,150 @@
496
1166
 
497
1167
  // -------------------------------------------------------------------------------
498
1168
 
499
- // 計算
1169
+ // 描画
500
1170
 
501
1171
  // -------------------------------------------------------------------------------
502
1172
 
503
-
504
-
505
- /*ブロック種類の乱数を引く*/
506
-
507
- void Game::set_Rand()
508
-
509
- {
510
-
511
- //ofs << move->x << ",aaaaaaaa, " << move->y << endl;
512
-
513
-
514
-
515
- while(nowNumber % 7 != 0){
516
-
517
- ofs<<nowNumber<<endl;
518
-
519
- nowNumber = rand() % 7;
520
-
521
- }
522
-
523
- }
524
-
525
-
526
-
527
-
528
-
529
-
530
-
531
- /*ブロックを生成*/
532
-
533
- void Game::Create_Block()
534
-
535
- {
536
-
537
-
538
-
539
- //set_Rand();
540
-
541
- ofs << "aaaaaaaaaaa"<< endl;
542
-
543
-
544
-
545
- //ofs << &move->x << "," << &move->y << endl;
546
-
547
- //int a = move->x;
548
-
549
- //ofs << a<< endl;
550
-
551
-
552
-
553
- //move->x = 4;
554
-
555
- //move->y = 0;
556
-
557
-
558
-
559
- }
560
-
561
-
562
-
563
- /*ブロック削除*/
564
-
565
- void Game::Block_Clear()
566
-
567
- {
568
-
569
-
570
-
571
- }
572
-
573
-
574
-
575
-
576
-
577
-
578
-
579
-
580
-
581
- /*ブロック落下と移動管理*/
582
-
583
- bool Game::Block_Down()
1173
+ // -------------------------------------------------------------------------------
1174
+
1175
+ void Game::Draw_Update()
1176
+
1177
+ {
1178
+
1179
+ //DrawGraph(0,0,back_ground,true);
1180
+
1181
+ //Draw_Hold();
1182
+
1183
+ //Draw_Score();
1184
+
1185
+ //Draw_PutBlock();
1186
+
1187
+ Draw_frame();
1188
+
1189
+ Draw_Block();
1190
+
1191
+ //Draw_Next();
1192
+
1193
+
1194
+
1195
+ }
1196
+
1197
+ // -------------------------------------------------------------------------------
1198
+
1199
+ // -------------------------------------------------------------------------------
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+
1207
+ /*ハンドルを描画に渡す*/
1208
+
1209
+ int Game::get_Block_image()
1210
+
1211
+ {
1212
+
1213
+ return color_index[nowNumber];
1214
+
1215
+
1216
+
1217
+ }
1218
+
1219
+
1220
+
1221
+ /*ブロック描画 (落下中) */
1222
+
1223
+ void Game::Draw_Block()
1224
+
1225
+ {
1226
+
1227
+ Position p;
1228
+
1229
+ p.x = 0;
1230
+
1231
+ p.y = 0;
1232
+
1233
+
1234
+
1235
+ /*要編集*/
1236
+
1237
+ for (p.y = 0; p.y < 4; p.y++)
1238
+
1239
+ {
1240
+
1241
+ for (p.x = 0; p.x < 4; p.x++)
1242
+
1243
+ {
1244
+
1245
+ if (get_isBlock(nowNumber,nRote,p) == 1)
1246
+
1247
+ {
1248
+
1249
+ //DrawGraph((move->x + p.x) * CELL,(move->y + p.y) * CELL, getDraw_Block(),true);////////////////////////////////////////////
1250
+
1251
+ }
1252
+
1253
+ }
1254
+
1255
+ }
1256
+
1257
+ }
1258
+
1259
+ /*今のブロックの画像ハンドルを渡す 描画*/
1260
+
1261
+ int Game::getDraw_Block()
1262
+
1263
+ {
1264
+
1265
+ return Image_Block[nowNumber];
1266
+
1267
+ //return 1;
1268
+
1269
+ }
1270
+
1271
+
1272
+
1273
+ /*ブロック固定描画*/
1274
+
1275
+ void Game::Draw_PutBlock()
584
1276
 
585
1277
  {
586
1278
 
587
1279
 
588
1280
 
589
- move->y += 1;
590
-
591
- if (Collision_X() == true)
592
-
593
- {
594
-
595
- move->y += - 1;
596
-
597
- return true;
598
-
599
- }else{
600
-
601
- move->y += 1;
602
-
603
- return false;
604
-
605
- }
606
-
607
- }
608
-
609
-
610
-
611
-
612
-
613
- /*指定したピースの座標にブロックがあるかどうか?*/
614
-
615
- bool Game::get_isBlock(int n, int r, Position p)
616
-
617
- {
618
-
619
- return Data_Block[n][r][p.y][p.x];
620
-
621
- }
622
-
623
-
624
-
625
- /*ステージ座標に何があるか返す 1 壁 2 ブロック 0 何もなし*/
626
-
627
- int Game::get_Stage(int x,int y)
628
-
629
- {
630
-
631
- return stage[y][x];
632
-
633
- }
634
-
635
-
636
-
637
- /*ステージにブロック情報を入れてる*/
638
-
639
- void Game::set_Stage(int x,int y,int c)
640
-
641
- {
642
-
643
- stage[y][x] = c;
644
-
645
- }
646
-
647
-
648
-
649
- /*当たり判定*/
650
-
651
- bool Game::Collision_X()
652
-
653
- {
654
-
655
- Position p;
656
-
657
- for (int y = 0; y < 4; y++)
658
-
659
- {
660
-
661
- for (int x = 0; x < 4; x++)
662
-
663
- {
664
-
665
- p.x = x;
666
-
667
- p.y = y;
668
-
669
- if( get_isBlock(nowNumber,nRote,p) == true && get_Stage(move->x + x,move->y + y) != 0 )
670
-
671
- {
672
-
673
- return true;
674
-
675
- }
676
-
677
- }
678
-
679
- }
680
-
681
-
682
-
683
- return false;
684
-
685
- }
686
-
687
-
688
-
689
-
690
-
691
- /*ブロックを固定する*/
692
-
693
- void Game::Put_Block()
694
-
695
- {
696
-
697
- int dx = move->x;
698
-
699
- int dy = move->y;
700
-
701
- for(int py = 0; py < 4; py++)
702
-
703
- {
704
-
705
- for(int px = 0; px < 4; px++)
706
-
707
- {
708
-
709
- //ofs << move->x << " , " << move->y << endl;
710
-
711
- //ofs << color_index[nowNumber] <<endl;
712
-
713
-
714
-
715
- //set_Stage((move->x + px), (move->y + py), color_index[nowNumber]);
716
-
717
- set_Stage( (dx + px) ,(dy + py),color_index[nowNumber]);
718
-
719
- // ofs << "eee" << endl;
720
-
721
-
722
-
723
- }
724
-
725
- }
726
-
727
- }
728
-
729
-
730
-
731
- /*キー入力受付・移動処理・当たり判定*/
732
-
733
- void Game::Control()
734
-
735
- {
736
-
737
- if (Fps::keyboard(KEY_INPUT_LEFT) == 1)
738
-
739
- {
740
-
741
- // *key = keyState::Left;
742
-
743
- move->x += -1;
744
-
745
- if(Collision_X() == true)
746
-
747
- {
748
-
749
- move->x += 1;
750
-
751
- }
752
-
753
-
754
-
755
- }
756
-
757
- else if (Fps::keyboard(KEY_INPUT_RIGHT) == 1)
758
-
759
- {
760
-
761
- //*key = keyState::Right;
762
-
763
- move->x += 1;
764
-
765
-
766
-
767
- if (Collision_X() == true)
768
-
769
- {
770
-
771
-
772
-
773
- move->x += -1;
774
-
775
- }
776
-
777
-
778
-
779
-
780
-
781
- }else if(Fps::keyboard(KEY_INPUT_DOWN) == 1)
782
-
783
- {
784
-
785
- *key = keyState::Down;
786
-
787
-
788
-
789
- }
790
-
791
- else{
792
-
793
- //*key = keyState::Invalid;
794
-
795
- // move->x = 0;
796
-
797
- }
798
-
799
-
800
-
801
-
802
-
803
-
804
-
805
- /*Xで回転*/
806
-
807
- if (Fps::keyboard(KEY_INPUT_X) > 0)
808
-
809
- {
810
-
811
- *keyAction = keyState::Rotation;
812
-
813
- }
814
-
815
-
816
-
817
- /*Pキーで一時停止*/
818
-
819
- if (Fps::keyboard(KEY_INPUT_P) > 0)
820
-
821
- {
822
-
823
- *keyPause = keyState::Pause;
824
-
825
- }
826
-
827
-
828
-
829
- /*落下管理*/
830
-
831
- if(Fps::now() % 10 == 0)
832
-
833
- {
834
-
835
- if (Block_Down() == true ){
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
- //DrawFormatString(100, 100, GetColor(255, 255, 255), " %d, %d", move->x, move->y, true);
844
-
845
-
846
-
847
- Put_Block();
848
-
849
- Create_Block();
850
-
851
- }
852
-
853
- }
854
-
855
-
856
-
857
-
858
-
859
-
860
-
861
- }
862
-
863
-
864
-
865
-
866
-
867
-
868
-
869
- /*回転処理*/
870
-
871
- void Game::Rotate()
872
-
873
- {
874
-
875
-
876
-
877
- }
878
-
879
-
880
-
881
-
882
-
883
- //***********************************************
884
-
885
- void Game::Update()
886
-
887
- {
1281
+ }
1282
+
1283
+
1284
+
1285
+ void Game::Draw_Score()
1286
+
1287
+ {
1288
+
1289
+
1290
+
1291
+ }
1292
+
1293
+
1294
+
1295
+ /*ホールド描画*/
1296
+
1297
+ void Game::Draw_Hold()
1298
+
1299
+ {
888
1300
 
889
1301
 
890
1302
 
1303
+ }
1304
+
1305
+
1306
+
891
- //stage[2][3] = 9;
1307
+ void Game::Draw_Next()
1308
+
892
-
1309
+ {
893
-
894
1310
 
895
1311
 
896
1312
 
897
- Control();
898
-
899
- // Block_Clear();
900
-
901
-
902
-
903
- //DrawFormatString(200, 200, GetColor(255, 255, 255), " nowNumber %d", nowNumber, true);
904
-
905
-
906
-
907
-
908
-
909
- //DrawFormatString(0,0,GetColor(255,255,255),"move: %d,%d",move->x,move->y,true);
910
-
911
- }
912
-
913
- //***********************************************
914
-
915
-
916
-
917
-
918
-
919
-
920
-
921
-
922
-
923
-
924
-
925
-
926
-
927
- // -------------------------------------------------------------------------------
928
-
929
- // 描画
930
-
931
- // -------------------------------------------------------------------------------
932
-
933
- // -------------------------------------------------------------------------------
934
-
935
- void Game::Draw_Update()
936
-
937
- {
938
-
939
- //DrawGraph(0,0,back_ground,true);
940
-
941
- //Draw_Hold();
942
-
943
- //Draw_Score();
944
-
945
- //Draw_PutBlock();
946
-
947
- Draw_frame();
948
-
949
- Draw_Block();
950
-
951
- //Draw_Next();
952
-
953
-
954
-
955
- }
956
-
957
- // -------------------------------------------------------------------------------
958
-
959
- // -------------------------------------------------------------------------------
960
-
961
-
962
-
963
-
964
-
965
-
966
-
967
- /*ハンドルを描画に渡す*/
968
-
969
- int Game::get_Block_image()
970
-
971
- {
972
-
973
- return color_index[nowNumber];
974
-
975
-
976
-
977
- }
978
-
979
-
980
-
981
- /*ブロック描画 (落下中) */
982
-
983
- void Game::Draw_Block()
984
-
985
- {
986
-
987
- Position p;
988
-
989
- p.x = 0;
990
-
991
- p.y = 0;
992
-
993
-
994
-
995
- /*要編集*/
996
-
997
- for (p.y = 0; p.y < 4; p.y++)
998
-
999
- {
1000
-
1001
- for (p.x = 0; p.x < 4; p.x++)
1002
-
1003
- {
1004
-
1005
- if (get_isBlock(nowNumber,nRote,p) == 1)
1006
-
1007
- {
1008
-
1009
- //DrawGraph((move->x + p.x) * CELL,(move->y + p.y) * CELL, getDraw_Block(),true);////////////////////////////////////////////
1010
-
1011
- }
1012
-
1013
- }
1014
-
1015
- }
1016
-
1017
- }
1018
-
1019
- /*今のブロックの画像ハンドルを渡す 描画*/
1020
-
1021
- int Game::getDraw_Block()
1022
-
1023
- {
1024
-
1025
- return Image_Block[nowNumber];
1026
-
1027
- //return 1;
1028
-
1029
- }
1030
-
1031
-
1032
-
1033
- /*ブロック固定描画*/
1034
-
1035
- void Game::Draw_PutBlock()
1036
-
1037
- {
1038
-
1039
-
1040
-
1041
- }
1042
-
1043
-
1044
-
1045
- void Game::Draw_Score()
1046
-
1047
- {
1048
-
1049
-
1050
-
1051
- }
1052
-
1053
-
1054
-
1055
- /*ホールド描画*/
1056
-
1057
- void Game::Draw_Hold()
1058
-
1059
- {
1060
-
1061
-
1062
-
1063
- }
1064
-
1065
-
1066
-
1067
- void Game::Draw_Next()
1068
-
1069
- {
1070
-
1071
-
1072
-
1073
1313
  }
1074
1314
 
1075
1315
 

1

提示コードを変更

2019/12/07 12:11

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,488 @@
12
12
 
13
13
  ```ここに言語を入力
14
14
 
15
+
16
+
17
+ /*コンストラクタ*/
18
+
19
+ Game::Game():
20
+
21
+ Data_Block
22
+
23
+ {
24
+
25
+ {
26
+
27
+ {
28
+
29
+ {1,1,1,1},
30
+
31
+ {0,0,0,0},
32
+
33
+ {0,0,0,0},
34
+
35
+ {0,0,0,0},
36
+
37
+ },
38
+
39
+
40
+
41
+ {
42
+
43
+ {0,0,0,1},
44
+
45
+ {0,0,0,1},
46
+
47
+ {0,0,0,1},
48
+
49
+ {0,0,0,1},
50
+
51
+ },
52
+
53
+
54
+
55
+ {
56
+
57
+
58
+
59
+ {1,1,1,1},
60
+
61
+ {0,0,0,0},
62
+
63
+ {0,0,0,0},
64
+
65
+ {0,0,0,0},
66
+
67
+ },
68
+
69
+
70
+
71
+ {
72
+
73
+ {0,0,1,0},
74
+
75
+ {0,0,1,0},
76
+
77
+ {0,0,1,0},
78
+
79
+ {0,0,1,0},
80
+
81
+ },
82
+
83
+ },
84
+
85
+
86
+
87
+ {
88
+
89
+ {
90
+
91
+ {1,1,0,0},
92
+
93
+ {1,1,0,0},
94
+
95
+ {0,0,0,0},
96
+
97
+ {0,0,0,0},
98
+
99
+ },
100
+
101
+
102
+
103
+ {
104
+
105
+ {1,1,0,0},
106
+
107
+ {1,1,0,0},
108
+
109
+ {0,0,0,0},
110
+
111
+ {0,0,0,0},
112
+
113
+ },
114
+
115
+
116
+
117
+ {
118
+
119
+
120
+
121
+ {1,1,0,0},
122
+
123
+ {1,1,0,0},
124
+
125
+ {0,0,0,0},
126
+
127
+ {0,0,0,0},
128
+
129
+ },
130
+
131
+
132
+
133
+ {
134
+
135
+ {1,1,0,0},
136
+
137
+ {1,1,0,0},
138
+
139
+ {0,0,0,0},
140
+
141
+ {0,0,0,0},
142
+
143
+ },
144
+
145
+ },
146
+
147
+
148
+
149
+ {
150
+
151
+ {
152
+
153
+ {0,1,1,0},
154
+
155
+ {1,1,0,0},
156
+
157
+ {0,0,0,0},
158
+
159
+ {0,0,0,0},
160
+
161
+ },
162
+
163
+
164
+
165
+ {
166
+
167
+ {1,0,0,0},
168
+
169
+ {1,1,0,0},
170
+
171
+ {0,1,0,0},
172
+
173
+ {0,0,0,0},
174
+
175
+ },
176
+
177
+
178
+
179
+ {
180
+
181
+
182
+
183
+ {0,1,1,0},
184
+
185
+ {1,1,0,0},
186
+
187
+ {0,0,0,0},
188
+
189
+ {0,0,0,0},
190
+
191
+ },
192
+
193
+
194
+
195
+ {
196
+
197
+ {1,0,0,0},
198
+
199
+ {1,1,0,0},
200
+
201
+ {0,1,0,0},
202
+
203
+ {0,0,0,0},
204
+
205
+ },
206
+
207
+ },
208
+
209
+
210
+
211
+ {
212
+
213
+ {
214
+
215
+ {1,1,0,0},
216
+
217
+ {0,1,1,0},
218
+
219
+ {0,0,0,0},
220
+
221
+ {0,0,0,0},
222
+
223
+ },
224
+
225
+
226
+
227
+ {
228
+
229
+ {0,1,0,0},
230
+
231
+ {1,1,0,0},
232
+
233
+ {1,0,0,0},
234
+
235
+ {0,0,0,0},
236
+
237
+ },
238
+
239
+
240
+
241
+ {
242
+
243
+
244
+
245
+ {1,1,0,0},
246
+
247
+ {0,1,1,0},
248
+
249
+ {0,0,0,0},
250
+
251
+ {0,0,0,0},
252
+
253
+ },
254
+
255
+
256
+
257
+ {
258
+
259
+ {0,1,0,0},
260
+
261
+ {1,1,0,0},
262
+
263
+ {1,0,0,0},
264
+
265
+ {0,0,0,0},
266
+
267
+ },
268
+
269
+ },
270
+
271
+
272
+
273
+ {
274
+
275
+ {
276
+
277
+ {1,0,0,0},
278
+
279
+ {1,1,1,0},
280
+
281
+ {0,0,0,0},
282
+
283
+ {0,0,0,0},
284
+
285
+ },
286
+
287
+
288
+
289
+ {
290
+
291
+ {1,1,0,0},
292
+
293
+ {1,0,0,0},
294
+
295
+ {1,0,0,0},
296
+
297
+ {0,0,0,0},
298
+
299
+ },
300
+
301
+
302
+
303
+ {
304
+
305
+ {1,1,1,0},
306
+
307
+ {0,0,1,0},
308
+
309
+ {0,0,0,0},
310
+
311
+ {0,0,0,0},
312
+
313
+ },
314
+
315
+
316
+
317
+ {
318
+
319
+ {0,1,0,0},
320
+
321
+ {0,1,0,0},
322
+
323
+ {1,1,0,0},
324
+
325
+ {0,0,0,0},
326
+
327
+ },
328
+
329
+ },
330
+
331
+ {
332
+
333
+ {
334
+
335
+ {0,0,1,0},
336
+
337
+ {1,1,1,0},
338
+
339
+ {0,0,0,0},
340
+
341
+ {0,0,0,0},
342
+
343
+ },
344
+
345
+
346
+
347
+ {
348
+
349
+ {1,0,0,0},
350
+
351
+ {1,0,0,0},
352
+
353
+ {1,1,0,0},
354
+
355
+ {0,0,0,0},
356
+
357
+
358
+
359
+ },
360
+
361
+ {
362
+
363
+ {1,1,1,0},
364
+
365
+ {1,0,0,0},
366
+
367
+ {0,0,0,0},
368
+
369
+ {0,0,0,0},
370
+
371
+
372
+
373
+ },
374
+
375
+ {
376
+
377
+ {1,1,0,0},
378
+
379
+ {0,1,0,0},
380
+
381
+ {0,1,0,0},
382
+
383
+ {0,0,0,0},
384
+
385
+
386
+
387
+ },
388
+
389
+ },
390
+
391
+ {
392
+
393
+ {
394
+
395
+ {0,1,0,0},
396
+
397
+ {1,1,1,0},
398
+
399
+ {0,0,0,0},
400
+
401
+ {0,0,0,0},
402
+
403
+ },
404
+
405
+
406
+
407
+ {
408
+
409
+ {1,0,0,0},
410
+
411
+ {1,1,0,0},
412
+
413
+ {1,0,0,0},
414
+
415
+ {0,0,0,0},
416
+
417
+
418
+
419
+ },
420
+
421
+ {
422
+
423
+ {1,1,1,0},
424
+
425
+ {0,1,0,0},
426
+
427
+ {0,0,0,0},
428
+
429
+ {0,0,0,0},
430
+
431
+
432
+
433
+ },
434
+
435
+ {
436
+
437
+ {0,1,0,0},
438
+
439
+ {1,1,0,0},
440
+
441
+ {0,1,0,0},
442
+
443
+ {0,0,0,0},
444
+
445
+
446
+
447
+ },
448
+
449
+ },
450
+
451
+ },
452
+
453
+
454
+
455
+ move(new Position()),
456
+
457
+ key(new keyState),
458
+
459
+ keyAction(new keyState),
460
+
461
+ keyPause(new keyState),
462
+
463
+ nRote(0),
464
+
465
+ color_index{ 5,3,4,1,6,2,7 }
466
+
467
+ {
468
+
469
+
470
+
471
+ srand((unsigned int)time(NULL));
472
+
473
+ LoadDivGraph("Tetris/resource/Block_tmp_24px.png", 8, 4, 2, 24, 24, Image_Block);
474
+
475
+ Image_frameX = LoadGraph("Tetris/resource/Image_frameX.png");
476
+
477
+ Image_frameY = LoadGraph("Tetris/resource/Image_frameY.png");
478
+
479
+ // nowNumber = rand() % 7 == 0;
480
+
481
+ set_Rand();
482
+
483
+ move->x = 4;
484
+
485
+ move->y = 1;
486
+
487
+
488
+
489
+ }
490
+
491
+
492
+
493
+
494
+
495
+
496
+
15
497
  // -------------------------------------------------------------------------------
16
498
 
17
499
  // 計算
@@ -94,7 +576,7 @@
94
576
 
95
577
 
96
578
 
97
- //////////////////////////////////////////////////
579
+
98
580
 
99
581
  /*ブロック落下と移動管理*/
100
582
 
@@ -124,7 +606,7 @@
124
606
 
125
607
  }
126
608
 
127
- ////////////////////////////////////////////////
609
+
128
610
 
129
611
 
130
612
 
@@ -350,9 +832,11 @@
350
832
 
351
833
  {
352
834
 
353
- if(Block_Down() == true)
835
+ if (Block_Down() == true ){
354
-
355
- {
836
+
837
+
838
+
839
+
356
840
 
357
841
 
358
842
 
@@ -522,7 +1006,7 @@
522
1006
 
523
1007
  {
524
1008
 
525
- DrawGraph((move->x + p.x) * CELL,(move->y + p.y) * CELL, getDraw_Block(),true);////////////////////////////////////////////
1009
+ //DrawGraph((move->x + p.x) * CELL,(move->y + p.y) * CELL, getDraw_Block(),true);////////////////////////////////////////////
526
1010
 
527
1011
  }
528
1012