![]() |
SDL_ttf and SDL_gfx in SDL 2 | ![]() |
wahono sri
Guest
![]() |
![]() |
Hi all,
I'm new user of SDL, and before start using SDL, I have some question to ensure the features as I hope. - Is SDL_ttf and SDL_gfx is compatible with SDL 2? - Is SDL_ttf and SDL_gfx use hardware rendering because as I read in http://wiki.libsdl.org/moin.cgi/MigrationGuide, only using textures will use hardware rendered, and SDL_ttf/SDL_gfx use surfaces to drawing? Thanks in advance. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||
|
![]() |
SDL_ttf and SDL_gfx in SDL 2 | ![]() |
Andreas Schiffler
Guest
![]() |
![]() |
SDL_gfx is not compatible with SDL2. It works fine with SDL-1.2 but does
for the most part not leverage any hardware acceleration. --Andreas On 8/17/2012 8:25 PM, wahono sri wrote:
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
Re: SDL_ttf and SDL_gfx in SDL 2 | ![]() |
stevo5800
![]() |
![]() |
SDL_ttf is compatible you might need to download it from Mercurial to get the latest. Everything is pretty much the same you just need to convert the SDL_Surface to SDL_Texture with
example: SDL_Texture *textTexture char buf[256] SDL_Color foregroundColor = { 255, 255, 255 }; SDL_Color backgroundColor = { 0, 0, 0 }; SDL_Rect TextLoacation; snprintf(buf,256,"TESTING"); SDL_Surface *textSurface= TTF_RenderText_Shaded(font, buf, foregroundColor, backgroundColor); if(textSurface) { textTexture = SDL_CreateTextureFromSurface(renderer, textSurface); TextLocation.h = textSurface->h; TextLocation.w = textSurface->w; TextLocation.x = 100; TextLocation.y = 100; } //free surface SDL_FreeSurface(textSurface); SDL_RenderCopy(renderer, textTexture, NULL, TextLocation);
|
||||||||||||
|
![]() |
SDL_ttf and SDL_gfx in SDL 2 | ![]() |
MrOzBarry
![]() |
![]() |
You'll have to do a custom compile of SDL_ttf with SDL2 installed - in my case (without SDL 1.2 installed in mingw, which should be roughly the same on linux), it was literally me doing an hg clone of SDL2, ./configure && make && sudo make install, then going into SDL2, ./configure (confirm that it does get SDL2 in there) && make && sudo make install
Note that instead of building SDL_ttf, with SDL2 it will build SDL2_ttf - I am assuming that this is the general naming convention that Sam would like to see with other SDL contrib. libraries (compatible with SDL 1.2 = SDL_*, SDL2 = SDL2_*) As far as I'm aware, SDL_gfx needs to be updated to deal with SDL2 properly - Andreas mentioned in another thread that he's planning on working on an SDL2-compatible version. Take care, -Alex On Sat, Aug 18, 2012 at 4:06 AM, stevo5800 wrote:
|
||||||||||||
|
![]() |
SDL_ttf and SDL_gfx in SDL 2 | ![]() |
![]() |
SDL_ttf and SDL_gfx in SDL 2 | ![]() |
Jonny D
![]() |
![]() |
Cairo is fundamentally different than SDL_gfx and certainly more complicated than the combination of SDL_gfx and SDL_ttf. It's vector-based rather than raster-based. It does work with SDL with a little effort. In my experience, performance is not great, but if you use a OpenGL/SDL2 backend, it is probably a lot better.
Jonny D |
||||||||||
|