teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

文章を修正

2020/12/01 03:53

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -41,44 +41,43 @@
41
41
  ```
42
42
  //////////////////////////////////////////////////////////////
43
43
  ```cpp
44
+ // キー入力
44
45
  KeyCode Input_Key::InputDown()
45
46
  {
46
-
47
- // int _a = _getch();
48
- _getch();
49
- if (_kbhit() == 1) {
50
- char p = iskeypressed();
51
- if (p == 0x4d)//右
52
- {
53
- return KeyCode::Right;
54
- }
55
- else if (p == 0x4b)//左
56
- {
57
- return KeyCode::Left;
58
47
 
48
+ char p = _getch();
49
+ if (p == 0x4d)//右
50
+ {
51
+ return KeyCode::Right;
59
- }
52
+ }
60
- else if (p == 0x48)//
53
+ else if (p == 0x4b)//
61
- {
54
+ {
62
- return KeyCode::Up;
55
+ return KeyCode::Left;
63
56
 
64
- }
65
- else if (p == 0x50)//下
66
- {
67
- return KeyCode::Down;
68
- }
69
- else if (p == 0x20)//スペースキー
70
- {
71
- return KeyCode::Space; //スペースキー
72
- }
73
- else if (p == 0x1b)//ESCキーで強制終了
74
- {
75
- exit(0);
76
- }
77
- else
78
- {
79
- return KeyCode::Invalid;
80
- }
81
57
  }
58
+ else if (p == 0x48)//上
59
+ {
60
+ return KeyCode::Up;
61
+
62
+ }
63
+ else if (p == 0x50)//下
64
+ {
65
+ return KeyCode::Down;
66
+ }
67
+ else if (p == 0x20)//スペースキー
68
+ {
69
+ return KeyCode::Space; //スペースキー
70
+ }
71
+ else if (p == 0x1b)//ESCキーで強制終了
72
+ {
73
+ exit(0);
74
+ }
75
+ else
76
+ {
77
+ return KeyCode::Invalid;
78
+ }
79
+
82
80
  }
83
81
 
82
+
84
83
  ```