Domanda

I was just wondering does java already paint the portion of an image to a given component or is it wise to do sub-image rendering? What I am trying to do is get as much performance as I can out of my code structure especially since I am creating a game with 2d maps as large as possible without drawing too much RAM. My 2d map involves a looping world whereas the player is able to reach the north part of the image while also seeing part of the south part (using sub-image rendering) and will move directly to the bottom of the image once the character has reached the top of the actual image.

È stato utile?

Soluzione

Java 2D is very clever about not painting parts of a graphic element or image that is not visible. I'd trust it unless/until you experience a bottleneck and a profiler identifies the painting as taking up the time.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top