Esempio n. 1
0
/*
  call-seq: setTextBackground(color)

  Sets the color in which the text's background is drawn.
*/
VALUE setTextBackground(VALUE self, VALUE color)
{
    OSL_COLOR c = hash2col(color);
    oslSetBkColor(c);

    return Qnil;
}
Esempio n. 2
0
static PyObject* osl_setBkColor(PyObject *self,
                                PyObject *args,
                                PyObject *kwargs)
{
    unsigned long color;;

    if (!PyArg_ParseTuple(args, "k:setBkColor", &color))
        return NULL;

    oslSetBkColor(color);

    Py_INCREF(Py_None);
    return Py_None;
}
Esempio n. 3
0
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main(){
    int skip = 0;
    SetupCallbacks();

    initOSLib();
    oslIntraFontInit(INTRAFONT_CACHE_MED);

    //Loads image:
    OSL_IMAGE *bkg = oslLoadImageFilePNG("bkg.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);
    OSL_IMAGE *rect_01 = oslLoadImageFilePNG("rect_01.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);

    //Load fonts:
    OSL_FONT *pgfFont = oslLoadFontFile("flash0:/font/ltn0.pgf");
    oslIntraFontSetStyle(pgfFont, 0.5, RGBA(255,255,255,255), RGBA(0,0,0,0), INTRAFONT_ALIGN_LEFT);

    OSL_FONT *oftFont = oslLoadFontFile("font.oft");
    oslSetTextColor(RGBA(255,255,255,255));
    oslSetBkColor(RGBA(0,0,0,0));

    while(runningFlag && !osl_quit){
        if (!skip){
            oslStartDrawing();
            oslDrawImageXY(bkg, 0, 0);

            oslDrawImageXY(rect_01, 50, 50);
            oslSetFont(pgfFont);
            oslDrawString(55, 55, "pgf on alpha image");
            oslSetFont(oftFont);
            oslDrawString(55, 70, "oft on alpha image");

            oslDrawFillRect(30, 150, 200, 250, RGB(150, 150, 150));
            oslSetFont(pgfFont);
            oslDrawString(35, 155, "pgf on rect");
            oslSetFont(oftFont);
            oslDrawString(35, 170, "oft on rect");

            oslDrawFillRect(300, 150, 400, 250, RGB(100, 100, 100));
            oslSetFont(pgfFont);
            oslDrawString(305, 155, "pgf on rect");
            oslSetFont(oftFont);
            oslDrawString(305, 170, "oft on rect");

            oslDrawGradientRect(300, 20, 430, 120, RGBA(100, 100, 100, 100),RGBA(100, 100, 100, 100), RGBA(200, 200, 200, 100), RGBA(200, 200, 200, 100));
            oslSetFont(pgfFont);
            oslDrawString(305, 25, "pgf on gradient rect");
            oslSetFont(oftFont);
            oslDrawString(305, 40, "oft on gradient rect");

            oslEndDrawing();
        }
        oslEndFrame();
        skip = oslSyncFrame();
    }
    //Quit OSL:
    oslEndGfx();
    oslQuit();

    sceKernelExitGame();
    return 0;

}