Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Chet Haase
Olof, I'm not sure of where the mad update is coming from, but you don't want to call update() from paint; that's actually backwards from what the system expects. From the Component javadocs: The update method of Component calls this component's paint method to redraw this

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
Thanks for you answer Chet. On 8/25/05, Chet Haase [EMAIL PROTECTED] wrote: Olof, I'm not sure of where the mad update is coming from, but you don't want to call update() from paint; that's actually backwards from what the system expects. From the Component javadocs: The update

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
Whoa. Things like this scares me: http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html (look at the section under The event dispatching thread, the red section) I get the general feeling the AWT/Swing developers have been trying to let the application developers not worry about

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Ted Hill
There is a new book from Oreilly called Killer Game Programming in Java http://www.oreilly.com/catalog/killergame/ You might find Chapter 2 very interesting. He shows how to control both UPS (updates per sec) and FPS (frames per sec) independently. Here is the table of contents for chap 2.

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
Thanks Ted that seems nice! My progress so far: since Swing's Timer class is Swing (duh) I have to convert my Applet to a JApplet, which means paintComponent instead of paint for instance. Hope it is as simple as that... /Olof On 8/25/05, Ted Hill [EMAIL PROTECTED] wrote: There is a new book

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
public void update(Graphics g) { // Background: map field g.drawImage(backbuffer, 0, 0, this); // Foreground: headsup display headsup.draw(g); } public void paint(Graphics g) { update(g); } Now the

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
I'm using the Java Console and System.out.println() for debugging in Firefox. On 8/25/05, Jim Graham [EMAIL PROTECTED] wrote: public void update(Graphics g) { // Background: map field g.drawImage(backbuffer, 0, 0, this); // Foreground:

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
OK since I've got you attention, please give me an educated answer to this: Should I use Swing exclusively for a web page game? Which version of the JRE Firefox-plugin is stable for end-users if I decide to use Swing instead of just ground-plate AWT? Thanks for your ideas, /Olof On 8/25/05,

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
From the Component javadocs: The update method of Component calls this component's paint method to redraw this component. and: Subclasses of Component that override this method should either call super.update(g), or call paint(g) directly from their update

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
What happens right before the trigger? You could try overriding repaint() repaint() is not getting called excessively. It is only update() that gets called all the time. I know this since I tried this: public void repaint() { System.out.println(repaint); super.repaint(); } .. without

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
On 8/25/05, Jim Graham [EMAIL PROTECTED] wrote: What happens right before the trigger? You could try overriding repaint() repaint() is not getting called excessively. It is only update() that gets called all the time. I know this since I tried this: public void repaint() {

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
This is a very thourough answer. I will try to reply ... On 8/25/05, Jim Graham [EMAIL PROTECTED] wrote: From the Component javadocs: The update method of Component calls this component's paint method to redraw this component. and: Subclasses of Component that

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
OK I've done some debug-printing for you to get a feeling of the behaviour. I use this debug-println: public static void println(String str) { long millis = System.currentTimeMillis() - startMillis; String threadName = Thread.currentThread().getName();

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
This is hard to tell without seeing the code in the headsup.draw method... ...jim --On Thursday, August 25, 2005 10:19 PM +0200 Olof Bjarnason [EMAIL PROTECTED] wrote: OK I've done some debug-printing for you to get a feeling of the behaviour. I use this

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
Here it is: public void draw(Graphics g) { Debug.println(headsup.draw); g.setColor(Color.GREEN); int topline = gfxState.yoffset + 1; int leftline = gfxState.xoffset + 1; int rightline = gfxState.xoffset - 1 +

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
Hi Olof, There is no hard requirement to use Swing. It does provide a number of features, such as automatic double buffering and Timers, which could save you some coding and debugging time, but it is also possible to roll your own as you have already done. Swing also provides a lot of features

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Olof Bjarnason
Is there any particular part of my source code you want me to post? Posting the whole project seems a bit too much for a mailing list... Thanks for your help, /Olof On 8/25/05, Jim Graham [EMAIL PROTECTED] wrote: Hi Olof, There is no hard requirement to use Swing. It does provide a number

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
We've probably exceeded the interest level of those here. The best thing at this stage would be to try to boil the test case down to the smallest case that still reproduces it (i.e. make a copy and start deleting/stubbing code while the problem still persists, etc.) and then send it to just me