From 5dd00eaf46bd250099c368c7b4a66e0e4dfc4b6f Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Thu, 18 Jul 2019 18:46:58 +0100 Subject: different line styles --- TODO | 13 +++-- gramscii.c | 158 ++++++++++++++++++++++++++++++++++--------------------------- 2 files changed, 98 insertions(+), 73 deletions(-) diff --git a/TODO b/TODO index 956af84..e9d7819 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,14 @@ + optimize redraws (i.e., avoid to redraw if possible) -- change cursor shape according to action -+ implement box +- (?) change cursor shape according to action +- save to file - implement arrow -- set different box styles -+ add status bar +- manage special chars (DEL/CANC) during text insert + (also do not print unmanaged chars!) +- load from file +- insert file at position - get screen geometry - allow scrolling (both vertical and horizontal) +* set different line styles (done for hl, vl, corner) +* add status bar +* implement box diff --git a/gramscii.c b/gramscii.c index 40d1f1e..bf988be 100644 --- a/gramscii.c +++ b/gramscii.c @@ -26,14 +26,12 @@ #define WIDTH 100 #define HEIGHT 25 +#define NOFIX 0x0 +#define FIX 0x1 + #define BG ' ' #define PTR '+' #define UND '_' -#define LINE_H '-' -#define LINE_V '|' -#define DBLINE_H '=' -#define DBLINE_V 'u' -#define BLDLINE '#' #define ARR_L '<' #define ARR_R '>' #define ARR_U '^' @@ -52,10 +50,15 @@ int y; int step; char cursor; char corner; -char box_line_h; -char box_line_v; -char arrow_line_h; -char arrow_line_v; +char hlines[] = {"-~=#@._"}; +char vlines[] = {"|H#@:;i"}; +char corners[] = {"+'H#@.\""}; +int hlines_sz= sizeof(hlines); +int vlines_sz= sizeof(vlines); +int corners_sz = sizeof(corners); +int cur_hl, cur_vl, cur_corn; +char line_h; +char line_v; struct termios t1, t2; @@ -69,8 +72,6 @@ void cleanup(int s){ void show_cursor(){ printf("\033[%d;%df", y+1, x+1); - //putchar(screen[y][x]); - //printf("\033[%d;%df", y+1, x+2); } void set(char c){ @@ -88,46 +89,46 @@ void draw_xy(int x, int y, char c){ putchar(c); } -void clear(){ - screen[y][x] = BG; -} - void init_screen(){ int i; for(i=0; i