瀏覽代碼

Added text input thing...

master
父節點
當前提交
542743fd97
共有 2 個檔案被更改,包括 19 行新增14 行删除
  1. +17
    -14
      xurses.c
  2. +2
    -0
      xurses.h

+ 17
- 14
xurses.c 查看文件

@@ -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,24 +232,19 @@ 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;
} else if (string [offset] == '\t') {
* x += curses_tab_width;
} else {
curses_render_character (string [offset], colour, effect, * x, * y);
* x += 1;
}
if (string [offset] == '\n') {
* x = curses_realign_x;
* y += 1;
} else if (string [offset] == '\t') {
* x += curses_tab_width;
} else {
curses_render_character ('+', COLOUR_GREY, EFFECT_BOLD, * x, * y);
return;
curses_render_character (string [offset], colour, effect, * x, * y);
* x += 1;
}
}
}

void curses_render_number_point (int number, int limit, int colour, int effect, int * x, int * y) {
void curses_render_number_point (int number, int limit, int colour, int effect, int * x, int * y) {
(void) number;
(void) limit;
(void) colour;


+ 2
- 0
xurses.h 查看文件

@@ -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);



Loading…
取消
儲存