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
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ pub const Font = struct {
c.TTF_CloseFont(self.font); 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); var cText = @ptrCast([*c]const u8, text);
if (c.TTF_RenderUTF8_Blended(self.font, cText, @bitCast(c.SDL_Color, color))) |surface| { if (c.TTF_RenderUTF8_Blended(self.font, cText, @bitCast(c.SDL_Color, color))) |surface| {
return sdl.Surface{ .surface = @ptrCast(*sdl.c.SDL_Surface, surface) }; return sdl.Surface{ .surface = @ptrCast(*sdl.c.SDL_Surface, surface) };