Added text input thing...

This commit is contained in:
Ognjen Milan Robovic 2023-10-29 11:49:29 -04:00
parent 5f87810f81
commit 542743fd97
2 changed files with 19 additions and 14 deletions

View File

@ -113,6 +113,8 @@ int curses_screen_width = 0;
int curses_screen_height = 0;
int curses_active = 1;
char curses_character = '\0';
/* External function definitions. */
void curses_configure (void) {
@ -151,12 +153,14 @@ void curses_configure (void) {
void curses_synchronize (void) {
int signal;
curses_signal = signal = 0;
curses_signal = curses_character = signal = 0;
out (curses_screen, CURSES_REVERT + CURSES_FORMAT * curses_screen_width * curses_screen_height + CURSES_CURSOR);
in (& signal, 4);
curses_character = (char) signal;
if ((char) signal == '\033') {
curses_signal |= SIGNAL_ESCAPE;
} else if (character_is_digit ((char) signal) != 0) {
@ -207,6 +211,10 @@ void curses_render_cursor (int x, int y) {
}
void curses_render_character (char character, int colour, int effect, int x, int y) {
if ((x >= curses_screen_width) || (y >= curses_screen_height)) {
return;
}
string_copy_limit (curses_screen_offset (x, y), curses_format_character (character, colour, effect), CURSES_FORMAT);
}
@ -224,7 +232,6 @@ void curses_render_string_point (char * string, int limit, int colour, int effec
int offset;
for (offset = 0; offset != limit; ++offset) {
if (* x + offset < curses_screen_width) {
if (string [offset] == '\n') {
* x = curses_realign_x;
* y += 1;
@ -234,10 +241,6 @@ void curses_render_string_point (char * string, int limit, int colour, int effec
curses_render_character (string [offset], colour, effect, * x, * y);
* x += 1;
}
} else {
curses_render_character ('+', COLOUR_GREY, EFFECT_BOLD, * x, * y);
return;
}
}
}

View File

@ -17,6 +17,8 @@ extern int curses_screen_width;
extern int curses_screen_height;
extern int curses_active;
extern char curses_character;
extern void curses_configure (void);
extern void curses_synchronize (void);