some questions ( SDL )

Started by
0 comments, last by Lazy Foo 17 years, 4 months ago
1) I use SDL and I have a 16 x 16 pixel .GIF image with 2 frames. The problem is that when I load that file in my game, the image only shows up with a single frame. Is there a way to display the sprite with the 2 frame animation in the game? Also, if I resize the .gif image it automatically loses the second frame, so it's no longer an animated gif. Is there a fix to that? 2) In SDL, how can I display text on the screen in more than one line in case it all doesn't fit on that single line? example: production = TTF_RenderText_Solid(font, " A M a n I n T h e B o x Production", textColor); apply_surface(5, 25, production, screen); say that only "A M a n I n T h " fits in one horizontal line on the screen, how can I skip a line and continue the message on the same background? Thanks.
Advertisement
1) I'd split the animation into individual frame images using imageready.

2) Short Answer : SDL_ttf doesn't have the functions built it. You'll have to chop it up yourself.

Long Answer: Or you can take at look at my bitmap font tutorial to see how to make a bitmap font engine. Instead of having an array of clipped sprites, you can have an array of surfaces by rendering each letter individually. If you understand how text is made from individual character surfaces it shouldn't be too hard to add word wrap to a fonting engine like mine.

Learn to make games with my SDL 2 Tutorials

This topic is closed to new replies.

Advertisement