|
|
|
@ -36,6 +36,40 @@ pub fn DrawAndMeasureText(
|
|
|
|
|
.height = 10, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
pub fn DrawAndMeasureTextEx( |
|
|
|
|
font: rl.Font, |
|
|
|
|
text: [*c]const u8, |
|
|
|
|
pos_x: f32, |
|
|
|
|
pos_y: f32, |
|
|
|
|
font_size: f32, |
|
|
|
|
spacing: f32, |
|
|
|
|
color: rl.Color, |
|
|
|
|
) rl.Vector2 { |
|
|
|
|
rl.DrawTextEx(font, text, rl.Vector2 { .x = pos_x, .y = pos_y }, font_size, spacing, color); |
|
|
|
|
return rl.MeasureTextEx(font, text, font_size, spacing); |
|
|
|
|
} |
|
|
|
|
pub fn DrawRightAlignedText( |
|
|
|
|
text: [*c]const u8, |
|
|
|
|
pos_x: c_int, |
|
|
|
|
pos_y: c_int, |
|
|
|
|
font_size: c_int, |
|
|
|
|
color: rl.Color, |
|
|
|
|
) void { |
|
|
|
|
const width = rl.MeasureText(text, font_size); |
|
|
|
|
rl.DrawText(text, pos_x - width, pos_y, font_size, color); |
|
|
|
|
} |
|
|
|
|
pub fn DrawRightAlignedTextEx( |
|
|
|
|
font: rl.Font, |
|
|
|
|
text: [*c]const u8, |
|
|
|
|
pos_x: f32, |
|
|
|
|
pos_y: f32, |
|
|
|
|
font_size: f32, |
|
|
|
|
spacing: f32, |
|
|
|
|
color: rl.Color, |
|
|
|
|
) void { |
|
|
|
|
const width = rl.MeasureTextEx(font, text, font_size, spacing).x; |
|
|
|
|
rl.DrawTextEx(font, text, .{ .x = pos_x - width, .y = pos_y }, font_size, spacing, color); |
|
|
|
|
} |
|
|
|
|
pub fn GetKeyPressed() ?c_int { |
|
|
|
|
const result = rl.GetKeyPressed(); |
|
|
|
|
return if (result == 0) |
|
|
|
|