Added text input thing...
This commit is contained in:
parent
5f87810f81
commit
542743fd97
15
xurses.c
15
xurses.c
@ -113,6 +113,8 @@ int curses_screen_width = 0;
|
|||||||
int curses_screen_height = 0;
|
int curses_screen_height = 0;
|
||||||
int curses_active = 1;
|
int curses_active = 1;
|
||||||
|
|
||||||
|
char curses_character = '\0';
|
||||||
|
|
||||||
/* External function definitions. */
|
/* External function definitions. */
|
||||||
|
|
||||||
void curses_configure (void) {
|
void curses_configure (void) {
|
||||||
@ -151,12 +153,14 @@ void curses_configure (void) {
|
|||||||
void curses_synchronize (void) {
|
void curses_synchronize (void) {
|
||||||
int signal;
|
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);
|
out (curses_screen, CURSES_REVERT + CURSES_FORMAT * curses_screen_width * curses_screen_height + CURSES_CURSOR);
|
||||||
|
|
||||||
in (& signal, 4);
|
in (& signal, 4);
|
||||||
|
|
||||||
|
curses_character = (char) signal;
|
||||||
|
|
||||||
if ((char) signal == '\033') {
|
if ((char) signal == '\033') {
|
||||||
curses_signal |= SIGNAL_ESCAPE;
|
curses_signal |= SIGNAL_ESCAPE;
|
||||||
} else if (character_is_digit ((char) signal) != 0) {
|
} 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) {
|
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);
|
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;
|
int offset;
|
||||||
|
|
||||||
for (offset = 0; offset != limit; ++offset) {
|
for (offset = 0; offset != limit; ++offset) {
|
||||||
if (* x + offset < curses_screen_width) {
|
|
||||||
if (string [offset] == '\n') {
|
if (string [offset] == '\n') {
|
||||||
* x = curses_realign_x;
|
* x = curses_realign_x;
|
||||||
* y += 1;
|
* 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);
|
curses_render_character (string [offset], colour, effect, * x, * y);
|
||||||
* x += 1;
|
* x += 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
curses_render_character ('+', COLOUR_GREY, EFFECT_BOLD, * x, * y);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
xurses.h
2
xurses.h
@ -17,6 +17,8 @@ extern int curses_screen_width;
|
|||||||
extern int curses_screen_height;
|
extern int curses_screen_height;
|
||||||
extern int curses_active;
|
extern int curses_active;
|
||||||
|
|
||||||
|
extern char curses_character;
|
||||||
|
|
||||||
extern void curses_configure (void);
|
extern void curses_configure (void);
|
||||||
extern void curses_synchronize (void);
|
extern void curses_synchronize (void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user