public void drawGameScreen(Graphics g, ArrayList<Ship> ships, double xRot, double yRot, int fps,
            ArrayList<StarChunk> stars, Camera camera, String version, int ups, boolean paused, HashSet<Shot> allShots, Dimension mapSize)
    {

        //long start = System.currentTimeMillis();
        
        if (drawingImage.getWidth() != camera.getSize().x || drawingImage.getHeight() != camera.getSize().y)
        {
            if (isMac)
            {
                drawingImage = config.createCompatibleVolatileImage(camera.getSize().x, camera.getSize().y, Transparency.TRANSLUCENT);
            } 
            else 
            {
                drawingImage = config.createCompatibleVolatileImage(camera.getSize().x, camera.getSize().y);
            }
            //System.err.println(drawingImage.getColorModel().equals(config.getColorModel()));
        }

        Graphics2D g2d = drawingImage.createGraphics(); // turns it into 2d graphics
        //System.out.println(images.get(0).getColorModel().equals(config.getColorModel()));

        // draw backround rectangle
        g2d.setColor(Color.BLACK);

        g2d.fillRect(0, 0, camera.getSize().x, camera.getSize().y);

        //System.out.println(ups);
        // enable anti-aliasing
        g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        // draw stars. Costs 2-7 ms
        for (StarChunk starChunk : stars) 
        {
            if (camera.insideView(starChunk.getBoundingRect()))
            {
                starChunk.draw(g2d, camera.getLocation());
            }
        }
        
        for (Ship ship : ships)
        {
            ship.draw(g2d);
        }
        
        // draw shots TODO: check if on screen.
        for (Shot shot : allShots)
        {
            shot.draw(g2d);  
        }
        
        // draw HUD
        headsUpDisplayPlayer.draw(g2d, ships, mapSize, fps, ups, version, allShots.size());
        
        //draw pause menu
        if (paused) 
        {
            g2d.drawImage(images.get(PAUSEMENU), null, 10, 100);
            g2d.drawImage(images.get(PAUSETOMENU), null, 20, 110);
        }
        
        // this is the most expensive call
        g.drawImage(drawingImage, 0, 0, null);

        g2d.dispose();
        g.dispose();
        //System.out.println(System.currentTimeMillis() - start);
    }