int key;
while (1) {
+ draw_all_windows (&win_meta);
key = getch();
if (key == get_action_key(world.keybindings, "quit"))
break;
else if (key == get_action_key(world.keybindings, "keys nav up") && world.keyswindata->select > 0) {
world.keyswindata->select--;
draw_all_windows (&win_meta); }
- else if (key == get_action_key(world.keybindings, "keys nav down") && world.keyswindata->select < world.keyswindata->max) {
+ else if (key == get_action_key(world.keybindings, "keys nav down") && world.keyswindata->select < world.keyswindata->max)
world.keyswindata->select++;
- draw_all_windows (&win_meta); }
else if (key == get_action_key(world.keybindings, "keys mod")) {
world.keyswindata->edit = 1;
draw_all_windows (&win_meta);
key = getch();
if (key < 1000) // ensure maximum of three digits in key code field
world.keybindings[world.keyswindata->select].key = key;
- world.keyswindata->edit = 0;
- draw_all_windows (&win_meta); }
- else if (key == get_action_key(world.keybindings, "map up") && map.offset_y > 0) {
+ world.keyswindata->edit = 0; }
+ else if (key == get_action_key(world.keybindings, "map up") && map.offset_y > 0)
map.offset_y--;
- draw_all_windows (&win_meta); }
- else if (key == get_action_key(world.keybindings, "map down")) {
+ else if (key == get_action_key(world.keybindings, "map down"))
map.offset_y++;
- draw_all_windows (&win_meta); }
- else if (key == get_action_key(world.keybindings, "map right")) {
+ else if (key == get_action_key(world.keybindings, "map right"))
map.offset_x++;
- draw_all_windows (&win_meta); }
- else if (key == get_action_key(world.keybindings, "map left") && map.offset_x > 0) {
+ else if (key == get_action_key(world.keybindings, "map left") && map.offset_x > 0)
map.offset_x--;
- draw_all_windows (&win_meta); }
else if (key == get_action_key(world.keybindings, "player down") && map.player_y < map.height - 1) {
update_info (&win_info);
update_log (&win_log, "\nYou move south.");
- map.player_y++;
- draw_all_windows (&win_meta); }
+ map.player_y++; }
else if (key == get_action_key(world.keybindings, "player up") && map.player_y > 0) {
update_info (&win_info);
update_log (&win_log, "\nYou move north.");
- map.player_y--;
- draw_all_windows (&win_meta); }
+ map.player_y--; }
else if (key == get_action_key(world.keybindings, "player right") && map.player_x < map.width - 1) {
update_info (&win_info);
update_log (&win_log, "\nYou move east.");
- map.player_x++;
- draw_all_windows (&win_meta); }
+ map.player_x++; }
else if (key == get_action_key(world.keybindings, "player left") && map.player_x > 0) {
update_info (&win_info);
update_log (&win_log, "\nYou move west.");
- map.player_x--;
- draw_all_windows (&win_meta); }
+ map.player_x--; }
else if (key == get_action_key(world.keybindings, "wait") ) {
update_info (&win_info);
- update_log (&win_log, "\nYou wait.");
- draw_all_windows(&win_meta); } }
+ update_log (&win_log, "\nYou wait."); } }
endwin();
return 0; }
win_meta->active = win;
win_meta->chain_start = win; }
win_meta->chain_end = win;
- update_windows(win_meta, win);
- draw_all_windows(win_meta); }
+ update_windows(win_meta, win); }
void suspend_window (struct WinMeta * win_meta, struct Win * win) {
// Destroy win, suspend from window chain. Update geometry of following rows, as well as activity selection.
if (win_meta->active == win) // ... or else to the previous element.
win_meta->active = win->prev; }
win->prev = 0;
- win->next = 0;
- if (0 != win_meta->chain_start)
- draw_all_windows(win_meta); }
+ win->next = 0; }
void place_window (struct WinMeta * win_meta, struct Win * win) {
// Based on position and sizes of previous window, find fitting place for current window.
win_meta->active->width--;
else if (change == '*')
win_meta->active->width++;
- update_windows(win_meta, win_meta->chain_start);
- draw_all_windows(win_meta); }
+ update_windows(win_meta, win_meta->chain_start); }
void cycle_active_window (struct WinMeta * win_meta, char dir) {
// Cycle active window selection forwards (dir = 'n') or backwards.
if (win_meta->active->prev != 0)
win_meta->active = win_meta->active->prev;
else
- win_meta->active = win_meta->chain_end; }
- draw_all_windows(win_meta); }
+ win_meta->active = win_meta->chain_end; } }
void shift_window (struct WinMeta * win_meta, char dir) {
// Move active window forward/backward in window chain. If jumping beyond start/end, move to other chain end.
else
append_window(win_meta, wins[i]);
free(wins);
- win_meta->active = win_shift;
- draw_all_windows(win_meta); } }
+ win_meta->active = win_shift; } }