Jump to content
Posted 17 April 2012 - 08:04 PM
Posted 17 April 2012 - 08:36 PM
Use a BufferStrategy. It allows you to "blit" to an off-screen image like you would normally using an API like SDL and doesn't restrict you with Swing's obnoxious threading issues with regards to paint() and repaint(). That is, you can flip() your buffer whenever you like, thus controling the rendering speed yourself (for the most part, but it is an improvement since Swing tends to ignore repaint() requests at random). Furthermore, the surface is almost guaranteed to be hardware accelerated and Java will handle all the details for you. Here's a simple example: http://gpsnippets.bl...gy-in-java.html
So my first question is: How would I rewrite, or create a new, paint method that I can have executed immediately?
First, a Vector is just a synchronized ArrayList so there's not any particular need to use them. If you're having synchronization issues, I'd look at an alternate strategy (synch blocks, copy-on-write, etc.) instead to avoid any potential overhead.
Would it be a bad idea to put all the ArrayLists inside a Vector so that I can just loop through the vector and then each ArrayList so that I don't have to call them by name?
Posted 17 April 2012 - 09:50 PM
Posted 18 April 2012 - 02:27 PM
Posted 18 April 2012 - 08:21 PM