clang-tidy (amb el fuck de que no feien bona parella el clang de macos i el tidy de llvm)
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
#include <SDL3/SDL.h> // Para SDL_FRect, Uint8, SDL_GetRenderTarget, SDL_RenderClear, SDL_SetRenderDrawColor, SDL_SetRenderTarget, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_TextureAccess, SDL_GetTextureAlphaMod
|
||||
|
||||
#include <fstream> // Para basic_ifstream, basic_istream, basic_ostream, operator<<, istream, ifstream, istringstream
|
||||
#include <fstream> // Para basic_ifstream, basic_istream, basic_ostream, operator<<, istream, ifstream, istringstream
|
||||
#include <utility> // Para std::cmp_less_equal
|
||||
#include <iostream> // Para cerr
|
||||
#include <sstream> // Para basic_istringstream
|
||||
#include <stdexcept> // Para runtime_error
|
||||
@@ -32,7 +33,7 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::string& text_file
|
||||
}
|
||||
|
||||
// Crea los objetos
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){0, 0, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
|
||||
|
||||
// Inicializa variables
|
||||
fixed_width_ = false;
|
||||
@@ -50,7 +51,7 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::shared_ptr<Text::
|
||||
}
|
||||
|
||||
// Crea los objetos
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){0, 0, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
|
||||
|
||||
// Inicializa variables
|
||||
fixed_width_ = false;
|
||||
@@ -71,8 +72,8 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::shared_ptr<Textur
|
||||
}
|
||||
|
||||
// Crea los objetos
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){0, 0, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
white_sprite_ = std::make_unique<Sprite>(white_texture, (SDL_FRect){0, 0, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
|
||||
white_sprite_ = std::make_unique<Sprite>(white_texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
|
||||
|
||||
// Inicializa variables
|
||||
fixed_width_ = false;
|
||||
@@ -90,8 +91,8 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::shared_ptr<Textur
|
||||
}
|
||||
|
||||
// Crea los objetos
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){0, 0, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
white_sprite_ = std::make_unique<Sprite>(white_texture, (SDL_FRect){0, 0, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
|
||||
white_sprite_ = std::make_unique<Sprite>(white_texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
|
||||
|
||||
// Inicializa variables
|
||||
fixed_width_ = false;
|
||||
@@ -125,10 +126,10 @@ void Text::write2X(int x, int y, const std::string& text, int kerning, int lengt
|
||||
|
||||
if (INDEX < offset_.size()) {
|
||||
SDL_FRect rect = {
|
||||
static_cast<float>(offset_[INDEX].x),
|
||||
static_cast<float>(offset_[INDEX].y),
|
||||
static_cast<float>(box_width_),
|
||||
static_cast<float>(box_height_)};
|
||||
.x = static_cast<float>(offset_[INDEX].x),
|
||||
.y = static_cast<float>(offset_[INDEX].y),
|
||||
.w = static_cast<float>(box_width_),
|
||||
.h = static_cast<float>(box_height_)};
|
||||
|
||||
sprite_->getTexture()->render(x + shift, y, &rect, 2.0F, 2.0F);
|
||||
shift += (offset_[INDEX].w + kerning) * 2;
|
||||
@@ -257,7 +258,7 @@ void Text::writeStrokeWithAlpha(int x, int y, const std::string& text, int kerni
|
||||
|
||||
// Renderiza stroke sin alpha (sólido) en textura temporal
|
||||
Color solid_color = Color(stroke_color.r, stroke_color.g, stroke_color.b, 255);
|
||||
for (int dist = 1; dist <= shadow_distance; ++dist) {
|
||||
for (int dist = 1; std::cmp_less_equal(dist, shadow_distance); ++dist) {
|
||||
for (int dy = -dist; dy <= dist; ++dy) {
|
||||
for (int dx = -dist; dx <= dist; ++dx) {
|
||||
writeColoredWithSprite(stroke_sprite, shadow_distance + dx, shadow_distance + dy, text, solid_color, kerning, length);
|
||||
@@ -296,7 +297,7 @@ void Text::renderShadow(int x, int y, const std::string& text, Color shadow_colo
|
||||
|
||||
// Renderiza stroke sólido (método tradicional para stroke sin alpha)
|
||||
void Text::renderSolidStroke(int x, int y, const std::string& text, Color stroke_color, int kerning, int length, Uint8 shadow_distance) {
|
||||
for (int dist = 1; dist <= shadow_distance; ++dist) {
|
||||
for (int dist = 1; std::cmp_less_equal(dist, shadow_distance); ++dist) {
|
||||
for (int dy = -dist; dy <= dist; ++dy) {
|
||||
for (int dx = -dist; dx <= dist; ++dx) {
|
||||
if (white_sprite_) {
|
||||
|
||||
Reference in New Issue
Block a user