Grade12Programs/src/game/drawing/Draw.java
public static void init() {
        System.out.println("[Draw] initizlizing");

        // Andrew Tyler www.AndrewTyler.net and font@andrewtyler.net
        try {
            graphicsEnviro.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File(GameJava.baseDirectory + GameJava.directoryChar + "pixelmix.ttf")));
            drawFont = new Font("pixelmix", Font.PLAIN, 8);
        } catch (IOException | FontFormatException e) {
            System.err.println("[Draw] cannot find pixelmix.ttf in assets, using default font instead");
            drawFont = new Font("Dialog", Font.PLAIN, 8);
        }

        panel = new JPanel(new BorderLayout());

        buffer = graphicsConfig.createCompatibleVolatileImage(GameJava.gw, GameJava.gh);
        buffer1 = graphicsConfig.createCompatibleVolatileImage(GameJava.gw, GameJava.gh);
        buffer2 = graphicsConfig.createCompatibleVolatileImage(GameJava.gw, GameJava.gh);

        canvas = buffer.createGraphics();

        panel.setBackground(Color.WHITE);

        frame = new JFrame(GameJava.frameTitle);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());
        frame.add(panel, BorderLayout.CENTER);
        frame.setUndecorated(false);
        frame.setVisible(true);
        frame.pack();

        frame.setSize(GameJava.gw, GameJava.gh);

        frame.setLocationRelativeTo(null);

        windowedWidth = GameJava.gw;
        windowedHeight = GameJava.gh;
        
        int w = frame.getWidth() - frame.getInsets().right - frame.getInsets().left;
        int h = frame.getHeight() - frame.getInsets().top - frame.getInsets().bottom;
        panel.setSize(w, h);
        GameJava.gw = panel.getWidth();
        GameJava.gh = panel.getHeight();
    }
// creates window and sets up buffers
creates window and sets up buffers
creates window and sets up buffers
public static void init() {
        System.out.println("[Draw] initizlizing");
        try {
            graphicsEnviro.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File(GameJava.baseDirectory + GameJava.directoryChar + "pixelmix.ttf")));
            drawFont = new Font("pixelmix", Font.PLAIN, 8);
        } catch (IOException | FontFormatException e) {
            System.err.println("[Draw] cannot find pixelmix.ttf in assets, using default font instead");
            drawFont = new Font("Dialog", Font.PLAIN, 8);
        }
        panel = new JPanel(new BorderLayout());
        buffer = graphicsConfig.createCompatibleVolatileImage(GameJava.gw, GameJava.gh);
        buffer1 = graphicsConfig.createCompatibleVolatileImage(GameJava.gw, GameJava.gh);
        buffer2 = graphicsConfig.createCompatibleVolatileImage(GameJava.gw, GameJava.gh);
        canvas = buffer.createGraphics();
        panel.setBackground(Color.WHITE);
        frame = new JFrame(GameJava.frameTitle);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());
        frame.add(panel, BorderLayout.CENTER);
        frame.setUndecorated(false);
        frame.setVisible(true);
        frame.pack();
        frame.setSize(GameJava.gw, GameJava.gh);
        frame.setLocationRelativeTo(null);
        windowedWidth = GameJava.gw;
        windowedHeight = GameJava.gh;
        int w = frame.getWidth() - frame.getInsets().right - frame.getInsets().left;
        int h = frame.getHeight() - frame.getInsets().top - frame.getInsets().bottom;
        panel.setSize(w, h);
        GameJava.gw = panel.getWidth();
        GameJava.gh = panel.getHeight();
    }
public static void init ( ) { System . out . println ( "[Draw] initizlizing" ) ; try { graphicsEnviro . registerFont ( Font . createFont ( Font . TRUETYPE_FONT , new File ( GameJava . baseDirectory + GameJava . directoryChar + "pixelmix.ttf" ) ) ) ; drawFont = new Font ( "pixelmix" , Font . PLAIN , 8 ) ; } catch ( IOException | FontFormatException e ) { System . err . println ( "[Draw] cannot find pixelmix.ttf in assets, using default font instead" ) ; drawFont = new Font ( "Dialog" , Font . PLAIN , 8 ) ; } panel = new JPanel ( new BorderLayout ( ) ) ; buffer = graphicsConfig . createCompatibleVolatileImage ( GameJava . gw , GameJava . gh ) ; buffer1 = graphicsConfig . createCompatibleVolatileImage ( GameJava . gw , GameJava . gh ) ; buffer2 = graphicsConfig . createCompatibleVolatileImage ( GameJava . gw , GameJava . gh ) ; canvas = buffer . createGraphics ( ) ; panel . setBackground ( Color . WHITE ) ; frame = new JFrame ( GameJava . frameTitle ) ; frame . setDefaultCloseOperation ( JFrame . EXIT_ON_CLOSE ) ; frame . setLayout ( new BorderLayout ( ) ) ; frame . add ( panel , BorderLayout . CENTER ) ; frame . setUndecorated ( false ) ; frame . setVisible ( true ) ; frame . pack ( ) ; frame . setSize ( GameJava . gw , GameJava . gh ) ; frame . setLocationRelativeTo ( null ) ; windowedWidth = GameJava . gw ; windowedHeight = GameJava . gh ; int w = frame . getWidth ( ) - frame . getInsets ( ) . right - frame . getInsets ( ) . left ; int h = frame . getHeight ( ) - frame . getInsets ( ) . top - frame . getInsets ( ) . bottom ; panel . setSize ( w , h ) ; GameJava . gw = panel . getWidth ( ) ; GameJava . gh = panel . getHeight ( ) ; }
creates window and sets up buffers
creates window and sets up buffers
// Andrew Tyler www.AndrewTyler.net and font@andrewtyler.net