Adds the colorPalette instance variable and rewrites small portions of related code, so that the Frame of the Screen's Canvas uses the default fore/background colors.
This eliminates the noticeable white-screen flicker when VTerminal first launches.
@@ -38,6 +38,9 @@ public class Screen {
/** The last known tile-based position of the mouse. */
private final Point mousePosition = new Point(0, 0);
+ /** The color palette of the Screen. Does not apply to child components. */
+ private ColorPalette colorPalette;
+
/**
* Constructs a new 80x40 Screen.
*
@@ -130,8 +133,15 @@ public class Screen {
frame.dispose();
}
});
+ frame.setBackground(colorPalette.getDefaultBackground());
+ frame.setForeground(colorPalette.getDefaultForeground());
frame.setVisible(true);
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
draw();
return frame;
@@ -454,6 +464,8 @@ public class Screen {
return;
}
+ this.colorPalette = colorPalette;
+
for (int y = 0 ; y < tiles.getHeight() ; y++) {
for (int x = 0 ; x < tiles.getWidth() ; x++) {
final Tile tile = tiles.getTileAt(x, y);
