public void render(Graphics g) {
        if (shouldRender) {
            HUDArea hudArea = null;

            if (bgColor != null) {
                g.setColor(bgColor);
                g.fillRect(positionX, positionY, width, height);
            }

            if (bgImage != null) {
                g.drawImage(bgImage, positionX, positionY, width, height, null);
            }

            if (border) {
                g.setColor(borderColor);
                g.drawRect(positionX, positionY, width, height);
            }

            if (textColor != null && text != null && textSize > 0) {
                g.setColor(textColor);
                g.setFont(new Font("SansSerif", Font.BOLD, textSize));

                //center the text
                FontMetrics fm = g.getFontMetrics();
                int messageWidth = fm.stringWidth(text);
                int messageAscent = fm.getMaxAscent();
                int messageDescent = fm.getMaxDescent();
                int messageX = (width / 2) - (messageWidth / 2);
                int messageY = (height / 2) - (messageDescent / 2) + (messageAscent / 2);

                g.drawString(text, messageX, messageY - 100);
            }

            for (int i = 0; i < hudAreas.size(); i++) {
                hudArea = hudAreas.get(i);
                hudArea.render(g);
            }
        }
    }