[SDL] color+alpha blit?

Albert Cahalan albert at users.sf.net
Wed Jan 19 14:36:44 PST 2005


>From the code you posted, you haven't yet blitted your newly-text-filled
"text_surface" to the screen yet. After blitting it to the screen, you'll
need to call either SDL_Flip or SDL_UpdateRect(s). Hope that helps.
-Dave

----- Original Message ----- 
From: "Mark" <wilkinson.m at btopenworld.com>
To: <sdl at libsdl.org>
Sent: Monday, January 03, 2005 9:12 AM
Subject: [SDL] SDL_ttf - a newbies question


> Hi,
>
> This is my first post here as I'm just beginning to learn SDL.  I've got
SDL and
> SDL_ttf installed, and (thanks to some great tutorials) I'm able to set up
SDL
> Video and SDL_ttf as follows:
>
> if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
>             printf("Unable to init SDL: %s\n", SDL_GetError());
>
>
>         screen = SDL_SetVideoMode(1024, 768, 16, SDL_SWSURFACE);
>
>
> if ( screen == NULL )
>             printf("Unable to set 1024x768 video: %s\n", SDL_GetError());
>
> if(TTF_Init()==-1)
>         printf("TTF_Init: %s\n", TTF_GetError());
>
> font=TTF_OpenFont("VeraSe.ttf", 16);
>
> if(!font)
>       printf("TTF_OpenFont: %s\n", TTF_GetError());
>
>
> All this (appears to) work ok, everything is initialised and a black
window of
> 1024x768 appears.  However, when it comes to writing text onto the screen,
I use
> this:
>
>     if(!(text_surface=TTF_RenderText_Solid(font,"Hello World!",clrWhite)))
>     {
> //handle error here, perhaps print TTF_GetError at least
> printf("SDL_ttf Error, %s\n", TTF_GetError());
>     }
>
> clrWhite is defined as 'SDL_Color clrWhite = {255,255,255,0};'
>
> Is there something else I need to be doing before the text is displayed on
> screen?  At the moment the screen stays resolutely blank.  Hope someone
can help.
>
> Mark
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>




More information about the SDL mailing list