Render to the applet instead of its parent window since that doesn't work.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@223 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2007-05-03 22:56:29 +00:00
parent ab6252cee7
commit 095c718244
3 changed files with 6 additions and 3 deletions
@@ -21,6 +21,7 @@
package com.threerings.media;
import java.awt.Component;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Rectangle;
@@ -84,7 +85,7 @@ public class BackFrameManager extends FrameManager
// we cache our frame's graphics object so that we can avoid
// instantiating a new one on every tick
if (_fgfx == null) {
_fgfx = (Graphics2D)_window.getGraphics();
_fgfx = (Graphics2D)((Component)_root).getGraphics();
}
_fgfx.drawImage(_backimg, 0, 0, null);
@@ -152,7 +152,8 @@ public abstract class FrameManager
*/
public static FrameManager newInstance (ManagedRoot root, MediaTimer timer)
{
FrameManager fmgr = _useFlip.getValue() ? new FlipFrameManager() : new BackFrameManager();
FrameManager fmgr = (root instanceof ManagedJFrame && _useFlip.getValue()) ?
new FlipFrameManager() : new BackFrameManager();
fmgr.init(root, timer);
return fmgr;
}
@@ -328,7 +329,7 @@ public abstract class FrameManager
_timer = timer;
// set up our custom repaint manager
_repainter = new ActiveRepaintManager(_window);
_repainter = new ActiveRepaintManager((Component)_root);
RepaintManager.setCurrentManager(_repainter);
// turn off double buffering for the whole business because we handle repaints
@@ -43,6 +43,7 @@ public class ManagedJApplet extends JApplet
public void init (FrameManager fmgr)
{
_fmgr = fmgr;
setIgnoreRepaint(true);
}
// from interface FrameManager.ManagedRoot