package se.urmo.game.util;

import java.awt.Font;
import java.io.InputStream;

public enum GameFonts {
    ARCADE_FONT("/fonts/PressStart2P-Regular.ttf");

    private final Font font;

    GameFonts(String s) {
        font = loadArcadeFont(s);
    }

    private static Font loadArcadeFont(String name) {
        try (InputStream is = GameFonts.class.getResourceAsStream(name)) {
            return Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(16f);
        } catch (Exception e) {
            return new Font("Monospaced", Font.BOLD, 16);
        }
    }

    public static Font arcade(float textSize) {
        return ARCADE_FONT.font.deriveFont(textSize);
    }
}
