home · contact · privacy
init_win() now takes arguments for the designated window height and width.
[plomrogue] / src / windows.c
index 86cf1fecde03da528ceec6bab03170c85e68113a..ef7a30dfade86df3759e6e44c3c0181f90205ed8 100644 (file)
@@ -270,6 +270,7 @@ extern struct WinMeta init_win_meta(WINDOW * screen)
 
 
 extern struct Win init_win(struct WinMeta * wmeta, char * title,
+                           uint16_t height, uint16_t width,
                            void * data, void * func)
 {
     struct Win w;
@@ -277,10 +278,24 @@ extern struct Win init_win(struct WinMeta * wmeta, char * title,
     w.next             = 0;
     w.frame.curses_win = 0;
     w.title            = title;
-    w.frame.size.x     = 20;
-    w.frame.size.y     = wmeta->padframe.size.y - 1;
     w.data             = data;
     w.draw             = func;
+    if (width > 0)
+    {
+        w.frame.size.x = width;
+    }
+    else
+    {
+        w.frame.size.x = 1;
+    }
+    if (height > 0 && height <= wmeta->padframe.size.y - 1)
+    {
+        w.frame.size.y = height;
+    }
+    else
+    {
+        w.frame.size.y = wmeta->padframe.size.y - 1;
+    }
     return w;
 }