Tuxánci 2
Successor to Tuxánci
 
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1/*
2 * Tuxánci 2 - Successor to Tuxánci
3 * Copyright (C) 2026 Connor Thomson
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
23
24#ifndef LIST_H
25#define LIST_H
26
27#include "raylib.h"
28#include <stdbool.h>
29
30#define LIST_MAX_ITEMS 64
31#define LIST_ITEM_HEIGHT 30
32
33typedef struct List {
34 Rectangle rect;
35 char items[LIST_MAX_ITEMS][128];
39 Color baseColor;
41 Color hoverColor;
43} List;
44
45List listCreate(int x, int y, int w, int h);
46void listDraw(List* l);
47bool listCheck(List* l);
48bool listAdd(List* l, const char* name);
49bool listRemove(List* l, const char* name);
50
51#endif // LIST_H
bool listRemove(List *l, const char *name)
Removes an item from a List.
Definition list.c:146
bool listAdd(List *l, const char *name)
Adds an item to a List.
Definition list.c:129
void listDraw(List *l)
Draws a List.
Definition list.c:63
bool listCheck(List *l)
Checks if an item in the List was clicked.
Definition list.c:95
List listCreate(int x, int y, int w, int h)
Creates a new List.
Definition list.c:42
#define LIST_MAX_ITEMS
Maximum number of items in a List.
Definition list.h:30
Definition list.h:33
int itemCount
Number of items currently in the list.
Definition list.h:36
char items[LIST_MAX_ITEMS][128]
Item name strings.
Definition list.h:35
int selectedIndex
Index of the selected item (-1 if none)
Definition list.h:37
Color selectedColor
Color of the selected item.
Definition list.h:40
int hoveredIndex
Index of the currently hovered item (-1 if none)
Definition list.h:42
Color hoverColor
Color of a hovered item.
Definition list.h:41
Rectangle rect
List bounds.
Definition list.h:34
int fontSize
Font size for item text.
Definition list.h:38
Color baseColor
Background color.
Definition list.h:39