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) {
void write_uint32_bigendian(uint32_t x, FILE * file);
void save_game(struct World *);
void toggle_window (struct WinMeta *, struct Win *);
+void scroll_pad (struct WinMeta *, char);
void growshrink_active_window (struct WinMeta *, char);
struct Map init_map ();
void map_scroll (struct Map *, char);
win_meta.active = 0;
return win_meta; }
-void scroll_pad (struct WinMeta * win_meta, char dir) {
-// Scroll pad left or right (if possible).
- if ('+' == dir && win_meta->pad_offset + win_meta->width < getmaxx(win_meta->pad) - 1)
- win_meta->pad_offset++;
- else if ('-' == dir && win_meta->pad_offset > 0)
- win_meta->pad_offset--; }
-
struct Win init_window (struct WinMeta * win_meta, char * title, void * data, void * func) {
// Create and populate Win struct with sane default values.
struct Win win;
free(all_corners);
uint16_t y;
if (win_meta->pad_offset > 0)
- draw_vertical_scroll_hint(win_meta, win_meta->pad_offset, win_meta->pad_offset + 1, '<');
+ draw_vertical_scroll_hint(win_meta, win_meta->pad_offset, win_meta->pad_offset + 1, '<');
if (win_meta->pad_offset + win_meta->width < getmaxx(win_meta->pad) - 1)
for (y = 0; y < win_meta->height; y++)
draw_vertical_scroll_hint(win_meta, win_meta->pad_offset + win_meta->width - 1,
append_window(win_meta, wins[i]);
free(wins);
win_meta->active = win_shift; } }
+
+void reset_pad_offset(struct WinMeta * win_meta, uint16_t new_offset) {
+// Apply new_offset to windows pad, if it proves to be sane.
+ if (new_offset >= 0 && new_offset + win_meta->width < getmaxx(win_meta->pad))
+ win_meta->pad_offset = new_offset; }
struct yx br; };
struct WinMeta init_win_meta (WINDOW *);
-void scroll_pad (struct WinMeta *, char);
struct Win init_window (struct WinMeta *, char *, void *, void *);
void append_window (struct WinMeta *, struct Win *);
void suspend_window (struct WinMeta *, struct Win *);
void resize_active_window (struct WinMeta *, uint16_t, uint16_t);
void cycle_active_window (struct WinMeta *, char);
void shift_active_window (struct WinMeta *, char);
+void reset_pad_offset (struct WinMeta *, uint16_t);