Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mill-o

[java] clipping and similar methods

This topic is 5978 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i need to increase the fps in a game (~50 fps average right now, ~100 would be nice). i know the trick is to just draw what have been changed since the last frame. i can''t get clipping to work properly. i can get it to work when i have ONE sprite moving around since then i just have to set the clip to the sprites bounding box. when i have lots of sprites i have to change the clipping for each sprite resulting in just the last one to be drawn. i also used another approach. i tried to "copy" a part of background and then just draw image and the a sprite on top of if. somehow it just appears as a white rectangle instead of the actual image. some pseudo:
  
main class {
  // ..


  paint(Graphics g) {
    draw background;
    draw all sprites;
    draw the backbuffer;
  }

  update(Graphics g) {
    for (all sprites) {
      create some kind of image which is small (32x32);
      draw that part of the background;
      draw the sprite;
   }
   draw the backbuffer;
  }

  //. .

}

  
any help is appreciated. btw, i tried jikes today and it''s sooo fast (atleast much faster than javac)

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!