Thread history
Time | User | Activity | Comment |
---|---|---|---|
No results |
I assume you're referring to if you use the "getGraphics()" call instead of implementing "onPaint()" right?
At least personally I don't care for that approach because then either your bot will spend CPU time on the painting when painting is disabled, or you have to check if onPaint is called anyway.
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.