
tripleplay.platform.JavaImageOverlay Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tripleplay-java-lwjgl2 Show documentation
Show all versions of tripleplay-java-lwjgl2 Show documentation
Java-specific code for TriplePlay, using PlayN LWJGL2 backend.
//
// Triple Play - utilities for use in PlayN-based games
// Copyright (c) 2011-2014, Three Rings Design, Inc. - All rights reserved.
// http://github.com/threerings/tripleplay/blob/master/LICENSE
package tripleplay.platform;
import java.awt.Graphics;
import javax.swing.JComponent;
import playn.core.Image;
import playn.java.JavaImage;
public class JavaImageOverlay extends JavaNativeOverlay
implements ImageOverlay
{
public JavaImageOverlay (JavaTPPlatform plat, Image image) {
super(plat, new ImageComponent((JavaImage)image));
}
public Image image () {
return ((ImageComponent)component).image;
}
public void repaint () {
component.repaint();
}
protected static class ImageComponent extends JComponent
{
public final JavaImage image;
public ImageComponent (JavaImage image) {
this.image = image;
}
@Override public void paint (Graphics g) {
g.drawImage(image.bufferedImage(), 0, 0, null);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy