afegit sistema de punts
This commit is contained in:
@@ -181,7 +181,7 @@ bool VectorText::is_supported(char c) const {
|
||||
return chars_.find(c) != chars_.end();
|
||||
}
|
||||
|
||||
void VectorText::render(const std::string& text, const Punt& posicio, float escala, float spacing) {
|
||||
void VectorText::render(const std::string& text, const Punt& posicio, float escala, float spacing, float brightness) {
|
||||
if (!renderer_) {
|
||||
return;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ void VectorText::render(const std::string& text, const Punt& posicio, float esca
|
||||
// Ajustar Y para que posicio represente esquina superior izquierda
|
||||
// (render_shape espera el centro, así que sumamos la mitad de la altura)
|
||||
Punt char_pos = {current_x, posicio.y + char_height_scaled / 2.0f};
|
||||
Rendering::render_shape(renderer_, it->second, char_pos, 0.0f, escala, true);
|
||||
Rendering::render_shape(renderer_, it->second, char_pos, 0.0f, escala, true, 1.0f, brightness);
|
||||
|
||||
// Avanzar posición
|
||||
current_x += char_width_scaled + spacing_scaled;
|
||||
|
||||
@@ -24,7 +24,8 @@ class VectorText {
|
||||
// - posicio: posición inicial (esquina superior izquierda)
|
||||
// - escala: factor de escala (1.0 = 20×40 px por carácter)
|
||||
// - spacing: espacio entre caracteres en píxeles (a escala 1.0)
|
||||
void render(const std::string& text, const Punt& posicio, float escala = 1.0f, float spacing = 2.0f);
|
||||
// - brightness: factor de brillantor (0.0-1.0, default 1.0 = màxima brillantor)
|
||||
void render(const std::string& text, const Punt& posicio, float escala = 1.0f, float spacing = 2.0f, float brightness = 1.0f);
|
||||
|
||||
// Calcular ancho total de un string (útil para centrado)
|
||||
float get_text_width(const std::string& text, float escala = 1.0f, float spacing = 2.0f) const;
|
||||
|
||||
Reference in New Issue
Block a user