You are not logged in.

#1 2011-03-21 09:08:00

diego_pmc
Member

Saving text objects

Is there any way in GRRLIb to save text objects so that they are not generated every time? Something like

Code:

GRRLIB_Text* txt = GRLIB_GenerateText(font, size, "This is my string");

It doesn't have to be this direct. A workaround would do too, as long as it's not overly complicated.

Last edited by diego_pmc (2011-03-21 09:08:36)

Offline

 

#2 2011-03-21 15:02:54

Crayon
Bad Mother Fucker

Re: Saving text objects

I think I use GRRLIB_Screen2Texture in my code: http://grrlib.santo.fr/doc/group___all_ … a41b75f4c1

Offline

 

#3 2011-03-21 15:55:04

diego_pmc
Member

Re: Saving text objects

But without an alpha layer that function isn't very well suited for this purpose. sad Do you think it'd be hard to implement in a future release (whenever that may be)?

Last edited by diego_pmc (2011-03-21 15:55:42)

Offline

 

#4 2011-03-21 16:43:02

Crayon
Bad Mother Fucker

Re: Saving text objects

I use GRRLIB_Screen2Texture because I always draw my text on the background and the background image has no alpha of course.

Here is an example, sorry I use a GRRLIB C++ wrapper, but I think could understand the idea:

Code:

    // Build Start Screen background
    SplashImg->Draw(0, 0); // GRRLIB_DrawImg
    swprintf(text, TEXT_SIZE, Lang->String("Programmer: %ls").c_str(), L"Crayon");
    GRRLIB_PrintfTTFW(50, 310, DefaultFont, text, 11, 0xFFFFFFFF);
    swprintf(text, TEXT_SIZE, Lang->String("Graphics: %ls").c_str(), L"Mr_Nick666");
    GRRLIB_PrintfTTFW(50, 330, DefaultFont, text, 11, 0xFFFFFFFF);
    wcsncpy(text, Lang->String("Press The A Button").c_str(), TEXT_SIZE);
    GRRLIB_PrintfTTFW((ScreenWidth / 2) - (GRRLIB_WidthTTFW(DefaultFont, text, 20) / 2),
                    400, DefaultFont, text, 20, 0x000000FF);
    SplashImg->CopyScreen(0, 0, true); //GRRLIB_Screen2Texture

I you need alpha to be saved, use GRRLIB_CompoStart and GRRLIB_CompoEnd.

Offline

 

Board footer

Powered by FluxBB