コード例 #1
0
ファイル: osl.c プロジェクト: Oize/pspstacklesspython
static PyObject* osl_setTextColor(PyObject *self,
                                  PyObject *args,
                                  PyObject *kwargs)
{
    unsigned long color;

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

    oslSetTextColor(color);

    Py_INCREF(Py_None);
    return Py_None;
}
コード例 #2
0
bool tmClearAllWarning(void) {
	oslClearScreen(RGBA(0, 0, 0, 255));
	bool x = FALSE;
	while (!osl_quit) {
		oslStartDrawing();
		oslReadKeys();
		tmDrawGrid();
		oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 125));
		oslSetTextColor(RGBA(255,0,0,255));
		oslDrawString(200, 50, "WARNING:");
		oslSetTextColor(RGBA(255,255,255,255));
		oslDrawString(3, 70, "Are you sure you want to clear all grids? This cannot be undone.");
		oslDrawString(13, 80, "Press X to clear all grids, or press O to cancel.");
		if (osl_keys->pressed.cross) {
			x = TRUE;
			break;
		}
		if (osl_keys->pressed.circle)
			break;
		oslEndDrawing();
		oslSyncFrame();
	}
	return x;
}
コード例 #3
0
ファイル: Text.cpp プロジェクト: gawron89/pspgame
void Text::draw( RenderTarget& t )
{
#ifdef __WIN32__

	sf::Text text;
	Font* f = Font::getGlobalFont();
	if(f)
		text.setFont(f->handle);
	text.setColor(gawColorToSfColor(color));
	text.setPosition(m_position.x, m_position.y);
	text.setString(str);
	text.setCharacterSize(15);

	t.handle->draw(text);
#else

	oslSetTextColor(color.rgba);
	oslDrawString(m_position.x, m_position.y, str.c_str());


#endif
}
コード例 #4
0
ファイル: Graphics.cpp プロジェクト: Epictetus/Joyau
/*
  call-seq: setTextColor(color)

  Sets the color in which the text's color.
*/
VALUE setTextColor(VALUE self, VALUE color)
{
    OSL_COLOR c = hash2col(color);
    oslSetTextColor(c);
    return Qnil;
}
コード例 #5
0
unsigned char tmMenu(void) {
	int x;
	char mstrings[MAX_MENU_ITEMS][40];
	char ver[25];
	while (!osl_quit) {
		oslStartDrawing();
		oslReadKeys();
		tmDrawGrid();
		oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 125));
		tempo = tmTempo(bpm);
		bpm = tmBPM(tempo);
		for (x = 0; x < MAX_MENU_ITEMS; x++) {
			bzero(mstrings[x], sizeof(mstrings[x]));
			switch (x) {
				case SAVEM:
					sprintf(mstrings[x], "%s Save song", (menuoption == x) ? "->" : "  ");
					break;
				case LOADM:
					sprintf(mstrings[x], "%s Load song", (menuoption == x) ? "->" : "  ");
					break;
				case HELPM:
					sprintf(mstrings[x], "%s Help me", (menuoption == x) ? "->" : "  ");
					break;
				case LOOPM:
					sprintf(mstrings[x], "%s Loop all: %s", (menuoption == x) ? "->" : "  ", (loopall) ? "on" : "off");
					break;
				case TEMPOM:
					sprintf(mstrings[x], "%s Tempo: %d BPM", (menuoption == x) ? "->" : "  ", tmBPM(tempo));
					break;
				case GRIDM:
					sprintf(mstrings[x], "%s Grid: %d", (menuoption == x) ? "->" : "  ", (current+1));
					break;
				case CUTM:
					sprintf(mstrings[x], "%s Cut grid", (menuoption == x) ? "->" : "  ");
					break;
				case COPYM:
					sprintf(mstrings[x], "%s Copy grid", (menuoption == x) ? "->" : "  ");
					break;
				case PASTEM:
					if (tmIsGridEmpty(clipboard))
						oslSetTextColor(RGBA(255,0,0,255));
					sprintf(mstrings[x], "%s Paste grid", (menuoption == x) ? "->" : "  ");
					break;
				case CLEARM:
					sprintf(mstrings[x], "%s Clear grid", (menuoption == x) ? "->" : "  ");
					break;
				case CLEARALLM:
					sprintf(mstrings[x], "%s Clear all grids", (menuoption == x) ? "->" : "  ");
					break;
			}
			oslDrawString(10, (60+(x*10)), mstrings[x]);
			oslSetTextColor(RGBA(255,255,255,255));
		}
		bzero(ver, sizeof(ver));
		// sprintf(ver, "ToneMatrix %s by Babkock", VERSION);
		oslDrawString(10, 240, ver);
		if ((osl_keys->pressed.up) && (menuoption > 0)) {
			menuoption--;
			if (menuoption == BREAK)
				menuoption--;
		}
		if ((osl_keys->pressed.down) && (menuoption < (MAX_MENU_ITEMS-1))) {
			menuoption++;
			if (menuoption == BREAK)
				menuoption++;
		}
		if (osl_keys->pressed.left) {
			switch (menuoption) {
				case GRIDM:
					if (current > 0)
						current--;
					break;
				case LOOPM:
					loopall = (loopall) ? FALSE : TRUE;
					break;
				case TEMPOM:
					if (bpm > MIN_BPM)
						bpm -= 5;
					tempo = tmTempo(bpm);
					break;
			}
		}
		if (osl_keys->pressed.right) {
			switch (menuoption) {
				case GRIDM:
					if (current < (MAX_GRIDS-1))
						current++;
					break;
				case LOOPM:
					loopall = (loopall) ? FALSE : TRUE;
					break;
				case TEMPOM:
					if (bpm < MAX_BPM)
						bpm += 5;
					tempo = tmTempo(bpm);
					break;
			}
		}
		if (osl_keys->pressed.cross) {
			if ((menuoption != LOOPM) && (menuoption != TEMPOM) && (menuoption != GRIDM) &&
				(menuoption != CUTM) && (menuoption != COPYM) && (menuoption != PASTEM))
				return menuoption;
			else {
				switch (menuoption) {
					case CUTM:
						clipboard = tmClear();
						clipboard = data[current];
						data[current] = tmClear();
						break;
					case COPYM:
						clipboard = tmClear();
						clipboard = data[current];
						break;
					case PASTEM:
						if (!tmIsGridEmpty(clipboard)) {
							data[current] = tmClear();
							data[current] = clipboard;
						}
						break;
				}
			}
		}
		if (osl_keys->pressed.start)
			break;
		oslEndDrawing();
		oslSyncFrame();
	}
	return 69;
}
コード例 #6
0
ファイル: main.c プロジェクト: DavisDev/oslib-mod
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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;

}