From 7d00d3bbb21524eca1d0d9d703e65185c61afd75 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Mon, 29 Dec 2014 21:38:38 +0300 Subject: [PATCH] Add outline to font demo --- examples/ttf.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/ttf.cc b/examples/ttf.cc index 6f59c66..43cf3c4 100644 --- a/examples/ttf.cc +++ b/examples/ttf.cc @@ -39,15 +39,19 @@ int Run() { Window window("libSDL2pp demo: font", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE); Renderer render(window, -1, SDL_RENDERER_ACCELERATED); - Font font(TESTDATA_DIR "/Vera.ttf", 20); + Font font(TESTDATA_DIR "/Vera.ttf", 30); Surface solid = font.RenderText_Solid("Hello, world! (solid mode)", SDL_Color({255, 255, 255, 255})); Surface shaded = font.RenderText_Shaded("Hello, world! (shaded mode)", SDL_Color({255, 255, 255, 255}), SDL_Color({127, 127, 127, 255})); Surface blended = font.RenderText_Blended("Hello, world! (blended mode)", SDL_Color({255, 255, 255, 255})); + font.SetOutline(1); + Surface outline = font.RenderText_Blended("Hello, world! (blended + outline)", SDL_Color({255, 255, 255, 255})); + Texture solid_tex(render, solid); Texture shaded_tex(render, shaded); Texture blended_tex(render, blended); + Texture outline_tex(render, outline); while (1) { // Process input @@ -69,6 +73,9 @@ int Run() { h += shaded.Get()->h; render.Copy(blended_tex, NullOpt, Rect(0, h, blended.GetWidth(), blended.GetHeight())); + h += blended.Get()->h; + + render.Copy(outline_tex, NullOpt, Rect(0, h, outline.GetWidth(), outline.GetHeight())); render.Present();