Mercurial > hg > ristipolku
comparison game/Engine.java @ 183:cf0256f13612
Remove global number of fonts static.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 16 Mar 2017 13:29:22 +0200 |
parents | 2e033eced6e5 |
children | 189cd8fe2304 |
comparison
equal
deleted
inserted
replaced
182:88b364dfd501 | 183:cf0256f13612 |
---|---|
589 G.lautaBG = ImageIO.read(res.getStream()); | 589 G.lautaBG = ImageIO.read(res.getStream()); |
590 | 590 |
591 try { | 591 try { |
592 res = new ResourceLoader("graphics/font.ttf"); | 592 res = new ResourceLoader("graphics/font.ttf"); |
593 | 593 |
594 G.fonts = new Font[G.numFonts]; | 594 G.fonts = new Font[4]; |
595 G.baseFont = Font.createFont(Font.TRUETYPE_FONT, res.getStream()); | 595 G.baseFont = Font.createFont(Font.TRUETYPE_FONT, res.getStream()); |
596 | 596 |
597 setupDerivedFonts(1.0f); | 597 setupDerivedFonts(1.0f); |
598 } | 598 } |
599 catch (FontFormatException e) | 599 catch (FontFormatException e) |
684 | 684 |
685 // Rescale fonts | 685 // Rescale fonts |
686 setupDerivedFonts(dw); | 686 setupDerivedFonts(dw); |
687 | 687 |
688 // Get font metrics against current Graphics2D context | 688 // Get font metrics against current Graphics2D context |
689 G.metrics = new FontMetrics[G.numFonts]; | 689 G.metrics = new FontMetrics[G.fonts.length]; |
690 for (int i = 0; i < G.numFonts; i++) | 690 for (int i = 0; i < G.fonts.length; i++) |
691 G.metrics[i] = g2.getFontMetrics(G.fonts[i]); | 691 G.metrics[i] = g2.getFontMetrics(G.fonts[i]); |
692 | 692 |
693 // Rescale IDM GUI widgets | 693 // Rescale IDM GUI widgets |
694 widgets.setScale(dw, dh); | 694 widgets.setScale(dw, dh); |
695 } | 695 } |