Boards within GameBoard

I have a game that has two portions which should logically use the same rendering logic, except the data is different for each and the location (translation) and perspective (mirror image) are different.

Should I use a image to render these to, and then blit to the main backscreen, using a transformation, or is there something more logical I should do to get them to draw directly to the backscreen?

J

No, rendering it to an image before rendering it to the main screen will probably be slow.
Instead, either set a translation on your graphics object, or create a copy of the graphics object and translate that one.
You can create a copy of the graphics object by using one of the following methods:
create()
create(int x, int y, int width, int height)

With the first one you have to manually set the translation, with the second one the translation and clipping area is set in the constructor.

The problem is I don’t see how to make that transformation. For instance if I want to draw component “as is” in the top half of screen, that’s fine but what’s the transformation so that drawing will be mirrored in the bottom half of screen? It seems like it mirror on the dimensions of the screen, not just the bottom half of the screen.

Draw it twice, using the same rendering logic with different data.

I think you indicate how with the width and height being specified so it should just rotate that area not against the whole screen. Ill give that a try anyway.

This is generally working, but I’m having trouble using Graphics properly it appears.

I create a top-level graphics object thusly:
Graphics t1 = g.create(3,25);

and then in a method later…
Graphics t2 = t1.create(0,0,800,600)

I think the problem comes when I create an AffineTransform with another translation and set that on the graphics object:
t2.setTranform(affineTransform);

This works except for the detail of forgetting the first translation it appears, how do I preserve the first, w/o knowing the values? I know I could pass them around, but seems like I’m missing something in the API.

J

NM. Just found it, have to set translations on graphics object, not on a transform as setTransform() wipes any other transformations.