Class WindowBuilder


  • public class WindowBuilder
    extends Object
    A class for building windows. Each window builder can only build one window.
    Author:
    Tim Neumann
    • Constructor Detail

      • WindowBuilder

        public WindowBuilder()
        Create a new WindowBuilder.
      • WindowBuilder

        public WindowBuilder​(double dpiScale)
        Create a new WindowBuilder.
        Parameters:
        dpiScale - the scaling factor for high dpi screens, only effective for the very first WindowBuilder instantiation!
    • Method Detail

      • setTitle

        public void setTitle​(String title)
        Set the title of the new window.

        This method can only be called before building the window. To change the title after building the window, call GameWindow.setWindowTitle(String) on the resulting window.

        Parameters:
        title - The title to set
      • setGraphicsSettings

        public void setGraphicsSettings​(boolean useDoubleBuffering,
                                        boolean syncToScreen)
        Set the graphics settings of the playfield drawer.

        This method can only be called before building the window. To change the title after building the window, call PlayfieldDrawer.setDoubleBuffering(boolean) and PlayfieldDrawer.setSyncToScreen(boolean) on the resulting window's playfield drawer.

        Parameters:
        useDoubleBuffering - true (default) uses doubleBuffering when rendering changes on the playfield.
        syncToScreen - true (default) actively tries to sync the updated graphics to the screen after rendering changes on the playfield.
      • buildWindow

        public void buildWindow()
        Actually build the window.

        This can only be called once for each window builder.

      • hasBuiltWindow

        public boolean hasBuiltWindow()
        Get whether the window has been built.
        Returns:
        true if and only if the window has been built
      • getBuiltWindow

        public GameWindow getBuiltWindow()
        Get the window that was built.

        This method can only be called after buildWindow().

        Returns:
        The created GameWindow