Hello list.
Okay, here's the situation: I'm writing a 2D game with pixel collision in Java. My current design has a graphics front-end, and a "physics frame" which is a non-displaying buffer the same size as the graphics region. Each character that the user sees is mapped to a "shadow" in the physics frame -- a two-bit representation of the character for the purposes of collision detection. (The two bits signify different parts of the character -- some pixels are 'collision' pixels, some are 'attack' pixels, and some are both).
Each frame, the physics system walks through the characters and renders each one onto the physics frame, checking for collisions. Every object rendered in this way should be able to collide with every other object, and identify both objects in any collision. I won't ever need to have more than 16 separately colliding objects at any one time.
I believe the way I want to do this is to render the physics frame in a 32-bit-depth graphics buffer object of some sort, allocate two different bits for each object, and keep a record of which bits correspond to which object so that when a collision occurs, I can "look back" and find out what object set that bit. Each iteration of the loop would involve shifting the two-bit bitmap to the next free slot, then transferring it using XOR onto the physics frame. To check for collisions, I can then do a pixel-by-pixel comparison of the region on the frame to the shifted bitmap in memory -- anywhere that the bits don't match, XOR them to find out what's different, and look up those bits in the record to find out the object I collided with.
Phew.
Now, what I want to know, is how you would go about doing this in Java, using fast BitBlt routines. I have been digging through awt's Graphics2D and GraphicsConfiguration, swing's ImageIcon, etc., but there's just a sheer number of classes that I cannot wrap my mind around what I need and what I can ignore.
So if someone could help me out -- how do I create a region that I can do some low-level, fast blt'ing to? Or, if you have a better idea on how I should implement my physics that takes better advantage of Java, some ideas about that would be good too.
Thank you,
Lincoln Quirk
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".