Make renderblended expect a 0-terminated string

This commit is contained in:
Sijmen 2020-05-22 22:40:03 +02:00
parent 657e42cead
commit b46b744d71
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48

View file

@ -36,7 +36,7 @@ pub const Font = struct {
c.TTF_CloseFont(self.font);
}
pub fn renderBlended(self: Font, text: []const u8, color: sdl.Color) !sdl.Surface {
pub fn renderBlended(self: Font, text: [:0]const u8, color: sdl.Color) !sdl.Surface {
var cText = @ptrCast([*c]const u8, text);
if (c.TTF_RenderUTF8_Blended(self.font, cText, @bitCast(c.SDL_Color, color))) |surface| {
return sdl.Surface{ .surface = @ptrCast(*sdl.c.SDL_Surface, surface) };