MCPcopy Create free account
hub / github.com/SFML/SFML / addLineHorizontal

Function addLineHorizontal

src/SFML/Graphics/Text.cpp:51–69  ·  view source on GitHub ↗

Add a horizontal underline or strikethrough line to the vertex array

Source from the content-addressed store, hash-verified

49{
50// Add a horizontal underline or strikethrough line to the vertex array
51void addLineHorizontal(sf::VertexArray& vertices,
52 float lineLeft,
53 float lineRight,
54 float lineTop,
55 sf::Color color,
56 float offset,
57 float thickness,
58 float outlineThickness = 0)
59{
60 const float top = std::floor(lineTop + offset - (thickness / 2) + 0.5f);
61 const float bottom = top + std::floor(thickness + 0.5f);
62
63 vertices.append({{lineLeft - outlineThickness, top - outlineThickness}, color, {1.0f, 1.0f}});
64 vertices.append({{lineRight + outlineThickness, top - outlineThickness}, color, {1.0f, 1.0f}});
65 vertices.append({{lineLeft - outlineThickness, bottom + outlineThickness}, color, {1.0f, 1.0f}});
66 vertices.append({{lineLeft - outlineThickness, bottom + outlineThickness}, color, {1.0f, 1.0f}});
67 vertices.append({{lineRight + outlineThickness, top - outlineThickness}, color, {1.0f, 1.0f}});
68 vertices.append({{lineRight + outlineThickness, bottom + outlineThickness}, color, {1.0f, 1.0f}});
69}
70
71// Add a vertical strikethrough line to the vertex array
72void addLineVertical(sf::VertexArray& vertices,

Callers 1

ensureGeometryUpdateMethod · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected