summaryrefslogtreecommitdiff
path: root/blits.c
diff options
context:
space:
mode:
Diffstat (limited to 'blits.c')
-rw-r--r--blits.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/blits.c b/blits.c
index 318e72f..2eb49d4 100644
--- a/blits.c
+++ b/blits.c
@@ -152,6 +152,46 @@ void Fchangercurseurpersos (SURFACES *surfaces, POSITIONS *positions, struct cha
TTF_CloseFont(police);
}
+void update_list_entries(SURFACES *surfaces, POSITIONS *positions, const struct entry_t *entries, int cnt, int selected)
+{
+ SDL_Color color = {0, 0, 0, 0};
+ TTF_Font *font;
+ SDL_Surface *surf;
+ int off;
+
+ if (selected == -1) {
+ SDL_BlitSurface(surfaces->Pfondjeu, &positions->Vpositioncadreactions, surfaces->Pecran, &positions->Vpositioncadreactions);
+ SDL_Flip(surfaces->Pecran);
+ return;
+ }
+
+ SDL_BlitSurface(surfaces->Pcadreactions, NULL, surfaces->Pecran, &positions->Vpositioncadreactions);
+
+ font = TTF_OpenFont("TIMESBI.TTF", 20);
+ off = selected / 3 * 3;
+ /* display at most three actions */
+ for (int i = 0; i < 3; ++i) {
+ if (off + i >= cnt) {
+ SDL_BlitSurface(surfaces->Pactiondesactivee, NULL, surfaces->Pecran, &positions->Vpositionactionselectionnee[i]);
+ continue;
+ }
+
+ /* if the current entry is the selected one */
+ if (selected == off + i) {
+ SDL_BlitSurface(surfaces->Pactionselectionnee, NULL, surfaces->Pecran, &positions->Vpositionactionselectionnee[i]);
+ }
+
+ surf = TTF_RenderText_Blended(font, entries[off + i].name, color);
+
+ SDL_BlitSurface(surf, NULL, surfaces->Pecran, &positions->Vpositionnomactions[i]);
+
+ SDL_FreeSurface(surf);
+ }
+
+ TTF_CloseFont(font);
+ SDL_Flip(surfaces->Pecran);
+}
+
void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int selection,int page,int nbactions,int type)
{
int i;