"main().";
exit_err(init_win_meta(screen, &win_meta), &world, err_winmem);
world.wins.meta = &win_meta;
- struct Win win_keys = init_win(&win_meta, "Keys",
- 0, 29, &world, draw_keys_win);
- struct Win win_info = init_win(&win_meta, "Info",
- 3, 20, &world, draw_info_win);
- uint16_t height_logwin = win_meta.padframe.size.y
- - (2 + win_info.frame.size.y);
- struct Win win_log = init_win(&win_meta, "Log",
- height_logwin, 20, &world, draw_log_win);
- uint16_t width_mapwin = win_meta.padframe.size.x - win_keys.frame.size.x
- - win_log.frame.size.x - 2;
- struct Win win_map = init_win(&win_meta, "Map",
- 0, width_mapwin, &world, draw_map_win);
+ struct Win win_keys = init_win(&win_meta,
+ "Keys", 0, 29, &world, draw_keys_win);
+ struct Win win_info = init_win(&win_meta,
+ "Info", 3, 20, &world, draw_info_win);
+ struct Win win_log = init_win(&win_meta,
+ "Log", -4, 20, &world, draw_log_win);
+ struct Win win_map = init_win(&win_meta,
+ "Map", 0, -51, &world, draw_map_win);
world.wins.keys = &win_keys;
world.wins.log = &win_log;
world.wins.info = &win_info;
extern struct Win init_win(struct WinMeta * wmeta, char * title,
- uint16_t height, uint16_t width,
+ int16_t height, int16_t width,
void * data, void * func)
{
struct Win w;
w._title = title;
w.data = data;
w._draw = func;
- if (width > 0)
+ if (0 < width)
{
w.frame.size.x = width;
}
+ else if (0 > width)
+ {
+ w.frame.size.x = wmeta->padframe.size.x + width;
+ }
else
{
w.frame.size.x = wmeta->padframe.size.x;
}
- if (height > 0 && height <= wmeta->padframe.size.y - 1)
+ if (0 < height && height <= wmeta->padframe.size.y - 1)
{
w.frame.size.y = height;
}
+ else if (0 > height && wmeta->padframe.size.y + (height - 1) > 0)
+ {
+ w.frame.size.y = wmeta->padframe.size.y + (height - 1);
+ }
else
{
w.frame.size.y = wmeta->padframe.size.y - 1;
* if the window is visible.
*
* Pass 0 for "width" to make the window as wide as the terminal screen. Pass
- * for "height" 0 or a value larger than the maximum window height possible
- * within the virtual screen to attain that maximum window height.
+ * negative values for "width" to make the size so many cells smaller than the
+ * terminal screen. Pass 0 for "height" to give the window the maximum allowed
+ * height: one cell smaller than the terminal screen. Pass negative values to
+ * make the window so many smalls smaller than the terminal screen. The maximum
+ * allowed height is also applied for positive values that exceed it or negative
+ * values that would reduce the window height < 1 cell.
*
* Other members of the Win struct are initialized to 0. The window will stay
* invisible until appended to the chain of visible windows via append_win().
*/
extern struct Win init_win(struct WinMeta * wmeta, char * title,
- uint16_t height, uint16_t width,
+ int16_t height, int16_t width,
void * data, void * func);