From: johnsd2@lib104.its.rpi.edu (Daniel Norman Johnson)
Subject: Re: NON-QUICKDRAW GAMES
Reply-To: johnsd2@rpi.edu
Organization: Rensselaer Polytechnic Institute, Troy, NY.
Date: Tue, 8 Sep 1992 23:38:45 GMT

In article <18ja83INNk53@agate.berkeley.edu>, deadman@garnet.berkeley.edu (Ben Haller) writes:
|> In article <MHALL.92Sep6135523@occs.cs.oberlin.edu>
|>   mhall@occs.cs.oberlin.edu (Matthew Hall) writes:
|> >you have to deal with palettes.  First of all, how do you assign a
|> >palette or color table to the screen.  You could just change the
|> >GDevices pmtable, but would that change the devices actual CLUT?  And
|> >if you set the colors by means of a palette, how do you get the
|> >correct indicies to write?  Conceivably, many machines might not be
|> >running the system software to support pmTolerant+pmExplicit, right?
|> >The drawing to screen stuff I can implement - but if someone could
|> >answer how to draw in an indexed color environment, I would really
|> >appreciate it.
|> 
|>   As several people have already indicated, the two basic methods
|> are either using the Palette Wrecker (oh, did I say wrecker?  I meant
|> manager) or using SetEntries.  The thing I want to address is this,
|> in my mind unwarranted, bias towards the Palette Wrecker (there, I
|> mistyped it again!)

Dang.. ya gotta watch them typos, ya know :)

|>   If you use it, in the best of all possible worlds, when your application
|> get context-switched in your palette will be swapped back in, using the
|> best possible slots in the CLUT taking into consideration the colors
|> everybody else is using, etc. etc.  This is hogwash - it never happens.

Granted. The Palette Manager does not care about which slots it
uses. I don't see why you do.. is there some benefit to particular
slots that I am not aware of? Id think that CLUT slot is pretty
much like annother, unless u r XORing things... Of course, u could use
pmExplicit colors to get specific indicies.

|> In my experience using the palette manager means the screen does CLUT
|> flashes that are even more distracting than they would usually be (i.e.
|> it will often flash *several times*),

I have never seen this myself. Can you give an example?
[ie how can I make it happen?]

Also, I presume the technique you propound somehow gets the screen
to redraw, with the new colors. Otherwise, you'd wind up with the
usual my-background-is-in-briliant-yellow-and-turquoise-and-my-finder-
icons-are-indecyperable syndrome. This bothers me much more than the
"flash" the palette manager produces. And things only get weirder, since
thigns that are redraw/exposed get draw right, but everything else
is still mauve or something. yeck. :)

|> you end up with a pretty crappy CLUT
|> that in no way avoids frequently-used colors, and the other applications
|> in the system are often permanantly fucked up and don't redraw correctly
|> from then on.

Can you give examples of when this happens too? It does not
happen to the programs I have written that use palettes. Also,
why dont they have the same prob with direct-clut-changes?

|>  It just isn't worth it, folks.  Nobody else uses the Palette
|> Wrecker, and so all of the much-touted benefits simply aren't there (lack
|> of entry conflicts with other apps, etc.)

Well, the-no-entry-conflicts thing works for apps that dont use ANY
clut or palette mucking.. they are forced to redraw, and do so with
the new colors. This is of course only in my experience, u have
already said yours differs. It also works for other programs
that use the palette manager, and it does no harm for those that
don't, right?

|>  And it has a lot of drawbacks,
|> not the least being that's it's slow,

granted.

|> it increases your code size,

how does it do this? U can have a palette in a pltt resources
and not add ANY code, if u r using GetNewCWindow. You
can grab palettes from resources with very little
code. Even if you are assembling one on-the-fly, it doesn't seem
to me like it takes nearly as much code to allocate, fill in,
assign and activate a palette as it would to write code to make
clut-manipulation work on multiple monitors,  on direct devices,
on b&w machines, etc

By the way, Im talking about the more general case of
drawing-w/-quickdraw-in-a-window, not just the direct screen drawing
stuff and the take-over-teh-screen stuff, since you appear to be saying
"never use teh Palette Wrecker, ever ever ever". I can see (now) why you
would not want to do this if you are not using windows, quickdraw, etc.
It would be most pointless, but slow anyway. :)

|> it
|> looks worse, and it's (in my opinion) meither as aesthetically pleasing
|> nor as compatable as just saving & setting the CLUT (or part of the CLUT)
|> on resume events and restoring the parts you changed on suspend events.

Why do you say this? The palette manager should be able to completely
change the clut to anything u want, 'cept u have to have black and white
in the clut. Is that such a big difference?

Anyway, if u r gonna save and restore the clut, how do u force all other
apps and such to redraw [in teh case where u r not taking over the
whole screen], and of course also force teh desktop to redraw?

Also, why is the Palette Manager less compatible than CLUT stuff?

|>   Also, if you're using direct-to-screen as almost everyone does - in a
|> pixel-oriented paint program or in a video game - then you'll want the
|> whole CLUT to yourself, in which case the Palette Wrecker (even if it
|> worked) provides no benefits and all the drawbacks.

Well, the Palette Manager takes care of multiple-monitor setups for you,
and direct devices. I thot u'd have to special-case for that if
u r using SetEntries. This doesn't matter if you are taking over the
screen, but that drawing program ought to run in a window.

|>   Get real.

C'mon... I wanna get fake! :(

|>  Just because Apple says to use the Palette Wrecker doesn't
|> mean you have to.  There is nothing wrong with SetEntries - at least
|> nothing that the Wrecker fixes.  So why bother.

Well, the Palette Manager takes care of a bunch of details for you,
which I have mentioned, and lets you share palette entries with other
apps if you like (although this doens't work very well, in my option.
Its that annoying restriction on the values tolerances can take.. you
cant have small, non-zero tolerances. bleah) It also (in my experience,
perhaps yours differs again) can allocate "unused" palette entries- IF
other apps are using the palette manager. If they aren't, no harm (that
I know of) done.

|>   OK, I'm ready for the flames... :->

I tried to be reasonable, and not flame. Mostly because
I have the feeling that Im way, way out of my depth
arguing with you. But what the hey. Now pardon me why
I go dig up my asbestos underwear. I have a feeling
my ignorance is about to be rudely exposed. :)

|> -Ben Haller (deadman@garnet.berkeley.edu)

-- 
			- Dan Johnson
And God said "Jeeze, this is dull"... and it *WAS* dull. Genesis 0:0

These opinions have had all identifiying marks removed, and are untraceable.
You'll never know whose they are.