diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -45,8 +45,18 @@ int main(void) { Map map = rbt_maze_map(width, height, (unsigned int) time(NULL)); Position fake_start_position_to_pass_into_draw_map = {0, 0}; Position fake_goal_position_to_pass_into_draw_map = {width*2-2, height*2-2}; - draw_map(map, width*2-1, height*2-1, fake_start_position_to_pass_into_draw_map, fake_goal_position_to_pass_into_draw_map); - getch(); + int offset_x = 0, offset_y = 0; + while (1) { + draw_map(map, width*2-1, height*2-1, offset_x, offset_y, fake_start_position_to_pass_into_draw_map, fake_goal_position_to_pass_into_draw_map); + char c = getch(); + switch (c) { + case 'h': offset_x -= 2; break; + case 'l': offset_x += 2; break; + case 'j': offset_y += 1; break; + case 'k': offset_y -= 1; break; + case 'q': endwin(); return 0; + } + } endwin(); return 0; |
