문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top