Refactor
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
This commit is contained in:
parent
b0a5f882d6
commit
9136dd58bf
@ -116,13 +116,7 @@ public class Panel extends JPanel implements Runnable,ComponentListener {
|
|||||||
|
|
||||||
|
|
||||||
public /* abstract */ void render(){
|
public /* abstract */ void render(){
|
||||||
if (resizing) {
|
resizeUpdate();
|
||||||
pixel = new int[getWidth()*getHeight()];
|
|
||||||
resizing=false;
|
|
||||||
mImageProducer = new MemoryImageSource(getWidth(), getHeight(), cm, pixel,0, getWidth());
|
|
||||||
imageBuffer = Toolkit.getDefaultToolkit().createImage(mImageProducer);
|
|
||||||
System.out.println("Window resized.");
|
|
||||||
}
|
|
||||||
int[] p = pixel; // this avoid crash when resizing
|
int[] p = pixel; // this avoid crash when resizing
|
||||||
//a=h/w
|
//a=h/w
|
||||||
|
|
||||||
@ -134,6 +128,16 @@ public class Panel extends JPanel implements Runnable,ComponentListener {
|
|||||||
Draw_Nana(nana_sprite);
|
Draw_Nana(nana_sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resizeUpdate() {
|
||||||
|
if (resizing) {
|
||||||
|
pixel = new int[getWidth()*getHeight()];
|
||||||
|
resizing=false;
|
||||||
|
mImageProducer = new MemoryImageSource(getWidth(), getHeight(), cm, pixel,0, getWidth());
|
||||||
|
imageBuffer = Toolkit.getDefaultToolkit().createImage(mImageProducer);
|
||||||
|
System.out.println("Window resized.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void FillRect(int[] p,Color col,double x,double y,double w,double h) {
|
public void FillRect(int[] p,Color col,double x,double y,double w,double h) {
|
||||||
for (int xx=0;xx<w;xx++) {
|
for (int xx=0;xx<w;xx++) {
|
||||||
for (int yy=0;yy<h;yy++) {
|
for (int yy=0;yy<h;yy++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user