/** * @see org.newdawn.slick.Game#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { awtFont = new java.awt.Font("Verdana", Font.PLAIN, 16); font = new TrueTypeFont(awtFont, false); for (int j = 0; j < 2; j++) { int lineLen = 90; for (int i = 0; i < text.length(); i += lineLen) { if (i + lineLen > text.length()) { lineLen = text.length() - i; } lines.add(text.substring(i, i + lineLen)); } lines.add(""); } }
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { sb = sbg; InputProvider provider = new InputProvider(gc.getInput()); provider.addListener(this); fps = new TrueTypeFont(Fonts.fpsCounter.getFont(), true); active = new TrueTypeFont(Fonts.active.getFont(), true); inactive = new TrueTypeFont(Fonts.inactive.getFont(), true); provider.bindCommand(new KeyControl(Input.KEY_UP), up); provider.bindCommand(new KeyControl(Input.KEY_DOWN), down); provider.bindCommand(new KeyControl(Input.KEY_LEFT), left); provider.bindCommand(new KeyControl(Input.KEY_RIGHT), right); provider.bindCommand(new KeyControl(Input.KEY_ENTER), enter); for (int i = 0; i < rect.length; i++) { rect[i] = new Rectangle(20, 20 + (70 * i), statValues[i] * 40, Play.width/30); } }
public Fonts() { char tabc[] = {'ą', 'ę', 'ó', 'ć', 'ż', 'ł', 'ś', 'ź', 'ń', 'Ł', 'Ó','Ś','Ę',}; try { //Utworzenie czcionki font = Font.createFont(Font.TRUETYPE_FONT, new File("res/fonts/TrajanPro-Regular.otf")); //font = font.deriveFont(Font.BOLD, 48f); } catch (FontFormatException fe) { System.out.println("FONT - FontFormatException"); } catch (IOException ioe) { System.out.println("FILE - IOException"); } //stworzenie zmiennej printLabel i printHead, ustalenie parametrów czcionki printLabel = new TrueTypeFont(font.deriveFont(Font.BOLD, 18f), true, tabc); printHead = new TrueTypeFont(font.deriveFont(Font.BOLD, 28f), true, tabc); printBig = new TrueTypeFont(font.deriveFont(Font.BOLD, 25f), true, tabc); printMediumLogo = new TrueTypeFont(font.deriveFont(Font.BOLD, 46f), true, tabc); printBigLogo = new TrueTypeFont(font.deriveFont(Font.BOLD, 78f), true, tabc); }
public void init(GameContainer container) throws SlickException //fait par VS, JD et FS { //Initialisation of animation when BOOOOM ! explosionAnimation = new Animation(); explosionImage1 = new Image ("boom1.png"); explosionImage2 = new Image ("boom2.png"); explosionImage3 = new Image ("boom3.png"); explosionImage4 = new Image ("boom4.png"); explosionAnimation.addFrame(explosionImage1, 25); explosionAnimation.addFrame(explosionImage2, 35); explosionAnimation.addFrame(explosionImage3, 35); explosionAnimation.addFrame(explosionImage4, 150); explosionAnimation.setLooping(false); //Graphic aspect ttf = new TrueTypeFont(font, true); container.getGraphics().setBackground(new Color(193, 184, 176)); //Input management on TextArea pseudoEntry = new TextArea(20,20,150,20); container.getInput().addKeyListener(pseudoEntry); container.getInput().addMouseListener(pseudoEntry); pseudoEntry.setPosition(grid.getRightPosition(), getNextCommandPosition(0)); }
/** * Initialise resources */ public Score() { readHighScore(); //load a default java font Font awtFont = new Font("Times New Roman", Font.BOLD, 24); font = new TrueTypeFont(awtFont, antiAlias); // load font from file try { InputStream inputStream = ResourceLoader.getResourceAsStream("res/fonts/brick.ttf"); Font awtFont2 = Font.createFont(Font.TRUETYPE_FONT, inputStream); awtFont2 = awtFont2.deriveFont(50f); // set font size font2 = new TrueTypeFont(awtFont2, antiAlias); } catch (Exception e) { e.printStackTrace(); } }
public void init(GameContainer container, StateBasedGame game) throws SlickException { ConfigsManager.getInstance().applicateConfigs(); LoadingList.setDeferredLoading(true); DatasManager.getInstance().addFile("LivingEntity.name", new TrueTypeFont(new Font("Verdana", Font.BOLD, 12), true)); DatasManager.getInstance().addFile("TextEffect.damages", new TrueTypeFont(new Font("Verdana", Font.BOLD, 12), true)); DatasManager.getInstance().addFile("TextEffect.status", new TrueTypeFont(new Font("Verdana", Font.BOLD, 14), true)); DatasManager.getInstance().addFile("MouseCursor.default", new Image("res/images/cursors/default.png")); DatasManager.getInstance().addMap("test.tmx"); try { ResourcesManager.getInstance().loadResources(); } catch (Exception e) { throw new SlickException(e.getMessage()); } super.init(container, game); }
public GUI(GameContainer container, int x, int y) { super(container); setLocation(x, y); Font buttonFont = new TrueTypeFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 14), true); //North and south speedUp = new TextButton(container, "Speed Up", getCompX(0), getCompY(0), buttonFont); speedDown = new TextButton(container, "Speed Down", getCompX(speedUp.getWidth() + 30), getCompY(0), buttonFont); pause = new TextButton(container, "Pause", getCompX(0), speedUp.getY() + speedUp.getHeight() + 10, buttonFont); restart = new TextButton(container, "Restart", speedDown.getX(), speedUp.getY() + speedUp.getHeight() + 10, buttonFont); euler = new TextButton(container, "Angle set: " + getAngleSet(), getCompX(0), pause.getY() + pause.getHeight() + 10, buttonFont); hemisphere = new TextButton(container, getHemisphereText(), getCompX(0), euler.getY() + euler.getHeight() + 10, buttonFont); close = new TextButton(container, "X", speedDown.getX() + speedDown.getWidth() + 50, getCompY(0), buttonFont); contents = new Rectangle(x - 5, y - 5, width, height); sf = new GradientFill(0, 0, new Color(10, 10, 10, 200), width, 0, new Color(60, 60, 60, 200)); }
@SuppressWarnings("deprecation") public GuiBar(Sprite sprite, float x, float y) { super(sprite, x, y); awtFont = new Font(fontName, Font.PLAIN, 34); font = new TrueTypeFont(awtFont, antiAlias); // Kod för att ladda in custom fonts // try { // //InputStream inputStream = // ResourceLoader.getResourceAsStream("ZOMBIE.TTF"); // InputStream inputStream = // ResourceLoader.getResourceAsStream("impact.ttf"); // // awtFont2 = Font.createFont(Font.TRUETYPE_FONT, inputStream); // awtFont2 = awtFont2.deriveFont(24f); // set font size // font2 = new TrueTypeFont(awtFont2, antiAlias); // // } catch (Exception e) { // e.printStackTrace(); // } }
/** * Initialise resources */ public void init() { // load a default java font Font awtFont = new Font("Consolas", Font.BOLD, 24); font = new TrueTypeFont(awtFont, antiAlias); // load font from file try { InputStream inputStream = ResourceLoader.getResourceAsStream("myfont.ttf"); Font awtFont2 = Font.createFont(Font.TRUETYPE_FONT, inputStream); awtFont2 = awtFont2.deriveFont(24f); // set font size font2 = new TrueTypeFont(awtFont2, antiAlias); } catch (Exception e) { e.printStackTrace(); font2 = font; } }
public TooltipText(TrueTypeFont ttf_, String text_, String tooltip_, Color color_, Pair<Float> pos_) { this.ttf = ttf_; this.text = text_; this.tooltip = tooltip_; this.color = color_; this.pos = pos_; }
public Inventory(float x, float y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; slots = new SlotItem[width * height]; int widthIndex = 0; int heightIndex = 0; for(int i = 0; i < width * height; i++) { slots[i] = new SlotItem(i, widthIndex * 22F, heightIndex * 22F); widthIndex++; if(widthIndex == width) { heightIndex++; widthIndex = 0; } } ttf = new TrueTypeFont(new Font("Arial", Font.PLAIN, 14), false); }
public TextBox(String font) { try { InputStream inputStream = ResourceLoader.getResourceAsStream(font); Font awtFont = Font.createFont(Font.TRUETYPE_FONT, inputStream); awtFont = awtFont.deriveFont(32f); //font size this.font = new TrueTypeFont(awtFont, false); } catch (Exception e) { e.printStackTrace(); } }
public void changeFont(String font) { try { InputStream inputStream = ResourceLoader.getResourceAsStream(font); Font awtFont = Font.createFont(Font.TRUETYPE_FONT, inputStream); awtFont = awtFont.deriveFont(32f); //font size this.font = new TrueTypeFont(awtFont, false); } catch (Exception e) { e.printStackTrace(); } }
/** * Loads the fonts to be used for drawing text. Default fonts are Helvetica, * KGBlankSpaceSolid and size 12, 18, 30, and 44 feel free to come in here and * change to any font supported by java.awt.Font, or add a font to the font res * folder and modify the loadfonts code or just ask me (adam) to do for you :) * * Takes a few seconds to load font so account for this when you call this * method. Should only be called once while initializing for the first time. */ public static void loadFonts() { // small test fonts Font awtFontSmall = new Font("Helvetica", Font.TRUETYPE_FONT, 12); fontSmall = new TrueTypeFont(awtFontSmall, true); Font awtFontNormal = new Font("Helvetica", Font.TRUETYPE_FONT, 18); fontNormal = new TrueTypeFont(awtFontNormal, true); try { // main game fonts InputStream inputStream = ResourceLoader.getResourceAsStream("res/fonts/KGBlankSpaceSolid.ttf"); InputStream inputStream2 = ResourceLoader.getResourceAsStream("res/fonts/KGBlankSpaceSolid.ttf"); Font awtFontBigger = Font.createFont(Font.TRUETYPE_FONT, inputStream2); awtFontBigger = awtFontBigger.deriveFont(30f); fontBig = new TrueTypeFont(awtFontBigger, true); //Color.white.bind(); Font awtExtraLargeFont = Font.createFont(Font.TRUETYPE_FONT, inputStream); awtExtraLargeFont = awtExtraLargeFont.deriveFont(44f); fontBigger = new TrueTypeFont(awtExtraLargeFont, true); Color.white.bind(); } catch (Exception e) { e.printStackTrace(); } }
/** * A constructor for the text object * @param str the string of text * @param pos the position of the text * @param color the color of the text * @param size the size of the text */ public TextObject(String str, Vector2f pos, Color color, float size) { super(0, 0, 0, pos); super.setType(GameObjectType.TEXT); try { this.str = str; this.color = color; this.size = size; this.font = new TrueTypeFont(Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(Game.getFontPath())).deriveFont(size), true); } catch (FontFormatException | IOException e) { e.printStackTrace(); } }
/** * The constructor. * * @param x The x position of the textbox * @param y The y position of the textbox * @param width The width of the textbox * @param height The height of the textbox */ public Textbox(float x, float y, float width, float height){ super(x, y, width, height); textContainer = new RoundedRectangle(x, y, width, height, 10f); headerContainer = new RoundedRectangle(x, y - 40, 100, 35, 10f); graphicTextLines = new ArrayList<GraphicText>(); textFont = new TrueTypeFont(new java.awt.Font("Calibri", java.awt.Font.PLAIN, 16), false); text = new ArrayList<String>(); header = new ArrayList<String>(); KeyInput.addInputCommand("Run Textbox Action", Input.KEY_ENTER, 0); }
public Footer() { try { settingTEX = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("img/wrench.png")); } catch (IOException e) { e.printStackTrace(); } Font awtFont = new Font("Latha", Font.BOLD, 24); font = new TrueTypeFont(awtFont, false); }
public void setupTextures(){ try { panelBackGroundTEX = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("img/packPanel.png")); System.out.println(panelBackGroundTEX.getHeight()); } catch (IOException e) { e.printStackTrace(); } Font awtFont = new Font("Latha", Font.BOLD, 24); font = new TrueTypeFont(awtFont, false); }
@Override public void init(GameContainer container) throws SlickException { path = new ImageBufferLine(WIDTH, HEIGHT); // Initialize the translate vector centre = new Vector2f((float) WIDTH / 2f, (float) HEIGHT / 2f); // Initialize star catalog if (catalog == null) catalog = new Catalog(); // Draw star background to the image buffer drawStarBackground(); // Initialize the system core ac = new AstrometryCore(); ac.init(); // Initialize last x and y lastx = getX(ac.getCurrent().getData()[0]); lasty = getY(ac.getCurrent().getData()[1]); // Init cross origin = new Cross(centre.x, centre.y, crossdev); // Init fonts starname = new TrueTypeFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 8), true); time = new TrueTypeFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 13), true); // Init GUI if (gui == null) { gui = new GUI(container, WIDTH - GUI.width, 10); } gui.setAstrometryCore(ac); container.getInput().addListener(gui); }
public DepotMenue(boolean visible, String name, int posX, int posY, int width, int height, int textureID, EntityController entityController) { super(visible, name, posX, posY, width, height); this.buildMenuButtons = new ArrayList<UIButton>(); this.textureID = textureID; this.ec = entityController; this.startButtonPosX = super.getPosX() + 70; awtFont = new Font("Times New Roman", Font.PLAIN, 18); //name, style (PLAIN, BOLD, or ITALIC), size this.font = new TrueTypeFont(awtFont, false); //base Font, anti-aliasing true/false DepotMenueVendor.setDepotMenue(this); //buildObj.add(new UISubelement(true, false, "street", this.getPosX() + 10, this.getPosY() + 10, 24, 48)); }
public Gui(ResourceLoader rl) { this.rl = rl; windows = new HashMap<String, GuiWindow>(); awtFont = new Font("Times New Roman", Font.PLAIN, 18); //name, style (PLAIN, BOLD, or ITALIC), size this.font = new TrueTypeFont(awtFont, false); //base Font, anti-aliasing true/false }
@Override public void init(GameContainer gc, final StateBasedGame sbg) throws SlickException { bg = new Image("res/bg.png"); logo = new Image("res/logo.png"); try { awtFontTitle = Game.awtFontTitle.deriveFont(40f); // set font size titleFont = new TrueTypeFont(awtFontTitle, true); awtFont = Game.awtFont.deriveFont(30f); // set font size font = new TrueTypeFont(awtFont, true); } catch (Exception e) { e.printStackTrace(); } IPinput = new TextField(gc, font, 0, 0, 350, 50); IPinput.setBackgroundColor(new Color(0, 0, 0, 50)); IPinput.setBorderColor(Color.transparent); IPinput.setTextColor(Color.white); IPinput.setMaxLength(253); IPinput.setText(Game.prefs.get(Game.pref_lastip, "")); IPinput.setCursorPos(IPinput.getText().length()); nameField = new TextField(gc, font, 0, 0, 350, 50); nameField.setBackgroundColor(new Color(0, 0, 0, 50)); nameField.setBorderColor(Color.transparent); nameField.setTextColor(Color.white); nameField.setMaxLength(20); nameField.setText(Game.prefs.get(Game.pref_playername, Game.default_username)); nameField.setCursorPos(nameField.getText().length()); // Net Game.network = new Network(gc, sbg); }
Notification(String text, int order, Color color, int screenWidth, TrueTypeFont f) { this.text = text; this.color = new Color(color); this.font = f; this.width = font.getWidth(text); this.height = font.getHeight(text); setOrder(order); this.y = desiredY; this.x = screenWidth - (width + PADDING); this.dismissDelay = 5000; this.pullOutDelay = 500; }
/** * {@inheritDoc} */ @Override public void init() { try { setBackground(new Image("res/menu/backgroundScores.png")); addBackButton(); textFont = new TrueTypeFont(new java.awt.Font("Monospaced", java.awt.Font.BOLD, 24), true); } catch (SlickException e) { if (Constants.DEBUG) { e.printStackTrace(); } } updateHighScoreList(); }
/** * {@inheritDoc} */ @Override public void init() { try { setBackground(new Image("res/menu/backgroundEpicWin.png")); textFont = new TrueTypeFont(new Font("Monospaced", Font.BOLD, 32), true); } catch (SlickException e) { if (Constants.DEBUG) { e.printStackTrace(); } } input.addKeyListener(new keyPressListener()); }
public ArrayList<TrueTypeFont> InitFontLists(ArrayList<Player> playerliste,ArrayList<TrueTypeFont> pliste) { for(int i=0;i<playerliste.size();i++) pliste.add(new TrueTypeFont(new Font(Variables.letter, Variables.font, Variables.charsize), true)); return pliste; }
public void RenderSidebar(Graphics g,ArrayList<Player> playerliste,ArrayList<TrueTypeFont> pliste) { g.setColor(Variables.lightGray); g.fillRect(0, 0, Variables.sidebarwidth+1 ,Variables.HEIGHT); for(int i=0; i<playerliste.size(); i++) { if (i < pliste.size()) pliste.get(i).drawString(30, 120+20*i,"-"+playerliste.get(i).getName(), Variables.black); } }
private static TrueTypeFont getFont(int size) { if (!DrawUtil.ttf.containsKey(size)) { Font font = new Font("Verdana", Font.BOLD, size); DrawUtil.ttf.put(size, new TrueTypeFont(font, true)); } return DrawUtil.ttf.get(size); }
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { active = new TrueTypeFont(Fonts.active.getFont(), true); }
public static void load() { Font awtFont = new Font("Calibri", 0, 18); font = new TrueTypeFont(awtFont, true); }
@Override public void Load() { VERDANA = new TrueTypeFont(new Font("Verdana", Font.PLAIN, 12), false); }
public EntityItem(String UUID, float x, float y, ItemActual item, World world) { super(UUID, x, y, world); this.item = item; this.world = world; this.collisionBox.x = 0; this.collisionBox.y = 0; this.collisionBox.width = 8; this.collisionBox.height = 8; ttf = new TrueTypeFont(new Font("Arial", Font.PLAIN, 7), false); }
public static TrueTypeFont print18() { return printLabel; }
public static TrueTypeFont print28() { return printHead; }