Kaynağa Gözat

Fix the text input example now that the box drawing functions take a size

as argument.
tags/v0.99.beta17
Sam Hocevar sam 16 yıl önce
ebeveyn
işleme
143b3c925b
1 değiştirilmiş dosya ile 4 ekleme ve 3 silme
  1. +4
    -3
      examples/input.c

+ 4
- 3
examples/input.c Dosyayı Görüntüle

@@ -59,6 +59,7 @@ int main(int argc, char *argv[])
entries[i].buffer[0] = 0; entries[i].buffer[0] = 0;
entries[i].size = 0; entries[i].size = 0;
entries[i].cursor = 0; entries[i].cursor = 0;
caca_printf(cv, 3, 3 * i + 4, "[entry %i]", i + 1);
} }


while(running) while(running)
@@ -70,20 +71,20 @@ int main(int argc, char *argv[])
unsigned int j, start, size; unsigned int j, start, size;


caca_set_color_ansi(cv, CACA_BLACK, CACA_LIGHTGRAY); caca_set_color_ansi(cv, CACA_BLACK, CACA_LIGHTGRAY);
caca_fill_box(cv, 2, 3 * i + 4, 2 + BUFFER_SIZE, 3 * i + 4, ' '); caca_fill_box(cv, 2, 3 * i + 5, BUFFER_SIZE + 1, 1, ' ');


start = 0; start = 0;
size = entries[i].size; size = entries[i].size;


for(j = 0; j < size; j++) for(j = 0; j < size; j++)
{ {
caca_put_char(cv, 2 + j, 3 * i + 4, caca_put_char(cv, 2 + j, 3 * i + 5,
entries[i].buffer[start + j]); entries[i].buffer[start + j]);
} }
} }


/* Put the cursor on the active textentry */ /* Put the cursor on the active textentry */
caca_gotoxy(cv, 2 + entries[e].cursor, 3 * e + 4); caca_gotoxy(cv, 2 + entries[e].cursor, 3 * e + 5);


caca_refresh_display(dp); caca_refresh_display(dp);




||||||
x
 
000:0
Yükleniyor…
İptal
Kaydet