11 #include "interface.h"
15 static list_t
*listText
;
16 static bool_t activeTerm
;
17 static my_time_t lastActive
;
18 static my_time_t lastRefresh
;
22 listText
= list_new();
25 lastActive
= timer_get_current_time();
26 lastRefresh
= lastActive
;
29 static char *getStrGun(int gun
)
35 return "dual revolver";
53 static char *getStrBonus(int bonus
)
72 return "bonus_unknown";
75 static void action_refreshTerm(space_t
*space
, tux_t
*tux
, void *p
)
85 tux
->name
, tux
->score
,
86 getStrGun(tux
->gun
), tux
->shot
[tux
->gun
], getStrBonus(tux
->bonus
)
89 list_add(listText
, strdup(str
));
92 static void refreshTerm()
96 arena
= arena_get_current();
98 list_destroy_item(listText
, free
);
99 listText
= list_new();
101 space_action(arena
->spaceTux
, action_refreshTerm
, NULL
);
103 /*printf("refresh term..\n");*/
110 if (activeTerm
== FALSE
) {
114 for (i
= 0; i
< listText
->count
; i
++) {
117 line
= (char *) listText
->list
[i
];
118 font_draw(line
, 10, 10 + i
* 20, COLOR_WHITE
);
122 static void switchTerm()
124 if (activeTerm
== TRUE
) {
133 my_time_t currentTime
;
136 mapa
= SDL_GetKeyState(NULL
);
138 currentTime
= timer_get_current_time();
140 if (currentTime
- lastRefresh
> TERM_REFRESH_TIME_INTERVAL
) {
141 lastRefresh
= currentTime
;
145 if (mapa
[SDLK_TAB
] == SDL_PRESSED
) {
146 if (currentTime
- lastActive
> TERM_ACTIVE_TIME_INTERVAL
) {
147 lastActive
= currentTime
;
155 assert(listText
!= NULL
);
156 list_destroy_item(listText
, free
);