I am trying to add functionality so that you can have an Actor draw on the background as it moves. The basic functionality works great, but now I am trying to allow the user to set the pensize to be something > 1 pixel wide. To do this, I've discovered the setStroke() method for awtImages.
I've implemented code like this in my Actor:
However, calling this function seems to do nothing. I'm wondering if anyone knows why this does not work or knows more about how to make it work. I have a feeling I'm getting a new copy of the awt image that underlies the background and then I am making changes to that copy, but I can't figure out how to verify if that's what is happening.
Thanks!
Vic
1 2 3 4 5 6 | public void setPenSize( int size) { penSize = size; java.awt.Graphics2D g = getWorld().getBackground().getAwtImage().createGraphics(); g.setStroke( new java.awt.BasicStroke(size)); } |