[DEV] uopdate vector3f and add font config

This commit is contained in:
Edouard DUPIN 2021-05-03 16:55:15 +02:00
parent 48f1500d43
commit d13861cd35
3 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,75 @@
package org.atriasoft.etk;
import java.util.HashMap;
import java.util.Map;
import org.atriasoft.etk.internal.Log;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
public class ConfigFont {
private final Map<String, Uri> fonts = new HashMap<>();
private String name = "FreeSans";
private int size = 12;
public void add(final String string, final Uri uri) {
this.fonts.put(string, uri);
}
public Uri getFontUri(final String fontName) {
Uri out = this.fonts.get(fontName);
if (out == null) {
Log.warning(" try to get unexistant font : " + fontName);
}
return out;
}
/**
* get the current default font name
* @return a reference on the font name string
*/
public String getName() {
return this.name;
}
/**
* get the default font size.
* @return the font size.
*/
public int getSize() {
return this.size;
}
/**
* set the defaut font for all the widgets and basics display.
* @param fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
* @param size The default size of the font default=10.
*/
public void set(final String fontName, final int size) {
this.name = fontName;
this.size = size;
Log.debug("Set default Font : '" + this.name + "' size=" + this.size);
}
/**
* Set the current default font name
* @param fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
*/
public void setName(final String fontName) {
this.name = fontName;
Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change name only)");
}
/**
* Set the default font size.
* @param size new font size.
*/
public void setSize(final int size) {
this.size = size;
Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change size only)");
}
}

View File

@ -0,0 +1,13 @@
package org.atriasoft.etk;
public class Configs {
private static ConfigFont fonts = new ConfigFont();
public static ConfigFont getConfigFonts() {
return fonts;
}
private Configs() {
}
}

View File

@ -582,4 +582,11 @@ public record Vector3f(
public float triple(final Vector3f obj1, final Vector3f obj2) {
return this.x * (obj1.y * obj2.z - obj1.z * obj2.y) + this.y * (obj1.z * obj2.x - obj1.x * obj2.z) + this.z * (obj1.x * obj2.y - obj1.y * obj2.x);
}
public static Vector3f valueOf(final String valuesX, final String valuesY, final String valuesZ) {
float val1 = Float.valueOf(valuesX);
float val2 = Float.valueOf(valuesY);
float val3 = Float.valueOf(valuesZ);
return new Vector3f(val1, val2, val3);
}
}