diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-28 16:38:35 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-28 16:38:35 +0000 |
| commit | 2d776fcd61be168e1ff0ff2e4a5e71835e7cea19 (patch) | |
| tree | 7cf274897bf540d5332d446f583ffd066e4e2e1d /src/term.c | |
| parent | b877ae23ac5d380ab3aa48d7724045cf4883b186 (diff) | |
- prekopanie adresarovej struktury, prva cast
git-svn-id: http://opensvn.csie.org/tuxanci_ng@77 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/term.c b/src/term.c deleted file mode 100644 index 62dcd8f..0000000 --- a/src/term.c +++ /dev/null @@ -1,105 +0,0 @@ - -#include <stdlib.h> -#include <assert.h> - -#include "main.h" -#include "list.h" -#include "interface.h" -#include "font.h" -#include "term.h" -#include "myTimer.h" - -typedef struct struct_term_t -{ - char *text; - my_time_t delTime; -} term_t; - -static list_t *listText; - -static term_t* newTermItem(char *s) -{ - term_t *new; - char *line; - int len; - - assert( s != NULL ); - - line = strdup(s); - len = strlen(line); - line[len-1] = '\0'; - - new = malloc( sizeof(term_t) ); - memset(new, 0, sizeof(term_t)); - - new->text = line; - new->delTime = getMyTime() + TERM_DEL_TEXT_TIMEOUT; - - return new; -} - -static void destroyTermItem(term_t *p) -{ - assert( p != NULL ); - - free(p->text); - free(p); -} - -void initTerm() -{ - listText = newList(); -} - -void drawTerm() -{ - int i; - - for( i = 0 ; i < listText->count ; i++ ) - { - char *line; - - line = (char *)( (term_t *)listText->list[i] )->text; - drawFont(line, 10, 10 + i*20, COLOR_WHITE); - } -} - -void eventTerm() -{ - my_time_t currentTime; - int i; - - currentTime = getMyTime(); - - - for( i = 0 ; i < listText->count ; i++ ) - { - my_time_t thisTime; - - thisTime = ( (term_t *)listText->list[i] )->delTime; - - if( currentTime > thisTime ) - { - delListItem(listText, i, destroyTermItem); - i--; - } - } - -} - -void appendTextInTerm(char *s) -{ - - addList(listText, newTermItem(s) ); - - if( listText->count > TERM_MAX_LINES ) - { - delListItem(listText, 0, destroyTermItem); - } -} - -void quitTerm() -{ - assert( listText != NULL ); - destroyListItem(listText, destroyTermItem); -} |