I've been working on something like a card game and have encountered a few
things regarding wx*DCs (wxMemoryDC, wxPainDC, etc). I've used the demo as
much as possible and gotten a LOT of stuff to work, but other issues keep
giving me fits.
I have a 'table' on which the cards are placed. They are always place in the
same spaces, and I have used wxGridSizer to set this up.
This is basically a wxPanel with a wxGridSizer, within that are several
wxStaticBitmap objects. The wxBitmap objects have a few extra methods for
things like showing a card number, etc, but otherwise that's the gist of
what I have.
Here are the tasks that I can't seem to get straight:
(1) I want to use a bitmap to tile the background. I had *thought* that what
I needed to do was wxWindowDC or wxClientDC to grab the table's wxPanel then
tile the bitmaps over it (an example on how to do that is provided in the
demo). Unfortunately, the best I ever managed was to totally blank out the
whole thing. Alas. What would be generally the best approach here?
(2) I would *like* to animate the dealing of the cards from the deck to the
various places on the table. I tried a variety of different things that
didn't quite work, but then tried using wxDrageImage for the purpose. It
shows promise, but when the cards go 'flying' across the 'table' they go
*UNDER* the wxStaticBitmaps on the table. It almost seems as if I need to
derive some 'layer' 'above' the whole thing, but I haven't figured that part
out yet. Suggestions?
(3) I would like to animate the flipping of cards from face down to face up.
I *think* I have this one, so this is more thinking out loud than anything.
Since both the backs and the fronts are variable, I can't just load up an
animated GIF. So what I propose is to progressively decrease the height
attribute of the bitmap and blit it using a wxMemoryDC sequence. Then swap
out the bitmap file, then return the height attribute to full height in
reverse order. My main concern is that often I have seen 'black' below
'transparent' portions of bitmaps before (such as filling a MemoryDC with a
rounded rectangle).
Anyone know of a really killer tutorial on using the various wx*DC classes?
// Jeff Grimmett
// http://www.livejournal.com/users/grimmtooth/
`--------------------------------------------'