summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/puzzles/collection.c24
-rw-r--r--src/resources/TextruesAtlas.h8
2 files changed, 23 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);
}
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