void tmHelp(void) { oslClearScreen(RGBA(0, 0, 0, 255)); while (!osl_quit) { oslStartDrawing(); oslReadKeys(); tmDrawGrid(); oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 125)); oslDrawString(1, 10, "ToneMatrix is a 16-step drum machine. The X axis represents one"); oslDrawString(1, 20, "4/4 measure in sixteenth notes, and the Y axis represents eight"); oslDrawString(1, 30, "different sounds. Select a node on the grid with the D-pad and the"); oslDrawString(1, 40, "sound will be played in time."); oslDrawString(1, 60, "Press O (circle) to stop or resume playing. Press [] (square) to"); oslDrawString(1, 70, "mute the row the cursor is on. Press /\\ (triangle) to mute every"); oslDrawString(1, 80, "row except the row the cursor is on. You can mute more than one row"); oslDrawString(1, 90, "at once."); oslDrawString(1, 110, "Press START to use the menu, and use the D-pad to select a menu"); oslDrawString(1, 120, "item or change a value (like the tempo), and X (cross) to confirm"); oslDrawString(1, 130, "to confirm your choice."); oslDrawString(1, 150, "You can play up to sixteen measures in a row by using the R and L"); oslDrawString(1, 160, "triggers, or by switching the \"grid\" value in the START menu."); oslDrawString(1, 170, "If \"loop all\" is on, then the measures will play one after"); oslDrawString(1, 180, "another. If it is off, it will only repeat one measure. It is"); oslDrawString(1, 190, "recommended that you stop playback before editing another grid."); oslDrawString(1, 210, "Press SELECT to hide this screen."); if (osl_keys->pressed.select) break; oslEndDrawing(); oslSyncFrame(); } return; }
/* call-seq: drawFillRect(x1, y1, x2, y2, color) Draws a filled rect on the screen. */ VALUE Graphics_drawFillRect(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE color) { OSL_COLOR c = hash2col(color); oslDrawFillRect(FIX2INT(x1), FIX2INT(y1), FIX2INT(x2), FIX2INT(y2), c); return Qnil; }
void langDisplay() { oslDrawImage(langSelection); oslIntraFontSetStyle(Roboto, 0.7f, WHITE, 0, INTRAFONT_ALIGN_LEFT); oslDrawStringf(20, 85, "CyanogenPSP"); oslIntraFontSetStyle(Roboto, 0.65f, WHITE, 0, INTRAFONT_ALIGN_LEFT); oslDrawStringf(20, 110, "%s", lang_welcome[language][0]); oslIntraFontSetStyle(Roboto, 0.5f, WHITE, 0, INTRAFONT_ALIGN_LEFT); digitaltime(420,4,0,hrTime); battery(370,2,1); oslDrawFillRect(60, 179, 420, 180, LITEGRAY); oslDrawFillRect(60, 217, 420, 218, LITEGRAY); for(i = curScroll; i < MAX_LANG_DISPLAY + curScroll; i++) { if ((folderIcons[i].active == 0) && (current >= i-1)) { current = i-1; break; } if (current <= curScroll-1) { current = curScroll-1; break; } if (folderIcons[i].active == 1) { oslIntraFontSetStyle(Roboto, 0.55f, BLACK, 0, INTRAFONT_ALIGN_CENTER); oslDrawStringf(LANG_DISPLAY_X, (i - curScroll)*36 + LANG_DISPLAY_Y, "%.56s", folderIcons[i].name); } } }
static PyObject* osl_drawFillRect(PyObject *self, PyObject *args, PyObject *kwargs) { int x1, y1, x2, y2; unsigned long color; if (!PyArg_ParseTuple(args, "iiiik:drawFillRect", &x1, &y1, &x2, &y2, &color)) return NULL; oslDrawFillRect(x1, y1, x2, y2, color); Py_INCREF(Py_None); return Py_None; }
void Thing::drawSelf() { if(hp <= 0) return; if(image) { oslDrawImageXY(this->image, this->x, this->y); } else { oslDrawFillRect( this->x, this->y, this->x + this->width(), this->y + this->height(), this->color ); } }
bool tmDeleteWarning(int slot) { bool x = FALSE; char msg[50]; sprintf(msg, "Are you sure you want to delete song%d.tms ?", slot); while (!osl_quit) { oslStartDrawing(); oslReadKeys(); tmDrawGrid(); oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 125)); oslDrawString(13, 70, msg); oslDrawString(100, 90, "X - Yes"); oslDrawString(100, 100, "O - No"); if (osl_keys->pressed.cross) { x = TRUE; break; } if (osl_keys->pressed.circle) break; oslEndDrawing(); oslSyncFrame(); } return x; }
void oslConsolePrint(const char *str) { unsigned char c; // if (!osl_consoleOk) // return; OSL_FONT *oldFont = NULL; if (osl_curFont != osl_sceFont) { oldFont = osl_curFont; oslSetFont(osl_sceFont); } while(*str) { c = *(unsigned char*)str++; if (c!='\n') { oslDrawChar(osl_consolePosX, osl_consolePosY, c); osl_consolePosX += osl_curFont->charWidths[c]; } //A droite de l'écran if (osl_consolePosX+7 > osl_curBuf->sizeX || c=='\n') { osl_consolePosY += osl_curFont->charHeight; //[MARCHE PAS, TESTER] Trop bas -> défile if (osl_consolePosY + osl_curFont->charHeight > osl_curBuf->sizeY) { osl_consolePosY -= osl_curFont->charHeight; oslSyncDrawing(); oslMoveMem(oslAddVramPrefixPtr(oslGetImageLine(osl_curBuf, 0)), oslAddVramPrefixPtr(oslGetImageLine(osl_curBuf, osl_curFont->charHeight)), osl_curBuf->totalSize-(int)oslGetImageLine(osl_curBuf, osl_curFont->charHeight)); oslFlushDataCache(); oslDrawFillRect(0, osl_consolePosY, osl_curBuf->sizeX, osl_curBuf->sizeY, 0); } osl_consolePosX = 0; } } if (oldFont != NULL) oslSetFont(oldFont); }
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; }
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; }
void tmFileDialog(bool save) { int x; unsigned char option = 0; bool empty[MAX_SAVE_SLOTS]; char strings[MAX_SAVE_SLOTS][50]; char mdate[MAX_SAVE_SLOTS][50]; char tmp[30]; SceIoStat a; typedef struct { int year, month, day; int minute, hour; } metadata; metadata songMeta[MAX_SAVE_SLOTS]; current = 0; for (x = 0; x < MAX_SAVE_SLOTS; x++) { bzero(tmp, sizeof(tmp)); sprintf(tmp, "songs/song%d.tms", x); sceIoGetstat(tmp, &a); songMeta[x].year = a.st_mtime.year; songMeta[x].month = a.st_mtime.month; songMeta[x].day = a.st_mtime.day; songMeta[x].minute = a.st_mtime.minute; songMeta[x].hour = a.st_mtime.hour; } // I have to make a separate struct because accessing sm->tm_mday // from the while (!osl_quit) fries the memory stick // same reason why there's a bool empty[] for (x = 0; x < MAX_SAVE_SLOTS; x++) { bzero(tmp, sizeof(tmp)); sprintf(tmp, "songs/song%d.tms", x); empty[x] = tmDoesFileExist(tmp); } while (!osl_quit) { oslStartDrawing(); oslReadKeys(); tmDrawGrid(); oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 125)); if (save) oslDrawString(10, 40, "Press X (cross) to save your song in the selected slot."); else oslDrawString(10, 40, "Press X (cross) to load a song from the selected slot."); oslDrawString(10, 50, "Press O (circle) to cancel."); for (x = 0; x < MAX_SAVE_SLOTS; x++) { bzero(strings[x], sizeof(strings[x])); bzero(tmp, sizeof(tmp)); sprintf(tmp, "song%d.tms", x); sprintf(strings[x], "%s %s", (option == x) ? "->" : " ", (empty[x]) ? "EMPTY" : tmp); sprintf(mdate[x], "%d/%d/%d %d:%d UTC", songMeta[x].month, songMeta[x].day, songMeta[x].year, songMeta[x].hour, songMeta[x].minute); oslDrawString(10, (70+(x*10)), strings[x]); if (!empty[x]) oslDrawString(200, (70+(x*10)), mdate[x]); } oslDrawString(10, 190, "Press /\\ (triangle) to delete the selected song slot."); if ((osl_keys->pressed.up) && (option > 0)) option--; if ((osl_keys->pressed.down) && (option < (MAX_SAVE_SLOTS-1))) option++; if (osl_keys->pressed.cross) { if (empty[option]) { if (save) { tmWrite(option); break; } } else { if (save) { if (tmOverwriteWarning(option)) { tmWrite(option); break; } } else { tmRead(option); break; } } } if (osl_keys->pressed.triangle) { if (!empty[option]) { if (tmDeleteWarning(option)) { bzero(tmp, sizeof(tmp)); sprintf(tmp, "songs/song%d.tms", option); remove(tmp); empty[option] = TRUE; } } } if (osl_keys->pressed.circle) break; if (osl_keys->pressed.start) break; oslEndDrawing(); oslSyncFrame(); } return; }
int oslShowSplashScreen2() { OSL_IMAGE *logo, *temp; int skip = 0; float y, vy; int frameNb, phase; float vyList[TABW]; float speeds[TABH][TABW]; int i, j, fade; float positions[TABH][TABW]; temp = oslLoadImageFile("logo/neoflash.png", OSL_IN_RAM, OSL_PF_5650); if (!temp) return 0; logo = oslCreateSwizzledImage(temp, OSL_IN_VRAM); oslDeleteImage(temp); if (!logo) return 0; y = -logo->sizeY; vy = 1.0f; frameNb = 0; phase = 1; fade = 0; for (i=0;i<LARG/TILE;i++) vyList[i] = (rand() % 7500) / 10000.f + 0.25f; for (j=0;j<HAUT/TILE;j++) for (i=0;i<LARG/TILE;i++) { speeds[j][i] = vyList[i] - (HAUT/TILE - j) * ((rand() % 1000) / 10000.0f + 0.04f); positions[j][i] = j * TILE; } while(!osl_quit && fade < 31 && frameNb < 220) { oslReadKeys(); if (phase < 9) { y += vy; if (y + logo->sizeY >= HAUT) { if (vy > 0) vy -= 0.8f; else vy -= 0.4f; if (phase % 2 == 1) phase++; } else if (phase == 1) vy += 0.4f; else { if (vy > 0) vy += 0.4f; else vy += 0.8f; if (phase % 2 == 0) phase++; } } else { y = 0; frameNb++; } if (frameNb > 120) { for (j=0;j<HAUT/TILE;j++) for (i=0;i<LARG/TILE;i++) { speeds[j][i] += 0.15f; if (speeds[j][i] > 0.0f) positions[j][i] += speeds[j][i]; } } if (fade > 0) fade++; if ((osl_keys->pressed.value & (OSL_KEYMASK_START|OSL_KEYMASK_CIRCLE|OSL_KEYMASK_CROSS)) && fade == 0) fade = 1; if (!skip) { oslStartDrawing(); oslClearScreen(0); if (frameNb <= 120) { logo->y = y; if (y < 0) { logo->stretchY = logo->sizeY; logo->stretchX = logo->sizeX; logo->x = 0; } else { logo->stretchY = logo->sizeY - y; logo->stretchX = logo->sizeX + y; logo->x = - y / 2; } oslDrawImage(logo); } else LogoDrawTiles(logo, positions); if (fade > 0) { oslSetAlpha(OSL_FX_RGBA, 0); oslDrawFillRect(0, 0, LARG, HAUT, RGBA(0, 0, 0, fade<<3)); /* oslSetAlpha(OSL_FX_SUB, 0xff); oslDrawFillRect(0, 0, LARG, HAUT, RGB(fade<<3, fade<<3, fade<<3)); oslSetAlpha(OSL_FX_DEFAULT, 0);*/ } oslEndDrawing(); } skip = oslSyncFrameEx(1,4,0); } oslDeleteImage(logo); return 1; }
/* Returns a string typed through the PSP built-in keyboard. */ VALUE Joyau_gets(VALUE self) { SceUtilityOskData data; SceUtilityOskParams params; unsigned short input[128] = { 'E', 'n', 't', 'e', 'r', ' ', 'y', 'o', 'u', 'r', ' ', 't', 'e','x', 't', 0 }; unsigned short output[128] = { 0 }; memset(&data, 0, sizeof(data)); data.lines = 1; data.unk_24 = 1; data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; data.desc = input; data.intext = input; data.outtextlength = 128; data.outtextlimit = 128; data.outtext = output; memset(¶ms, 0, sizeof(params)); params.base.size = sizeof(params); sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, ¶ms.base.language); sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, ¶ms.base.buttonSwap); params.base.graphicsThread = 17; params.base.accessThread = 19; params.base.fontThread = 18; params.base.soundThread = 16; params.datacount = 1; params.data = &data; sceUtilityOskInitStart(¶ms); bool done = false; while (!done) { oslStartDrawing(); oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 255)); oslEndDrawing(); switch(sceUtilityOskGetStatus()) { case PSP_UTILITY_DIALOG_INIT: break; case PSP_UTILITY_DIALOG_VISIBLE: sceUtilityOskUpdate(1); break; case PSP_UTILITY_DIALOG_QUIT: sceUtilityOskShutdownStart(); break; case PSP_UTILITY_DIALOG_FINISHED: break; case PSP_UTILITY_DIALOG_NONE: done = true; default : break; } oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } char *ret = new char[128]; for (int i = 0; i < 128; ++i) ret[i] = (char)data.outtext[i]; return rb_str_new2(ret); }
/* Affiche le logo OSLib Ne cherchez pas à comprendre cette fonction si vous débutez :p */ int oslShowSplashScreen1() { OSL_IMAGE *texte, *etoile; OSL_IMAGE *fond; int skip=0; int x, y; int angle, nFrame, val; float dist; int pousNb; float pousX[100], pousY[100]; int i, imgAngle; float tblVitPous[8] = {0.2, 0.3, 0.15, 0.2, 0.35, 0.2, 0.15, 0.3}; int fade = 0; //Add these files to the list oslAddVirtualFileList((OSL_VIRTUALFILENAME*)__osl_logo_ram_files, oslNumberof(__osl_logo_ram_files)); texte = oslLoadImageFile("ram:/logo/texte.png", OSL_IN_VRAM | OSL_UNSWIZZLED, OSL_PF_8888); if (!texte) return 0; logoDecalePixels(texte); oslStartDrawing(); oslSetDithering(1); oslSetDrawBuffer(texte); oslDrawGradientRect(0,0, WIDTH,HEIGHT, RGB(0,0,0), RGB(0,0,128), RGB(0,0,128), RGB(0,0,0)); oslSetDrawBuffer(OSL_DEFAULT_BUFFER); oslEndDrawing(); oslMoveImageTo(texte, OSL_IN_RAM); oslSwizzleImage(texte); fond = logoCreeImageFond(); if (!fond) { oslDeleteImage(texte); return 0; } oslSetTransparentColor(RGB(255,0,254)); etoile = oslLoadImageFile("ram:/logo/etoile.png", OSL_IN_RAM, OSL_PF_5551); if (!etoile) { oslDeleteImage(texte); oslDeleteImage(fond); return 0; } oslDisableTransparentColor(); texte->centerX = texte->sizeX / 2; texte->centerY = texte->sizeY / 2; angle = 270; dist = 160.0f; nFrame = 0; pousNb=0; imgAngle = 78; while (!osl_quit) { if (!skip) { oslStartDrawing(); logoCreePaletteRotative(fond, 2000-nFrame*8); oslDrawImage(fond); x = WIDTH/2; y = HEIGHT/2; if (dist > 0) { x += oslCos(angle, dist); y -= oslSin(angle, dist); texte->stretchX = texte->sizeX * (1+dist*0.03f); texte->stretchY = texte->sizeY * (1+dist*0.03f); texte->angle = imgAngle; } else { texte->stretchX = texte->sizeX; texte->stretchY = texte->sizeY; texte->angle = 0; } oslSetBilinearFilter(1); //Effet spécial pour le texturage des nuages if (nFrame >= 50) { val = (nFrame - 50) * 6; if (val > 255) val = 255; oslSetAlpha(OSL_FX_ALPHA|OSL_FX_COLOR, RGBA(val,val,val,0xff)); } else oslSetAlpha(OSL_FX_ALPHA|OSL_FX_COLOR, RGBA(0,0,0,0xff)); oslDrawImageXY(texte, x, y); oslSetImageTileSize(etoile, 0,0, 16,16); oslCorrectImageHalfBorder(etoile); oslImageSetRotCenter(etoile); etoile->angle = 360 - ((nFrame * 3) % 360); etoile->stretchX = 16; etoile->stretchY = 16; oslSetAlpha(OSL_FX_ALPHA|OSL_FX_COLOR, RGBA(0xff,0,0,0xff)); oslDrawImageXY(etoile, 480-9, 272-9); //Dessine l'étoile if (nFrame >= 140 && nFrame < 240) { val = nFrame - 140; angle = (val * 5) % 360; i = nFrame - (240 - 256/12); if (val*16 < 255) oslSetAlpha(OSL_FX_ALPHA, val*16); else if (i > 0) oslSetAlpha(OSL_FX_ALPHA, 255-i*12); else oslSetAlpha(OSL_FX_RGBA, 0); etoile->angle = (val * 8) % 360; etoile->x = WIDTH/2 + oslCosi(angle, 120); etoile->y = HEIGHT/2 - oslSini(angle, 50); etoile->stretchX = 16 * 2; etoile->stretchY = 16 * 2; oslDrawImage(etoile); oslResetImageHalfBorder(etoile); } //Restaure l'environnement oslSetBilinearFilter(0); //Dessine les poussières oslSetAlpha(OSL_FX_ADD, 0xff); oslSetImageTileSize(etoile, 0,16, 8,8); oslImageSetRotCenter(etoile); for (i=0;i<pousNb;i++) oslDrawImageSimpleXY(etoile, pousX[i], pousY[i]); oslSetAlpha(OSL_FX_RGBA, 0); // oslSysBenchmarkDisplay(); //Fade if (nFrame < 32) oslDrawFillRect(0,0, WIDTH,HEIGHT, RGBA(0,0,0,255-(nFrame<<3))); if (fade > 0) { if (fade >= 31) fade = 31; oslDrawFillRect(0,0, WIDTH,HEIGHT, RGBA(0,0,0,(fade<<3))); } oslEndDrawing(); } nFrame++; //L'étoile tourne sur le logo if (nFrame >= 140 && nFrame < 240) { val = nFrame - 140; angle = (val * 5) % 360; if (angle >= 200 && angle <= 340) { pousX[pousNb] = WIDTH/2 + oslCos(angle, 120); pousY[pousNb] = HEIGHT/2 - oslSin(angle, 50); pousNb++; } } if (fade > 0) fade++; if (nFrame > 290 && fade == 0) fade = 1; for (i=0;i<pousNb;i++) { pousY[i] += tblVitPous[i%8]; } dist -= 2.0f; angle -= 4; imgAngle -= 1; if (angle < 0) angle += 360; skip = oslSyncFrameEx(1,4,0); //Lecture des touches oslReadKeys(); if ((osl_keys->pressed.value & (OSL_KEYMASK_START|OSL_KEYMASK_CIRCLE|OSL_KEYMASK_CROSS)) && fade == 0) fade = 1; if (fade >= 32) break; } oslSetAlpha(OSL_FX_RGBA, 0); oslDeleteImage(texte); oslDeleteImage(fond); oslDeleteImage(etoile); oslRemoveVirtualFileList((OSL_VIRTUALFILENAME*)__osl_logo_ram_files, oslNumberof(__osl_logo_ram_files)); return 1; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 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; }