質問編集履歴
1
ソースコードの追加及び分割
test
CHANGED
File without changes
|
test
CHANGED
@@ -162,11 +162,11 @@
|
|
162
162
|
|
163
163
|
}
|
164
164
|
|
165
|
-
|
165
|
+
```
|
166
|
+
|
167
|
+
|
168
|
+
|
166
|
-
|
169
|
+
```C++
|
167
|
-
|
168
|
-
|
169
|
-
|
170
170
|
|
171
171
|
/*Menu.h*/
|
172
172
|
|
@@ -268,11 +268,11 @@
|
|
268
268
|
|
269
269
|
};
|
270
270
|
|
271
|
-
|
271
|
+
```
|
272
|
+
|
273
|
+
|
274
|
+
|
272
|
-
|
275
|
+
```C++
|
273
|
-
|
274
|
-
|
275
|
-
|
276
276
|
|
277
277
|
/*Menu.cpp*/
|
278
278
|
|
@@ -570,6 +570,170 @@
|
|
570
570
|
|
571
571
|
|
572
572
|
|
573
|
+
|
574
|
+
|
575
|
+
```C++
|
576
|
+
|
577
|
+
/*KeyInput.h*/
|
578
|
+
|
579
|
+
#pragma once
|
580
|
+
|
581
|
+
class KeyInput {
|
582
|
+
|
583
|
+
private:
|
584
|
+
|
585
|
+
int
|
586
|
+
|
587
|
+
key_is_pressing_for[256];
|
588
|
+
|
589
|
+
const int*
|
590
|
+
|
591
|
+
key_state_pointer;
|
592
|
+
|
593
|
+
char
|
594
|
+
|
595
|
+
keys[256];
|
596
|
+
|
597
|
+
const char*
|
598
|
+
|
599
|
+
key_pointer;
|
600
|
+
|
601
|
+
public:
|
602
|
+
|
603
|
+
void refresh_keys();
|
604
|
+
|
605
|
+
int get_key_state(int id);
|
606
|
+
|
607
|
+
const char* get_key_pointer();
|
608
|
+
|
609
|
+
const int* get_key_state_pointer();
|
610
|
+
|
611
|
+
KeyInput();
|
612
|
+
|
613
|
+
};
|
614
|
+
|
615
|
+
```
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
```C++
|
622
|
+
|
623
|
+
/*KeyInput.cpp*/
|
624
|
+
|
625
|
+
#ifndef STD_ARRAY
|
626
|
+
|
627
|
+
#define STD_ARRAY
|
628
|
+
|
629
|
+
#include <array>
|
630
|
+
|
631
|
+
#endif
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
#include <DxLib.h>
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
class KeyInput {
|
640
|
+
|
641
|
+
private:
|
642
|
+
|
643
|
+
int
|
644
|
+
|
645
|
+
key_is_pressing_for[256];
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
const int*
|
650
|
+
|
651
|
+
key_state_pointer;
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
char
|
656
|
+
|
657
|
+
keys[256];
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
const char*
|
662
|
+
|
663
|
+
key_pointer;
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
public:
|
668
|
+
|
669
|
+
void refresh_keys() {
|
670
|
+
|
671
|
+
int i;
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
GetHitKeyStateAll(keys);
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
for (i = 0; i <= 256; i++) {
|
680
|
+
|
681
|
+
if (keys[i] != 0) {
|
682
|
+
|
683
|
+
key_is_pressing_for[i]++;
|
684
|
+
|
685
|
+
}
|
686
|
+
|
687
|
+
else {
|
688
|
+
|
689
|
+
key_is_pressing_for[i] = 0;
|
690
|
+
|
691
|
+
}
|
692
|
+
|
693
|
+
}
|
694
|
+
|
695
|
+
}
|
696
|
+
|
697
|
+
|
698
|
+
|
699
|
+
int get_key_state(int id) {
|
700
|
+
|
701
|
+
return key_is_pressing_for[id];
|
702
|
+
|
703
|
+
}
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
const char* get_key_pointer() {
|
708
|
+
|
709
|
+
return key_pointer;
|
710
|
+
|
711
|
+
}
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
const int* get_key_state_pointer() {
|
716
|
+
|
717
|
+
return key_is_pressing_for;
|
718
|
+
|
719
|
+
}
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
KeyInput() {
|
724
|
+
|
725
|
+
key_pointer = keys;
|
726
|
+
|
727
|
+
key_state_pointer = key_is_pressing_for;
|
728
|
+
|
729
|
+
}
|
730
|
+
|
731
|
+
};
|
732
|
+
|
733
|
+
```
|
734
|
+
|
735
|
+
|
736
|
+
|
573
737
|
### 試したこと
|
574
738
|
|
575
739
|
|