mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 10:55:57 -04:00
Add outline to font demo
This commit is contained in:
parent
31c68423fc
commit
7d00d3bbb2
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user