Quoting Pierre-Hugues Husson:
> PS:Is there any xsnow alike application for directfb? :)

I don't know of any, but it could be easily implemented.
Just tell me if you like to know about the different ways
and their pros and contras.

> +DFBResult lite_set_button_text(LiteButton       *button,
> +                             int size,
> +                             char *font_name,
> +                             char *text)
> +{
> +    IDirectFBSurface *surface=button->box.surface;

You can't take the output surface of the widget here, to...

> +    IDirectFBFont *font_interface;
> +    LiteFont *font;
> +    DFBResult ret;
> +    DFBSurfaceTextFlags flags=DSTF_TOP|DSTF_LEFT;
> +
> +    ret=lite_get_font(font_name, LITE_FONT_PLAIN,size, 
> DEFAULT_FONT_ATTRIBUTE,&font);
> +    if(ret!=DFB_OK)
> +         return DFB_FAILURE;
> +
> +    ret=lite_font(font, &font_interface);
> +    if(ret!=DFB_OK)
> +         return DFB_FAILURE;
> +    surface->SetColor(surface, 0x8F,0x10,0x10,0xFF);
> +    surface->SetFont(surface, font_interface);
> +    surface->DrawString(surface, text,-1,0,0,flags);

...render to it...

> +    button->imgsurface[BS_NORMAL] = surface;
> +    button->imgsurface[BS_DISABLED] = surface;
> +    button->imgsurface[BS_HILITE] = surface;
> +    button->imgsurface[BS_PRESSED] = surface;

...and use it as an input surface later on.



It's much better to store the string somewhere in LiteLabel
and call DrawString() for it each time the button is updated.

If you really want to render the string in advance you should
at least create an offscreen surface for it.

-- 
Best regards,
  Denis Oliver Kropp
 
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------"

_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to