about summary refs log tree commit diff
CARDS(3) Library Functions Manual CARDS(3)

Cards_LoadCards, Cards_LoadFreeCell, Cards_InvertSurfacebitmap resource loader

#include <cards.h>

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);

() and Cards_LoadFreeCell() load bitmap resources into an array of count surfaces. Resources can be loaded from 16-bit NE executables or from 32-bit PE executables.

() loads card bitmaps from a CARDS.DLL or Windows 3.0 SOL.EXE file rw.

Indices of loaded surfaces are defined by the following:

Suit
, Cards_Diamond, Cards_Heart, Cards_Spade.
Rank
, Cards_2, Cards_3, Cards_4, Cards_5, Cards_6, Cards_7, Cards_8, Cards_9, Cards_10, Cards_J, Cards_Q, Cards_K.
Back
, Cards_Back2, Cards_Back3, Cards_Back4, Cards_Back5, Cards_Back6, Cards_Back7, Cards_Back8, Cards_Back9, Cards_Back10, Cards_Back11, Cards_Back12.
Other
, Cards_X, Cards_O.

Where suit and rank constants are added together to form an index. Note that there are gaps in the indices and some surface pointers will be set to NULL. The maximum number of surfaces is defined by Cards_CardCount.

The dimensions of the loaded surfaces are defined by Cards_CardWidth and Cards_CardHeight.

() accepts the following flags:

Use color key transparency for the Cards_Empty, Cards_X and Cards_O surfaces.
Make the rounded card corners transparent.
Make all card borders black.

() loads bitmaps from a FREECELL.EXE file rw.

Indices of loaded surfaces are defined by Cards_KingRight, Cards_KingLeft and Cards_KingWin. Note that there are gaps in the indices and some surface pointers will be set to NULL. The maximum number of surfaces is defined by Cards_FreeCellCount.

The dimensions of the loaded surfaces are defined by Cards_KingWidth and Cards_KingHeight.

() accepts the following flags:

Use color key transparency.

() inverts the colors of a surface loaded by Cards_LoadCards().

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned.

The cards.dll repository contains various versions of the files CARDS.DLL, FREECELL.EXE and SOL.EXE.

See example.c.

Error messages are set with SDL_SetError() and can be retrieved with SDL_GetError().

Cards_LoadCards() and Cards_LoadFreeCell() may fail for the following reasons: any SDL_RWops or SDL_Surface error; invalid MZ, NE or PE signatures; missing resource table; invalid resource hierarchy; missing resource.

Cards_InvertSurface() may fail for any SDL_Surface error or if the surface format is not supported.

June McEnroe <june@causal.agency>

August 22, 2019 OpenBSD 7.6
>June McEnroe The better of the two, but largely the same. I feel like these books are a bit too autobiographical, but I don't know if I'm allowed to accuse an author of that. My real problem is that I read these books as largely uncritical of their characters. They behave in nonsense ways, are mostly uncritical of their own behaviour, and don't really have arcs of growth or change. I suppose this book had a bit of one, but only in the last two chapters. 2022-07-30Add Normal PeopleJune McEnroe Unbearably straight. Eyerolls and sighs per page off the charts. Shout out to Joanna, I guess. I kinda like the lack of quotation marks though to be honest. After half of the Ruth Ozeki novel and now this, I need to get back to some genre fiction. 2022-07-26Rewrite glitch from new pngoJune McEnroe 2022-07-26Update Care with time-to-ID and piercingsJune McEnroe 2022-07-26Add -w to upJune McEnroe 2022-07-13Set push.autoSetupRemoteJune McEnroe 2022-07-08Remove TOURJune McEnroe There is not that much distinct stuff here anymore. 2022-07-03Add The Bone Shard EmperorJune McEnroe Suffers a little bit from middle book but I really enjoyed it. Read it faster than the first one too, despite its length. 2022-06-25Bump xterm font size to 12June McEnroe 2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe Mixed bag like most collections of short stories. Some of them are pretty good. The author of the worst written story also has the worst written bio. 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe Absolutely indiscriminately. 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe For some reason I haven't been able to figure out, trying to poll /dev/tty returns POLLNVAL (and this was using 100% CPU looping), but using stderr instead works fine. 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe