• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 98
  • Last Modified:

c# graphics for a card game

Hello Experts!!!

How do you get individual cards out of an image where they are all together (see attached pic)...  Is this the standard way of generating cards, is there a better way?  (Like having individual graphics in a resource file)

I'd like to know the how, the why and the best practices;  References are awesome, experience is awesome (er), lol

Thank you in advance,

1 Solution
käµfm³d 👽Commented:
I can't speak to best practices since I don't do game or graphics programming, but in its simplest form you simply need to load the sprite into memory, and then read a block of pixels from the original image. You should already know how large each card is--I would assume them all to be the same size. You should also know how many are in a row, and how many rows you have. Therefore, it's a simple matter of math to grab any particular card from the original image. The hardest part might be recreating the header information...but I would think you'd only have to do that once--every card could reuse that same header info.

We would need to know what kind of project this is, though. The process for implementing this would be slightly different for Windows Forms, WPF, and ASP.NET.
the_b1ackfoxCIOAuthor Commented:
It isn't for a project...  Well, not yet.  I am asking so I can understand the process, I may apply this with a simple card game down the line.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now