Increase refresh rate and constantly submit frames

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 3 years ago
parent 8cbc0eb65f
commit 79ea82da4f
  1. 29
      src/sig/engine/Panel.java

@ -4,6 +4,8 @@ import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.Image; import java.awt.Image;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import java.awt.image.MemoryImageSource; import java.awt.image.MemoryImageSource;
import java.util.ArrayList; import java.util.ArrayList;
@ -37,6 +39,33 @@ public class Panel extends JPanel implements Runnable {
super(true); super(true);
this.window=f; this.window=f;
thread = new Thread(this, "MyPanel Thread"); thread = new Thread(this, "MyPanel Thread");
this.addComponentListener(new ComponentListener() {
@Override
public void componentHidden(ComponentEvent e) {
// TODO Auto-generated method stub
}
@Override
public void componentMoved(ComponentEvent e) {
// TODO Auto-generated method stub
}
@Override
public void componentResized(ComponentEvent e) {
System.out.println("Resized");
}
@Override
public void componentShown(ComponentEvent e) {
// TODO Auto-generated method stub
}
});
} }
/** /**

Loading…
Cancel
Save