This is a sample library which allows you to use TrueType fonts in your SDL applications. It comes with an example program "showfont" which displays an example string for a given TrueType font file.
Questions tagged [sdl-ttf]
208 questions
0
votes
1 answer
c++ SDL draw text and figures together
I am doing a big project and I want to show user the information which looks nice.
All that I need it's to be able to draw square and text inside.
I drew text and squares, but I cannot put them together. I even detected a place where problem is. …

Tebe
- 3,176
- 8
- 40
- 60
-1
votes
1 answer
SDL Transfer texture using SDL_TEXTUREACCESS_STREAMING
I'm using SDL2 with SDL_TEXTUREACCESS_STREAMING without OpenGL and I want to transfer/combine some Textures from my function to my main loop. So, I decided to change my Access type from STREAMING to TARGET, use SDL_SetRenderTarget with…
-1
votes
2 answers
SDL_CreateTextureFromSurface crashes after using strcpy, strcat, sprintf, etc. in C
I want to write some text on the screen. For this purpose I'm using this code:
TTF_Font* font = TTF_OpenFont("arial.ttf", 15);
SDL_Color text_color = { 255, 255, 255 };
SDL_Surface* text_surface = TTF_RenderText_Blended_Wrapped(font, "inventory",…

CraigsCraig
- 39
- 3
-1
votes
1 answer
Is it possible to scale glyphs without having them move out of line?
I recently have been trying to implement text rendering using glyphs in my game. I have been able to render them onto the screen, but I want to be able to scale them without having them move out of the current line that is being rendered.
For…

Cyerunix
- 71
- 11
-1
votes
1 answer
c++ sdl2 text does not render
I have a program which contains a class that I can't figure out how to make it work. When I make the code run without "errors" it does not show any text on screen.
I have an object from this class on my main loop, where I render it. Calling the…

ovni jeroqui
- 27
- 7
-1
votes
1 answer
Custom font class crashes game
I'm using C++ with the SDL2 library to create a game. I'm using the SDL_ttf extension to be able to use ttf fonts and I'm trying to create my own class that would be more effective for multiple texts on the screen. The code I currently have starts…

Vince
- 2,596
- 11
- 43
- 76
-1
votes
1 answer
Redrawing text using sdl/ttf
I am displaying a variable "budget" of which the value can change. I want to display the current value of "budget" on my screen.
Here are my relevant code snippets:
else if (display_list_incredients) {
Csurface::OnDraw(surf_display,…

Barb
- 29
- 2
- 6
-1
votes
1 answer
SDL_ttf and using function
In SDL programming in c++ (I write codes in Ubuntu Linux), for drawing a text on the screen, I made a function and the second argument of it, gets the text. The type of it, is char*.
In the main function, what should I send to the above function for…

Amir Havangi
- 45
- 8
-1
votes
1 answer
SDL Resetting Surfaces
I draw some text to a surface (using SDL_ttf) and then I want to change the text on the surface. If I just redraw the surface the text does not go away. I have looked at several forum posts on how to fix the problem but I just cannot seem to figure…

Beetroot
- 701
- 6
- 12
-2
votes
1 answer
std::map contains value from last instance before it's told to store said value
So recently I was experimenting with some code and found an incredibly strange error. I've created an std::map for storing fonts for my program. However, through a long session of debugging, I managed to find out that this map was storing a value…

Cyerunix
- 71
- 11
-2
votes
2 answers
Segmentation fault before function entry?
UPDATE:Check my answer for details, pointer error.
I have a function, that is supposed to load a few test assets and blit them onto screen using SDL2. This function throws a segfault immediately before executing any commands, with no clear cause.…

jfkjsu3v95
- 3
- 4
-2
votes
2 answers
How to print out text (SDL_TTF) from an array?
I posted parts of my code that I think are relevent. I'm trying to draw out some text via SDL_TTF for my menu. I'm getting a string of char from the server everytime i clicked on a button. Something like "I1P1I2P1I3P1I4P1I5P1I6P1I7P1I8P1I9P1" "I1"…

xxFlashxx
- 261
- 2
- 13