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
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
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
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.
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
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
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:
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,
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
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
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() {
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
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();
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
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 +
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
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
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
18 matches
Mail list logo