dekyco
February 10, 2010, 3:03pm
1
Hi,
I am trying to make a text input widget by drawing text onto the mask (made as PNG) like this:
apply_surface( SCREEN_WIDTH, SCREEN_HEIGHT, m_text, m_mask );
apply_surface( SCREEN_WIDTH, SCREEN_HEIGHT, m_mask, screen );
but nothing happens when I type.Maybe somebody can give advice on how to do this?
dekyco
JonnyD
February 10, 2010, 3:32pm
2
Does the mask have an alpha channel? You might have to disable alpha
blending with SDL_SetAlpha() in order to combine surfaces with alpha
channels. If you don’t, SDL will use the destination alpha. Of course,
re-enable it after the blit.
Jonny DOn Wed, Feb 10, 2010 at 10:03 AM, dekyco wrote:
Hi,
I am trying to make a text input widget by drawing text onto the mask (made
as PNG) like this:
apply_surface( SCREEN_WIDTH, SCREEN_HEIGHT, m_text, m_mask );
apply_surface( SCREEN_WIDTH, SCREEN_HEIGHT, m_mask, screen );
but nothing happens when I type.Maybe somebody can give advice on how to do
this?
dekyco
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
dekyco
February 10, 2010, 5:35pm
3
Thank you Jonny,
I would appriciate some example for this if you don’t mind
dekyco
mandarx
February 11, 2010, 1:00am
4
dekyco wrote:
apply_surface( SCREEN_WIDTH, SCREEN_HEIGHT, m_text, m_mask );
apply_surface( SCREEN_WIDTH, SCREEN_HEIGHT, m_mask, screen );
nothing happens…
Hi
is apply_surface like this?
void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination )
{
SDL_Rect offset;
offset.x = x;
offset.y = y;
SDL_BlitSurface( source, NULL, destination, &offset );
}
you have to call it using the right x and y !!!
try with:
apply_surface( 0, 0, m_text, m_mask );
apply_surface( 0, 0, m_mask, screen );
of course you must upload the screen using
SDL_Flip( screen );
MandarX------------------------
http://mandarx.xoom.it/index.php?lang=eng