raw();
struct WinMeta win_meta = init_win_meta(screen);
- struct Win win_keys = init_window(&win_meta, "Keys");
- win_keys.draw = draw_keys_window;
- win_keys.data = &world;
- struct Win win_map = init_window(&win_meta, "Map");
- win_map.draw = draw_map;
- win_map.data = &world;
- struct Win win_info = init_window(&win_meta, "Info");
- win_info.draw = draw_info;
- win_info.data = &world;
- struct Win win_log = init_window(&win_meta, "Log");
- win_log.draw = draw_log;
- win_log.data = &world;
+ struct Win win_keys = init_window(&win_meta, "Keys", &world, draw_keys_window);
+ struct Win win_map = init_window(&win_meta, "Map", &world, draw_map);
+ struct Win win_info = init_window(&win_meta, "Info", &world, draw_info);
+ struct Win win_log = init_window(&win_meta, "Log", &world, draw_log);
int key;
while (1) {
else if ('-' == dir && win_meta->pad_offset > 0)
win_meta->pad_offset--; }
-struct Win init_window (struct WinMeta * win_meta, char * title) {
+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;
win.prev = 0;
win.title = title;
win.width = 20;
win.height = win_meta->height - 1;
+ win.data = data;
+ win.draw = func;
return win; }
void append_window (struct WinMeta * win_meta, struct Win * win) {
struct WinMeta init_win_meta (WINDOW *);
void scroll_pad (struct WinMeta *, char);
-struct Win init_window (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 *);
struct yx place_window (struct WinMeta *, struct Win *);