my dog learned polymorphism
The moose likes Game Development and the fly likes scrolling graphics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "scrolling graphics" Watch "scrolling graphics" New topic

scrolling graphics

Jerry Timwell

Joined: May 31, 2005
Posts: 1
Hi, I need help...
How would you scroll on an image, for example, a 400x400 view on a 1000x1000 picture, or, how to scroll any other way.

Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
It depends. If you are wanting to draw just a 'normal' picture (like a JPEG or something), then drawing at negative coordinates might be enough (e.g. drawing at (-100, -100) will show you a section of the picture from (100, 100) to (500, 500). But be aware that on some PCs this kind of drawing (where the image is bigger than the screen) can be VERY slow. Not on all, just certain graphics setups.

If, however, you want background for a 2D game (something like Xevious or many platform games) you will need to look into using a tilemap.
I agree. Here's the link:
subject: scrolling graphics
It's not a secret anymore!