Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
Like Tree1Likes

Thread: Drawing offscreen?

  1. #21
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Drawing offscreen?

    blit = drawing one image onto another.

    COnfused now about "clicking on object"?
    That doesn't sound like it's to do with drawing a scrolling screen.

    Anyway...when scrolling you already have the background drawn once, which is presumably what you drew in the previous iteration.
    Use that image, offset by whatever amount you need.
    Then draw the missing images.
    eg. (and this assumes the currentBackground is the BufferedImage containg the background as last drawn)
    Java Code:
    create newBackgroundImage
    blit the bit of the currentBackgroundImage that is still visible onto the newBackgroundImage
    Set current = new
    Blit background onto screen
    Blit the hero onto screen.
    If you have mobile content in the background the "blit hero" part will become "blit animations".

  2. #22
    santa's Avatar
    santa is offline Senior Member
    Join Date
    Nov 2009
    Rep Power

    Default Re: Drawing offscreen?

    Problem solved ... the getsubimage made the lag. Now im drawing some of the tile parts outside of the JPanel. But thats ok? =P

  3. #23
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Drawing offscreen?

    im drawing some of the tile parts outside of the JPanel.
    No, you're not. The graphics clip takes care of that.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. offscreen.getGraphics() error
    By luis.depedro in forum AWT / Swing
    Replies: 10
    Last Post: 01-21-2012, 10:43 PM
  2. Drawing an arc
    By berkeleybross in forum Java 2D
    Replies: 10
    Last Post: 12-09-2010, 02:32 AM
  3. Drawing a map
    By Karp in forum AWT / Swing
    Replies: 4
    Last Post: 11-07-2008, 01:26 PM
  4. drawing an image to an offscreen image
    By hunterbdb in forum Java 2D
    Replies: 9
    Last Post: 10-30-2008, 07:17 PM
  5. Problem Setting offscreen background
    By D34N0 in forum Java Applets
    Replies: 1
    Last Post: 07-14-2007, 11:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts