Exemplo n.º 1
0
        private static IntPtr MakeTextSurface(string message)
        {
            SDL_ttf.TTF_Init();
            var font = SDL_ttf.TTF_OpenFont(ArialFontFilename(), 128);

            if (font == IntPtr.Zero)
            {
                throw new Exception($"Could not initialize font: {SDL_GetError()}");
            }

            var color = new SDL_pixels.SDL_Color {
                r = 255, g = 255, b = 255, a = 255
            };
            var surface = SDL_ttf.TTF_RenderText_Solid(font,
                                                       message, color);

            SDL_ttf.TTF_CloseFont(font);
            SDL_ttf.TTF_Quit();

            return(surface);
        }
Exemplo n.º 2
0
 public static IntPtr TTF_RenderText_Solid(IntPtr font, string text, SDL_pixels.SDL_Color foreground) => s_TTF_RenderText_Solid_IntPtr_IntPtr_color__t(font, Util.StringToHGlobalUTF8(text), foreground);