diff options
| author | physick <mynameisgennadiy@vk.com> | 2026-08-31 21:42:11 +0500 |
|---|---|---|
| committer | physick <mynameisgennadiy@vk.com> | 2026-08-31 21:42:11 +0500 |
| commit | e40581d3b3aa343e84fa9a9492d93597e8899c5b (patch) | |
| tree | 6b5f22d5682cb304fe0ef1d50aead0ddb49e6a00 | |
| parent | 470cbb49c87510bee621338d342a117c40578190 (diff) | |
default button icon
| -rwxr-xr-x | assets/textures/buttons_atlas.png | bin | 1960 -> 2184 bytes | |||
| -rw-r--r-- | src/puzzles/collection.c | 24 | ||||
| -rw-r--r-- | src/resources/TextruesAtlas.h | 8 |
3 files changed, 23 insertions, 9 deletions
diff --git a/assets/textures/buttons_atlas.png b/assets/textures/buttons_atlas.png Binary files differindex a50a500..8e45167 100755 --- a/assets/textures/buttons_atlas.png +++ b/assets/textures/buttons_atlas.png 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); } diff --git a/src/resources/TextruesAtlas.h b/src/resources/TextruesAtlas.h index a9202c2..9b55b86 100644 --- a/src/resources/TextruesAtlas.h +++ b/src/resources/TextruesAtlas.h @@ -64,4 +64,12 @@ static const Rectangle RIGHT_ARROW_ICON_LOCATION = { .height = 96, }; +static const Rectangle FOLDER_LOGO_LOCATION = { + .x = 64, + .y = 32, + .width = 96, + .height = 96, +}; + + #endif // TEXTURES_ATLAS_H |
