Debugging waves with onPaint()

Jump to navigation Jump to search

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:Talk:Robocode/Graphical Debugging/Debugging waves with onPaint()/reply (6).

Using getGraphics() also works. But I am implementing onPaint and storing an object in a member variable (that object contains the Graphics object), which is then consumed in the run() method. That variable is cleared before calling execute() (in case debug is disabled in the middle of a battle). It is bulky, but it is fast.

If painting is disabled, onPaint is not called and nothing is setted in that variable. Yep, there is one check to see if the variable was set. The onPaint event is treated a bit differently (separated queue) from other events to make it easier to process it at the end.

MN19:03, 17 May 2012