2 * Sixth 3D engine. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
8 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
10 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
11 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.ForwardOrientedTexture;
12 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas.TextCanvas;
13 import eu.svjatoslav.sixth.e3d.renderer.raster.texture.Texture;
15 public class ForwardOrientedTextBlock extends ForwardOrientedTexture {
17 public ForwardOrientedTextBlock(final Point3D point, final double scale,
18 final int maxUpscaleFactor, final String text,
19 final eu.svjatoslav.sixth.e3d.renderer.raster.Color textColor) {
20 super(point, scale, getTexture(text, maxUpscaleFactor, textColor));
24 public static Texture getTexture(final String text,
25 final int maxUpscaleFactor,
26 final eu.svjatoslav.sixth.e3d.renderer.raster.Color textColor) {
28 final Texture texture = new Texture(text.length()
29 * TextCanvas.FONT_CHAR_WIDTH_PIXELS, TextCanvas.FONT_CHAR_HEIGHT_PIXELS,
32 // texture.graphics.setColor(Color.BLUE);
33 // texture.graphics.fillRect(0, 0, texture.primaryBitmap.width,
34 // texture.primaryBitmap.width);
36 texture.graphics.setFont(TextCanvas.FONT);
37 texture.graphics.setColor(textColor.toAwtColor());
39 for (int c = 0; c < text.length(); c++)
40 texture.graphics.drawChars(new char[]{text.charAt(c),}, 0, 1,
41 (c * TextCanvas.FONT_CHAR_WIDTH_PIXELS) - 0,
42 (0 * TextCanvas.FONT_CHAR_HEIGHT_PIXELS) + 11);