]> 4ch.mooo.com Git - 16.git/blob - src/eng_comm.cpp
new file: 16.bat
[16.git] / src / eng_comm.cpp
1 #include "src\eng_comm.h"\r
2 #include <iostream>\r
3                 int xxxx = 0;\r
4                 int yyyy = 0;\r
5                 int qing = 4;\r
6 \r
7 namespace engine {\r
8 \r
9         /*engine_message do_communication()\r
10         {\r
11                 //communication here\r
12 //====          std::cout << "COMMUNICATION HERE" << std::endl;\r
13                 int msg;\r
14                 std::cout << "Enter 1 for continue." << std::endl;\r
15                 std::cin >> msg;\r
16                 return msg == 1 ? ENGINE_RUN : ENGINE_QUIT;\r
17         }*/\r
18         /*engine_message do_communication(bool *input)\r
19         {\r
20                 //communication here\r
21 //====          std::cout << "COMMUNICATION HERE" << std::endl;\r
22                 return input['e'] == true ? ENGINE_QUIT : ENGINE_RUN;\r
23         }*/\r
24         engine_message do_communication(byte input)\r
25         {\r
26                 //communication here\r
27 //====          std::cout << "COMMUNICATION HERE" << std::endl;\r
28                 if(input == 44){\r
29                         FMKeyOn(0, 0x106, 4);\r
30                 }else if(input == 172) FMKeyOff(0);\r
31                 if(input == KEY_X){\r
32                         sound(440);\r
33                         delay(100);\r
34                         nosound();\r
35                         //delay(50);\r
36                 }else if(input == KEY_X+128) nosound();\r
37                 if(12 >= input && input >= 2) qing = input - 1;\r
38                 if(input == 57) qing = 0;
39                 \r
40                 if(qing > 0){\r
41                         ding(qing);\r
42                 }else{\r
43                         if(keyp(KEY_UP) || keyp(KEY_DOWN) || keyp(KEY_LEFT) || keyp(KEY_RIGHT)) etesuto(xxxx, yyyy);\r
44                         if(keyp(KEY_UP)){\r
45                                 if(--yyyy < 0) yyyy = 0;\r
46                         }else if(keyp(KEY_DOWN)){\r
47                                 if(++yyyy >= SH) yyyy = SH - 1;\r
48                         }\r
49                         if(keyp(KEY_LEFT)){\r
50                                 if(--xxxx < 0) xxxx = 0;\r
51                         }\r
52                         if(keyp(KEY_RIGHT)){\r
53                                 if(++xxxx >= SW) xxxx = SW - 1;\r
54                         }\r
55                         qtesuto(xxxx, yyyy, 14);\r
56                 }\r
57                 //if(input) printf("%03d\n", input);
58                 return input == 1 ? ENGINE_QUIT : ENGINE_RUN;\r
59         }\r
60 \r
61 }\r