diff options
Diffstat (limited to 'src/puzzles/collection.c')
| -rw-r--r-- | src/puzzles/collection.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/puzzles/collection.c b/src/puzzles/collection.c index a88bae4..5a46239 100644 --- a/src/puzzles/collection.c +++ b/src/puzzles/collection.c @@ -8,10 +8,10 @@ #include <stdlib.h> #include <sys/stat.h> #include "../utils/arena.h" +#include "../resources/TextruesAtlas.h" #include <string.h> static const char *IMAGE_NAME = "icon.png"; -static const float NAME_IN_CARD_RATIO = 0.2f; int compare_elements(const void *a, const void *b) { const CollectionElement *elA = (const CollectionElement *)a; @@ -175,26 +175,32 @@ void DrawCollectionElement(CollectionElement *el, CollectionElement *parent, Rec if (el == NULL || parent == NULL) return; el->_previousFramePosition = rec; DrawRecBordered(rec, COLORSCHEME_WHITE, COLORSCHEME_ORANGE, BORDER); + float texture_side_len = rec.width - BORDER * 2; + Rectangle texture_rec = { + .x = rec.x + BORDER, + .y = rec.y - BORDER + (rec.height - texture_side_len), + .width = texture_side_len, + .height = texture_side_len, + }; + if (el->type == COLLECTION_ELEMENT_PUZZLE && parent->hasIcon) { - Rectangle texture_rec = { - .x = rec.x + BORDER, - .y = rec.y + BORDER + rec.height * NAME_IN_CARD_RATIO, - .width = rec.width - BORDER * 2, - .height = rec.height * (1 - NAME_IN_CARD_RATIO) - BORDER * 2, - }; DrawTexturePro(parent->icon, (Rectangle) { .x = 0, .y = 0, .width = parent->icon.width, .height = parent->icon.height, }, texture_rec, (Vector2) { .x = 0, .y = 0 }, 0, WHITE); - } + } else if(el->type == COLLECTION_ELEMENT_COLLECTION) { + DrawTexturePro(*GetButtonsAtlas(), + FOLDER_LOGO_LOCATION, texture_rec, (Vector2) { .x = 0, .y = 0 }, 0, WHITE); + } + int scroll = 0; DrawTextInRec((Rectangle) { .x = rec.x + BORDER, .y = rec.y + BORDER, .width = rec.width - BORDER * 2, - .height = rec.height * NAME_IN_CARD_RATIO - BORDER * 2, + .height = rec.height - texture_side_len, }, el->name, GetMainFont(), 20, COLORSCHEME_BROWN, 1, &scroll); } |
