• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

second canvas doesn't draw

 
Greenhorn
Posts: 1
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This might get really confusing really fast so I'll do my best to be clear but I apologize in advance if I fail in communicating clearly.

I have a game with two frames: GameFrame and BrushToolBox. GameFrame has a canvas called GameCanvas while BrushToolBox has a canvas called ObjectPainting. Each of these canvases are created using their own class that extends canvas.

GameFrame is the main class of the project which, when a button called LevelEditor is pressed, will create BrushToolBox.

I am getting a very big problem with performance and sprite drawing. If ObjectPainting draws an image before GameCanvas has drawn its first image then GameCanvas will fall to 15 frames per second (instead of the normal 60 fps) when it's drawing images. If GameCanvas draws an image before ObjectPainting has drawn its first image then there is never a performance drop but ObjectPainting will not draw any images. Both canvases use their own drawing methods, that is neither of the canvases use an overridden method for drawing.

This is the entire ObjectPainting class (without includes):



And this is the relevant portion of the GameCanvas class (without includes):

reply
    Bookmark Topic Watch Topic
  • New Topic