CARDS.DLL loader for SDL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cards.h 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Copyright (C) 2019 C. McEnroe <june@causal.agency>
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU Affero General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef CARDS_H
  17. #define CARDS_H
  18. #include <SDL_rwops.h>
  19. #include <SDL_surface.h>
  20. #include <stddef.h>
  21. enum {
  22. Cards_CardWidth = 71,
  23. Cards_CardHeight = 96,
  24. Cards_KingWidth = 32,
  25. Cards_KingHeight = 32,
  26. };
  27. enum Cards_Card {
  28. Cards_Club,
  29. Cards_Diamond = 13,
  30. Cards_Heart = 26,
  31. Cards_Spade = 39,
  32. // Add rank to suit to obtain card index.
  33. Cards_A = 1,
  34. Cards_2, Cards_3, Cards_4, Cards_5, Cards_6, Cards_7, Cards_8, Cards_9,
  35. Cards_10, Cards_J, Cards_Q, Cards_K,
  36. Cards_Empty = 53,
  37. Cards_Back1, Cards_Back2, Cards_Back3, Cards_Back4,
  38. Cards_Back5, Cards_Back6, Cards_Back7, Cards_Back8,
  39. Cards_Back9, Cards_Back10, Cards_Back11, Cards_Back12,
  40. Cards_X = 67,
  41. Cards_O,
  42. Cards_CardCount,
  43. };
  44. enum Cards_FreeCell {
  45. Cards_KingRight = 1,
  46. Cards_KingLeft,
  47. Cards_KingWin,
  48. Cards_FreeCellCount,
  49. };
  50. enum Cards_Flag {
  51. Cards_ColorKey = 1 << 0,
  52. Cards_AlphaCorners = 1 << 1,
  53. Cards_BlackBorders = 1 << 2,
  54. };
  55. int
  56. Cards_LoadCards(
  57. SDL_Surface *surfaces[], size_t count,
  58. SDL_RWops *rw, enum Cards_Flag flags
  59. );
  60. int
  61. Cards_LoadFreeCell(
  62. SDL_Surface *surfaces[], size_t count,
  63. SDL_RWops *rw, enum Cards_Flag flags
  64. );
  65. int Cards_InvertSurface(SDL_Surface *surface);
  66. #endif