From 03862852b128748358dcb39ce50600eef0ba1a71 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 30 May 2022 12:31:23 +0200 Subject: use ncurses instead of poopy ui library --- client/ui.h | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) (limited to 'client/ui.h') diff --git a/client/ui.h b/client/ui.h index 610e3fc..06a8cea 100644 --- a/client/ui.h +++ b/client/ui.h @@ -1,35 +1,11 @@ #pragma once #include +#include -#include "../shared/bool.h" - -typedef struct { - unsigned int width; - unsigned int height; - unsigned int cursor_pos; -} w2_s_ui_tty_canvas; - -typedef enum { - W2_UI_COL_BLK, - W2_UI_COL_RED, - W2_UI_COL_GRN, - W2_UI_COL_YEL, - W2_UI_COL_BLU, - W2_UI_COL_MAG, - W2_UI_COL_CYN, - W2_UI_COL_WHT, - W2_UI_COL_RST, -} w2_e_colors; - -typedef enum { - W2_UI_ALIGN_LEFT, - W2_UI_ALIGN_CENTER, - W2_UI_ALIGN_RIGHT, -} w2_e_alignment; - -extern bool g_w2_ui_enable_color; -extern w2_s_ui_tty_canvas g_w2_ui_canvas; +extern WINDOW *g_w2_ui_win; +extern unsigned int g_w2_ui_width; +extern unsigned int g_w2_ui_height; /** update terminal props */ void w2_ui_update(); @@ -37,21 +13,11 @@ void w2_ui_update(); void w2_ui_clear(); /** draw complete ui */ void w2_ui_paint(); -/** draw status bar */ -void w2_ui_paint_statusbar(); /** update and paint */ void w2_ui_main(); -/** get ansi color code for foreground color */ -char *w2_ui_set_fg(w2_e_colors color); -/** get ansi color code for background color */ -char *w2_ui_set_bg(w2_e_colors color); - -/** align `text` `align` with `text` buffer length `length` */ -void w2_ui_align(char *text, w2_e_alignment align, unsigned int length); +/** draw status bar */ +void w2_ui_paint_statusbar(); +/** draw tab bar */ +void w2_ui_paint_tabbar(); -/** - * trim spaces from `top` and overlay on top of `bottom` - * both strings should be at least `length` long - */ -void w2_ui_overlay(char *bottom, char *top, unsigned int length); -- cgit v1.2.3