Létrehoztam az OutTextXY -t hogy használható legyen. Íme:
Procedure OutTextXY(x,y : Sint16; w,h: Uint16; S:String);
Var k : TSDL_Rect;
P : PChar;
Begin
if TTF_Init = -1 then HALT;
ttfFont := TTF_OpenFont(Betutipus, 70);
TTF_SetFontStyle(ttfFont, TTF_STYLE_NORMAL);
// TTF_STYLE_NORMAL No application of a certain style
// TTF_STYLE_BOLD Set a bold style
// TTF_STYLE_ITALIC Set letters in italics
// TTF_STYLE_UNDERLINE Have the text underlined
// TTF_STYLE_STRIKETHROUGH Have the text stroken through
TTF_SetFontOutline(ttfFont, 1);
TTF_SetFontHinting(ttfFont, TTF_HINTING_NONE);
// TTF_HINTING_NORMAL Normal hinting is applied
// TTF_HINTING_LIGHT Light hinting is applied
// TTF_HINTING_MONO I guess monospaced characters, so all the characters have the same space between each otherwise
// TTF_HINTING_NONE Have the text underlined
//define colors by RGB values
sdlColor1.r := 255; sdlColor1.g := 0; sdlColor1.b := 0;
sdlColor2.r := 0; sdlColor2.g := 255; sdlColor2.b := 255;
P:=@S;
sdlSurface1 := TTF_RenderText_Shaded(ttfFont, P , sdlColor1, sdlColor2);
sdlTexture1 := SDL_CreateTextureFromSurface(sdlRenderer, sdlSurface1);
k.x:=x;
k.y:=y;
k.w:=w;
k.h:=h;
//rendering of the texture
SDL_RenderCopy(sdlRenderer, sdlTexture1, nil, @k);
SDL_RenderPresent(sdlRenderer);
//cleaning procedure
TTF_CloseFont(ttfFont);
TTF_Quit;
End;
Majd meghívom:
Betutipus:='FreeSans.ttf';
OutTextXY(100,200,300,250,'Ez egy próba szöveg');
Íme a "csodálatos eredmény":
Se ékezet.... Ha nagyítom a teületét szétcsúszik.... Használhatatlan.
Miért?