xm_player/src/widget/label.cpp

33 lines
766 B
C++

#include "widget/label.hpp"
#include "ta_parameter.hpp"
#include "graphics_primitive.hpp"
namespace widget {
const static float label_depth = 1.0 / 5.0;
const static int label_color = 0xa7a7a7;
const static float label_shadow_depth = 1.0 / 6.0;
const static int label_shadow_color = 0x000000;
void label::draw_label(ta_parameter_writer& writer) const
{
float y_offset = 0;
float cx = x() + width / 2 - (glyph::hori_advance * value_length) / 2;
float cy = y() + height / 2 - glyph::vert_advance / 2 + y_offset;
transfer_string(writer, value, cx, cy, label_depth, label_color);
}
void label::draw(ta_multiwriter& multi)
{
transfer_global_polygon_glyph(multi.pt);
draw_label(multi.pt);
widget::draw(multi);
}
}