updating of dimensions
parent
513ee106f1
commit
642951ae1a
|
|
@ -48,7 +48,6 @@ public class AppHelper implements Runnable{
|
||||||
//one of us...
|
//one of us...
|
||||||
if(obj instanceof BasicApp) {
|
if(obj instanceof BasicApp) {
|
||||||
apps.add((BasicApp)(obj));
|
apps.add((BasicApp)(obj));
|
||||||
((BasicApp)obj).initialize();
|
|
||||||
}
|
}
|
||||||
progress++;
|
progress++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,8 @@ public class Engine extends Canvas implements KeyListener, MouseMotionListener,
|
||||||
/**
|
/**
|
||||||
* variables to track the fps, DON'T WORRY ABOUT IT, PAST YOU HAS YOU
|
* variables to track the fps, DON'T WORRY ABOUT IT, PAST YOU HAS YOU
|
||||||
* COVERED.
|
* COVERED.
|
||||||
|
* present me here, im trusting you. and since i just implemented a way to have
|
||||||
|
* like 100k fps, thanks man for doing this right.
|
||||||
*/
|
*/
|
||||||
private static int framesInCurrentSecond = 0, FPS = 0;
|
private static int framesInCurrentSecond = 0, FPS = 0;
|
||||||
|
|
||||||
|
|
@ -139,7 +141,7 @@ public class Engine extends Canvas implements KeyListener, MouseMotionListener,
|
||||||
/**
|
/**
|
||||||
* because retina support
|
* because retina support
|
||||||
*/
|
*/
|
||||||
private final boolean retina;
|
private static boolean retina;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SRSLY CALL DYS ONCE. DAS IT. ALL YOU GET. ONE SHOT. because this is a
|
* SRSLY CALL DYS ONCE. DAS IT. ALL YOU GET. ONE SHOT. because this is a
|
||||||
|
|
@ -171,7 +173,7 @@ public class Engine extends Canvas implements KeyListener, MouseMotionListener,
|
||||||
frame.addContainerListener(this);
|
frame.addContainerListener(this);
|
||||||
frame.addComponentListener(this);
|
frame.addComponentListener(this);
|
||||||
|
|
||||||
requestFocus();
|
//requestFocus();
|
||||||
|
|
||||||
if (showLoading)
|
if (showLoading)
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
@ -198,9 +200,7 @@ public class Engine extends Canvas implements KeyListener, MouseMotionListener,
|
||||||
|
|
||||||
switchApps(0);
|
switchApps(0);
|
||||||
|
|
||||||
BUFFER_HEIGHT = HEIGHT*(retina?2:1);
|
|
||||||
BUFFER_WIDTH = WIDTH*(retina?2:1);
|
|
||||||
createBuffer();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,14 +270,12 @@ public class Engine extends Canvas implements KeyListener, MouseMotionListener,
|
||||||
*/
|
*/
|
||||||
public static boolean switchApps(int i) {
|
public static boolean switchApps(int i) {
|
||||||
try {
|
try {
|
||||||
|
apps[app].pauseApp();
|
||||||
app = i;
|
app = i;
|
||||||
setWindowProperties(apps[app]);
|
setWindowProperties(apps[app]);
|
||||||
apps[app].updateDimensions(BUFFER_WIDTH, BUFFER_HEIGHT);
|
apps[app].initialize();
|
||||||
|
apps[app].resumeApp();
|
||||||
frame.pack();
|
Engine.frame.requestFocus();
|
||||||
|
|
||||||
// because we now use the ONE buffer system... yeah
|
|
||||||
// lets do something about thaaaaaaaaat...
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -311,7 +309,11 @@ public class Engine extends Canvas implements KeyListener, MouseMotionListener,
|
||||||
WIDTH = dimension.width;
|
WIDTH = dimension.width;
|
||||||
HEIGHT = dimension.height;
|
HEIGHT = dimension.height;
|
||||||
frame.setResizable(resizable);
|
frame.setResizable(resizable);
|
||||||
|
BUFFER_HEIGHT = HEIGHT*(retina?2:1);
|
||||||
|
BUFFER_WIDTH = WIDTH*(retina?2:1);
|
||||||
|
apps[app].updateDimensions(BUFFER_WIDTH, BUFFER_HEIGHT);
|
||||||
|
staticMain.createBuffer();
|
||||||
|
frame.pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paint(Graphics g) {// oh.....
|
public void paint(Graphics g) {// oh.....
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ public class ImageCreator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Image colorNoise(Color c, double d, double i, int width,
|
public static BufferedImage colorNoise(Color c, double d, double i, int width,
|
||||||
int height) {
|
int height) {
|
||||||
return colorNoise(c.getRed(), c.getGreen(), c.getBlue(), d, i, width,
|
return colorNoise(c.getRed(), c.getGreen(), c.getBlue(), d, i, width,
|
||||||
height);
|
height);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue