void toggle_window (struct WinMeta * win_meta, struct Win * win) {
// Toggle display of window win.
- if (0 != win->curses)
+ if (0 != win->frame.curses_win)
suspend_window(win_meta, win);
else
append_window(win_meta, win); }
+void scroll_pad (struct WinMeta * win_meta, char dir) {
+// Try to scroll pad left or right.
+ if ('+' == dir)
+ reset_pad_offset(win_meta, win_meta->pad_offset + 1);
+ else if ('-' == dir)
+ reset_pad_offset(win_meta, win_meta->pad_offset - 1); }
+
void growshrink_active_window (struct WinMeta * win_meta, char change) {
// Grow or shrink active window horizontally or vertically by one cell size.
if (0 != win_meta->active) {
- uint16_t height = win_meta->active->height;
- uint16_t width = win_meta->active->width;
+ uint16_t height = win_meta->active->frame.size.y;
+ uint16_t width = win_meta->active->frame.size.x;
if (change == '-')
height--;
else if (change == '+')
curpos = y * map.width + x;
if ('~' == map.cells[curpos] &&
( (curpos >= map.width && '.' == map.cells[curpos - map.width])
- || (curpos < map.width * (map.height - 1) && '.' == map.cells[curpos + map.width])
- || (curpos > 0 && '.' == map.cells[curpos - 1] && curpos % map.width != 0)
- || (curpos < (map.width * map.height) && '.' == map.cells[curpos + 1] && (curpos + 1) % map.width != 0)))
+ || (curpos < map.width * (map.height-1) && '.' == map.cells[curpos + map.width])
+ || (curpos > 0 && curpos % map.width != 0 && '.' == map.cells[curpos-1])
+ || (curpos < (map.width * map.height) && (curpos+1) % map.width != 0 && '.' == map.cells[curpos+1])))
map.cells[y * map.width + x] = '.'; }
return map; }
struct Win win_map = init_window(&win_meta, "Map", &world, draw_map_win);
struct Win win_info = init_window(&win_meta, "Info", &world, draw_info_win);
struct Win win_log = init_window(&win_meta, "Log", &world, draw_log_win);
- win_keys.width = 29;
- win_map.width = win_meta.width - win_keys.width - win_log.width - 2;
- win_info.height = 1;
- win_log.height = win_meta.height - 3;
+ win_keys.frame.size.x = 29;
+ win_map.frame.size.x = win_meta.pad.size.x - win_keys.frame.size.x - win_log.frame.size.x - 2;
+ win_info.frame.size.y = 1;
+ win_log.frame.size.y = win_meta.pad.size.y - 3;
toggle_window(&win_meta, &win_keys);
toggle_window(&win_meta, &win_map);
toggle_window(&win_meta, &win_info);
toggle_window(&win_meta, &win_log);
int key;
- unsigned char quit_called;
+ unsigned char quit_called = 0;
if (0 == world.interactive) {
unsigned char still_reading_file = 1;
int action;