[plt-scheme] cards.ss: how to rotate cards ninety degrees

From: Eric Hanchrow (offby1 at blarg.net)
Date: Sun May 11 16:01:38 EDT 2003

        (Apologies if this shows up twice; I originally attempted to
        post via gmane, but didn't see the article show up after a few
        days, so I am reposting)

I'm playing with the games/cards collection, and want to do something
that (I don't think) it can do as it stands: I want to draw a card
rotated, that is, with the long side running left-right, instead of
up-down as it currently works.

The ideal would be if I could do this using just the methods and
fields that cards.ss provides, but I suspect that's not possible.

Next best would be if I could do it by subclassing something or other.
I don't really know if that's possible.  (Note that my grasps of both
object-oriented programming and graphics programming are ... shall we
say ... tenuous.)

The worst alternative would be to hack the exisiting classes to
provide that feature.  This would be acceptable if I submitted the
hack as a patch, and the PLT folks accepted it.  But if they didn't,
then every time I update my version of DrScheme, in order to draw
cards the way I want, I'd have to reapply my patch to the source.
Yuck!

Anyway, I think I can precisely describe what I want: a new "table"
method like this:

> horizontal :: (send t horizontal) - returns #t if card is horizontal.
> horizontal :: (send t horizontal horizontal?) - turns card
                horizontally if horizontally? is true, vertical
                otherwise.

Can anyone point me in the right direction?  Thanks.
-- 
Always code as if the guy who ends up maintaining your code will
be a violent psychopath who knows where you live.  John F. Woods


Posted on the users mailing list.