I am attempting to load a font, in slick2d, which (in eclipse) is located at: \"resources\\fonts\\slkscr.ttf\"
with the following code:
private void
You're loading the font all wrong, you should look at the examples here Slick Wiki - True Type Fonts
private void loadResources() throws FontFormatException, IOException {
Font fontRaw = Font.createFont(Font.TRUETYPE_FONT, new File("resources/fonts/slkscr.ttf"));
Font fontBase = fontRaw.deriveFont(28f);
this.font = new TrueTypeFont(fontBase, false);
}
Put a leading slash to indicate to search from the root of the class-path, vis.
..getResourceAsStream("/resources/fonts/slkscr.ttf")..
As an aside. That stream closed
message might be telling us that createFont
requires a repositionable InputStream
. Try instead:
getResource("/resources/fonts/slkscr.ttf")
..or..
getResource("/slkscr.ttf")
..depending upon path.