TXT_* → static constexpr Text::FLAG_*
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include <string> // for basic_string, char_traits, string
|
||||
|
||||
#include "core/input/mouse.hpp" // for Mouse::cursorVisible, Mouse::lastMouseMoveTime
|
||||
#include "core/rendering/text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_STROKE
|
||||
#include "core/rendering/text.h" // for Text
|
||||
#include "core/resources/resource.h"
|
||||
#include "game/defaults.hpp" // for GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT
|
||||
#include "game/options.hpp" // for Options::video, Options::settings
|
||||
@@ -438,7 +438,7 @@ void Screen::renderNotification() {
|
||||
if (notification_text_ == nullptr || SDL_GetTicks() >= notification_end_time_) {
|
||||
return;
|
||||
}
|
||||
notification_text_->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE,
|
||||
notification_text_->writeDX(Text::FLAG_CENTER | Text::FLAG_COLOR | Text::FLAG_STROKE,
|
||||
game_canvas_width_ / 2,
|
||||
notification_y_,
|
||||
notification_message_,
|
||||
|
||||
@@ -186,10 +186,10 @@ void Text::writeCentered(int x, int y, const std::string &text, int kerning, int
|
||||
|
||||
// Escribe texto con extras
|
||||
void Text::writeDX(Uint8 flags, int x, int y, const std::string &text, int kerning, Color text_color, Uint8 shadow_distance, Color shadow_color, int lenght) {
|
||||
const bool CENTERED = ((flags & TXT_CENTER) == TXT_CENTER);
|
||||
const bool SHADOWED = ((flags & TXT_SHADOW) == TXT_SHADOW);
|
||||
const bool COLORED = ((flags & TXT_COLOR) == TXT_COLOR);
|
||||
const bool STROKED = ((flags & TXT_STROKE) == TXT_STROKE);
|
||||
const bool CENTERED = ((flags & Text::FLAG_CENTER) == Text::FLAG_CENTER);
|
||||
const bool SHADOWED = ((flags & Text::FLAG_SHADOW) == Text::FLAG_SHADOW);
|
||||
const bool COLORED = ((flags & Text::FLAG_COLOR) == Text::FLAG_COLOR);
|
||||
const bool STROKED = ((flags & Text::FLAG_STROKE) == Text::FLAG_STROKE);
|
||||
|
||||
if (CENTERED) {
|
||||
x -= (Text::lenght(text, kerning) / 2);
|
||||
|
||||
@@ -9,15 +9,15 @@ class Sprite;
|
||||
class Texture;
|
||||
#include "utils/utils.h"
|
||||
|
||||
// Opciones de texto
|
||||
constexpr int TXT_COLOR = 1;
|
||||
constexpr int TXT_SHADOW = 2;
|
||||
constexpr int TXT_CENTER = 4;
|
||||
constexpr int TXT_STROKE = 8;
|
||||
|
||||
// Clase texto. Pinta texto en pantalla a partir de un bitmap
|
||||
class Text {
|
||||
public:
|
||||
// Flags bitmask para writeDX
|
||||
static constexpr int FLAG_COLOR = 1;
|
||||
static constexpr int FLAG_SHADOW = 2;
|
||||
static constexpr int FLAG_CENTER = 4;
|
||||
static constexpr int FLAG_STROKE = 8;
|
||||
|
||||
struct Offset {
|
||||
int x; // Posición X dentro del bitmap
|
||||
int y; // Posición Y dentro del bitmap
|
||||
|
||||
Reference in New Issue
Block a user