Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 |
void CText::Init(const string sText) { m_Text = sText.c_str(); m_pFont = TTF_OpenFont("arial.ttf", 18); m_Color.r = 200; m_Color.g = 0; m_Color.b = 0; m_Color.unused = 0; *m_pText = TTF_RenderText_Solid(m_pFont, m_Text.c_str(), m_Color); <---- ERROR } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
bool SDL_ApplyText(char text[],char fontname[],int fontsize,SDL_Surface *dst,int x, int y, short int r, short int g,short int b) { SDL_Color fgcolor = {r,g,b}; SDL_Rect offset; offset.x = x; offset.y = y; TTF_Font *font = NULL; SDL_Surface *textsurface = NULL; font = TTF_OpenFont(fontname,fontsize); textsurface = TTF_RenderText_Solid(font,text,fgcolor); SDL_BlitSurface(textsurface,NULL,dst,&offset); SDL_FreeSurface(textsurface); TTF_CloseFont(font); return true; } |
C-/C++-Quelltext |
|
1 |
SDL_ApplyText("Hello World!","arial.ttf",28,screen,2,2,255,255,255); |
Werbeanzeige