[comp.sys.mac.programmer] MPW MacApp view question

TAB113@psuvm.psu.edu (09/24/90)

  I'm writing a game in which the game board is comprised to hexogonal tiles.
Each tile will be an object, TTIle, which is a subclass of TPicture.  My
problem is in putting these tiles together.  Because the tiles are 6 sided,
flat sides on bottom and top, there are 4 triangles of white "dead space".
Thus, when one tile is layed down and to the right of the first tile, the
second tile's "dead space" covers the first tile!

  Does anyone have any ideas on how to place these irregular shaped PICT's
down without them interfering with each other.  Thanks.

Michael Bitonti
Penn State University

niko@du248-16.cc.iastate.edu (Schuessler Nikolaus E) (09/24/90)

In article <90266.145525TAB113@psuvm.psu.edu> TAB113@psuvm.psu.edu writes:
>
>  I'm writing a game in which the game board is comprised to hexogonal tiles.
>Each tile will be an object, TTIle, which is a subclass of TPicture.  My
>problem is in putting these tiles together.  Because the tiles are 6 sided,
>flat sides on bottom and top, there are 4 triangles of white "dead space".
>Thus, when one tile is layed down and to the right of the first tile, the
>second tile's "dead space" covers the first tile!
>
>  Does anyone have any ideas on how to place these irregular shaped PICT's
>down without them interfering with each other.  Thanks.
>
>Michael Bitonti
>Penn State University

I haven't figured out the TCL stuff yet, but I think I can partly answer
your question.  You want to change the drawing mode to something like
XOR (exclusive or) or just plain OR. I think the quickdraw default is
COPY or something that clobbers whatever's underneath.  With XOR, you just
need to draw it again (either piece) and it will 'erase' itsself leaving the
other intact.
--
------------------------------------------------------------------------------
Niko Schuessler               "On a two semester mission to engineer where
niko@iastate.edu               no-one has engineered before.... :-) "
------------------------------------------------------------------------------

francis@arthur.uchicago.edu (Francis Stracke) (09/27/90)

In article <90266.145525TAB113@psuvm.psu.edu> <TAB113@psuvm.psu.edu> writes:
>  I'm writing a game in which the game board is comprised to hexogonal tiles.
>Each tile will be an object, TTIle, which is a subclass of TPicture.  My
>problem is in putting these tiles together.  Because the tiles are 6 sided,
>flat sides on bottom and top, there are 4 triangles of white "dead space".
>Thus, when one tile is layed down and to the right of the first tile, the
>second tile's "dead space" covers the first tile!
>
>  Does anyone have any ideas on how to place these irregular shaped PICT's
>down without them interfering with each other.  Thanks.

Two ways:
(1) Don't use the PICTs directly; copy them to an offscreen bitmap when you
initialize, then copyMask from there to the screen, to clip drawing to the
hexagonal region.  This is fast, but memory-intensive if you have many
different tiles.

(2) Set the clipRgn of the window to be just the hexagon of the tile you
want to draw.  You can define a hexagonal region at initialization, then
use OffsetRgn to put it where you want it.

francis@arthur.uchicago.edu (Francis Stracke) (09/27/90)

Sorry: you don't need CopyMask; just use CopyBits, and set the MaskRgn
appropriately.