-void intro() {\r
- static int progress = 0;\r
- switch (progress) {\r
- case 0:\r
- print_text(4, 2, "Move with left/right.", text_speed);\r
-\r
- progress++;\r
- break;\r
- case 1:\r
- update_play(false);\r
- if (x == 5) {\r
- print_text(4, 4, "Jump with up.", text_speed);\r
- print_text(4, 6, "Stand on x.", text_speed);\r
- progress++;\r
- }\r
- break;\r
- case 2:\r
- update_play();\r
- if (x == 8) {\r
- print_text(4, 8, "Collect ? for ???.", text_speed);\r
- progress++;\r
- }\r
- break;\r
- case 3:\r
- update_play(true, 0, 22);\r
- if (get_block(x, y) == '?') {\r
- print_text(4, 10, "Avoid /\\.", text_speed);\r
- progress++;\r
- }\r
- break;\r
- case 4:\r
- update_play();\r
- if (x == 39) {\r
- print_text(4, 14, "Finish lvl by reaching O.", text_speed);\r
- progress++;\r
- }\r
- break;\r
- case 5:\r
- update_play();\r
- if (get_block(x, y) == 'O') {\r
- load_level(1);\r
- }\r
- break;\r
+// Keys\r
+\r
+enum class Key {\r
+ Left,\r
+ Right,\r
+ Jump,\r
+ Exit,\r
+ Redraw,\r
+ COUNT\r
+};\r
+\r
+bool key_state[(uint64_t)Key::COUNT];\r
+bool key_state_old[(uint64_t)Key::COUNT];\r
+\r
+int key_get_vk(Key key) {\r
+ switch (key) {\r
+ case Key::Left: return 'A';\r
+ case Key::Right: return 'D';\r
+ case Key::Jump: return VK_SPACE;\r
+ case Key::Exit: return VK_ESCAPE;\r
+ case Key::Redraw: return 'R';\r
+ default: return 0;\r