MCPcopy Create free account
hub / github.com/crownengine/crown / draw_string

Function draw_string

src/device/graph.cpp:54–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52};
53
54static void draw_string(DebugLine &dl, const char *str, float x, float y)
55{
56 u8 table[256] = {0};
57 // HGFEDCBA
58 table[' '] = 0b00000000;
59 table['0'] = 0b00111111;
60 table['1'] = 0b00000011;
61 table['2'] = 0b01101101;
62 table['3'] = 0b01100111;
63 table['4'] = 0b01010011;
64 table['5'] = 0b01110110;
65 table['6'] = 0b01111110;
66 table['7'] = 0b00100011;
67 table['8'] = 0b01111111;
68 table['9'] = 0b01110111;
69 table['.'] = 0b10000000;
70 table['-'] = 0b01000000;
71 table['a'] = 0b01111011;
72 table['b'] = 0b01011110;
73 table['c'] = 0b00111100;
74 table['d'] = 0b01001111;
75 table['e'] = 0b01111100;
76 table['f'] = 0b01111000;
77 table['A'] = table['a'];
78 table['B'] = table['b'];
79 table['C'] = table['c'];
80 table['D'] = table['d'];
81 table['E'] = table['e'];
82 table['F'] = table['f'];
83
84 Vector3 advance;
85 advance.x = x;
86 advance.y = y;
87 advance.z = 0.0f;
88 for (const char *ch = str; *ch; ++ch) {
89 for (int i = 0; i < 8; ++i) {
90 if ((table[(int)*ch] & (1 << i)) != 0)
91 dl.add_line((32.0f * segments[i][0]) + advance, (32.0f * segments[i][1]) + advance, COLOR4_YELLOW);
92 }
93 float x_adv = 32.0f*SEGMENTS_ASPECT_RATIO;
94 advance.x += *ch != '.' ? x_adv*1.2f : x_adv*0.2f;
95 }
96}
97
98struct ColorInfo
99{

Callers 1

drawMethod · 0.85

Calls 1

add_lineMethod · 0.80

Tested by

no test coverage detected