summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCards
AgeCommit message (Collapse)Author
2022-03-18LibCards+Games: Change name of card type to card suitLenny Maiorani
Playing cards have a `suit` such as `hearts`/`diamonds`, not a `type`. Make the internal naming consistent with the way playing cards are typically named.
2022-03-18Libraries: Change enums to enum classes in LibCardsLenny Maiorani
2022-03-10Libraries: Use default constructors/destructors in LibCardsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-03-04Libraries: Make CharacterBitmap instances at compile-timeLenny Maiorani
`CharacterBitmap` instances are generated at run-time and put on the heap, but they can be created in a `constexpr` context and stored in static memory. Also, remove additional `width` and `height` `static` values in favor of using the `constexpr` member functions of `CharacterBitmap`. These changes also include the removal of some initialization code which tests if the `CharacterBitmap` is created since it is always created and removes function-local `static` values which cause run-time branches to ensure it is initialized each time the function is called.
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create()Andreas Kling
Another one that was used in a fajillion places.
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()Andreas Kling
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::clone()Andreas Kling
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-06-24LibCards: Support non-alternating colour patience gamesJamie Mansfield
This introduces a new MovementType concept to LibCards, starting the process to allow other patience games to be implemented using it - that differ more substantially from Klondike in logic. This is currently used for two purposes: 1. to verify that the 'grabbed' stack of cards is valid* (sequential and correct colours) and 2. to allow 'grabbed' stacks to be pushed onto same-colour, either-colour, or alternating-colour stacks * Klondike doesn't need this logic, as per how the game works any 'grabbed' selection is guaranteed to be valid.
2021-06-04LibCards: Draw card stack background when the entire stack is movingTimothy Flynn
The stack background should be painted when the entire stack is being dragged, rather than just the top card. Fixes #7786. Regressed in 2b762ef94075b8a6e1ae8dd61e535b6b6cf7c064.
2021-06-04Solitaire+LibCards: Draw card stacks with rounded cornersTimothy Flynn
Now that the cards have rounded corners, draw the stack box behind the cards with rounded corners as well. This way, the corner of the stack box doesn't peek out from behind the cards. The caveat here is that the "play" card stack now needs to hold a reference to the "waste" stack beneath it so it knows when not to draw its background on top of the waste stack. To faciliate that, the array of card stacks is now a NonnullRefPtrVector so the play stack can store a smart pointer to the waste stack (instead of a raw pointer or reference).
2021-06-04LibCards: Don't draw the first card smaller than the othersGunnar Beutner
2021-06-03LibCards: Draw cards with rounded card cornersDavid Isaksson
closes #7412
2021-05-26Hearts: Highlight cards when an invalid play is attemptedGunnar Beutner
This briefly inverts the selected card when the user attempts to make an invalid play.
2021-05-22LibCards: Fix alignment for the card labelsGunnar Beutner
Previously the code didn't take into account that the label for the "10" card is larger than for the other cards.
2021-05-22LibCards: Correct a spelling mistakeGunnar Beutner
2021-05-21Games: Add HeartsGunnar Beutner
2021-05-21Solitaire: Move cards functionality into LibCardsGunnar Beutner