about summary refs log tree commit diff
path: root/cards.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-03-28 18:53:21 -0400
committerJune McEnroe <june@causal.agency>2019-03-28 18:53:21 -0400
commitc5b75b347ecaca4f62280e04508d6362cd8fa093 (patch)
tree761dcf00b6c94120c9daa139e177cc12df55d7f6 /cards.h
parentRefactor EXE/DLL loading to be more general (diff)
downloadcards-c5b75b347ecaca4f62280e04508d6362cd8fa093.tar.gz
cards-c5b75b347ecaca4f62280e04508d6362cd8fa093.zip
Simplify (sort of) Cards API and add FreeCell loading
Diffstat (limited to 'cards.h')
-rw-r--r--cards.h42
1 files changed, 27 insertions, 15 deletions
diff --git a/cards.h b/cards.h
index 8cd99c4..845b97b 100644
--- a/cards.h
+++ b/cards.h
@@ -19,19 +19,22 @@
 
 #include <SDL_rwops.h>
 #include <SDL_surface.h>
+#include <stddef.h>
 
 enum {
-	Cards_Width = 71,
-	Cards_Height = 96,
+	Cards_CardWidth = 71,
+	Cards_CardHeight = 96,
+	Cards_KingWidth = 32,
+	Cards_KingHeight = 32,
 };
 
-enum {
+enum Cards_Card {
 	Cards_Club,
 	Cards_Diamond = 13,
 	Cards_Heart = 26,
 	Cards_Spade = 39,
 
-	// Add rank to suit to obtain card face index.
+	// Add rank to suit to obtain card index.
 	Cards_A = 1,
 	Cards_2, Cards_3, Cards_4, Cards_5, Cards_6, Cards_7, Cards_8, Cards_9,
 	Cards_10, Cards_J, Cards_Q, Cards_K,
@@ -44,25 +47,34 @@ enum {
 	Cards_X = 67,
 	Cards_O,
 
-	Cards_Count,
+	Cards_CardCount,
 };
 
-// Some pointers will be NULL since there are gaps in the indices.
-struct Cards {
-	SDL_Surface *surfaces[Cards_Count];
+enum Cards_FreeCell {
+	Cards_KingRight = 1,
+	Cards_KingLeft,
+	Cards_KingWin,
+	Cards_FreeCellCount,
 };
 
-enum Cards_Flags {
-	// Set color key for Cards_Empty, Cards_X, Cards_O.
+enum Cards_Flag {
 	Cards_ColorKey = 1 << 0,
-	// Set alpha in card corners.
 	Cards_AlphaCorners = 1 << 1,
-	// Set red card borders to black.
 	Cards_BlackBorders = 1 << 2,
 };
 
-struct Cards *Cards_Load(SDL_RWops *rw, enum Cards_Flags flags);
-int Cards_Invert(struct Cards *cards);
-void Cards_Free(struct Cards *cards);
+int
+Cards_LoadCards(
+	SDL_Surface **surfaces, size_t count,
+	SDL_RWops *rw, enum Cards_Flag flags
+);
+
+int
+Cards_LoadFreeCell(
+	SDL_Surface **surfaces, size_t count,
+	SDL_RWops *rw, enum Cards_Flag flags
+);
+
+int Cards_InvertSurface(SDL_Surface *surface);
 
 #endif