summaryrefslogtreecommitdiffstats
path: root/helpers.c
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-07-06 06:06:14 -0400
committerMalfurious <m@lfurio.us>2023-07-06 06:06:14 -0400
commitd622a30a82f8ac6914926a5bfdc0e31dff6ce55d (patch)
tree14233977af248b4cc0a0eb83325b39874147fb7e /helpers.c
parent4def3856f105b1461615285c9e33750a51177994 (diff)
downloadmisplays-d622a30a82f8ac6914926a5bfdc0e31dff6ce55d.tar.gz
misplays-d622a30a82f8ac6914926a5bfdc0e31dff6ce55d.zip
Rename curshelpers unit to 'helpers'
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'helpers.c')
-rw-r--r--helpers.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/helpers.c b/helpers.c
new file mode 100644
index 0000000..c93b774
--- /dev/null
+++ b/helpers.c
@@ -0,0 +1,47 @@
+#include <locale.h>
+#include <stdarg.h>
+
+#include "helpers.h"
+
+void cursinit(void) {
+ setlocale(LC_ALL, "");
+ initscr();
+ cbreak();
+ noecho();
+ keypad(stdscr, TRUE);
+ curs_set(FALSE);
+ timeout(25);
+ refresh();
+}
+
+void cursupdate(void) {
+ update_panels();
+ doupdate();
+}
+
+PANEL *newpan(int h, int w, int y, int x) {
+ WINDOW *win = newwin(h, w, y, x);
+ scrollok(win, TRUE);
+ return new_panel(win);
+}
+
+void delpan(PANEL *pan) {
+ WINDOW *win = panel_window(pan);
+ del_panel(pan);
+ delwin(win);
+}
+
+void reset_panel(PANEL *pan, int h, int w, int y, int x) {
+ WINDOW *win = panel_window(pan);
+ wresize(win, h, w);
+ replace_panel(pan, win);
+ move_panel(pan, y, x);
+}
+
+int pprintw(PANEL *pan, const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ int res = vw_printw(panel_window(pan), fmt, args);
+ va_end(args);
+ return res;
+}