void WarningScreen::draw() { oslDrawImageXY(mCover,0,0); oslIntraFontSetStyle(gFont, 1.2f,RGBA(175,137,62,255), RGBA(0,0,0,0),INTRAFONT_ALIGN_CENTER); oslDrawString(240,20,Resource::STR_WARNING_CAPTION); oslIntraFontSetStyle(gFont, 0.6f,RGBA(175,137,62,255), RGBA(0,0,0,0),INTRAFONT_ALIGN_CENTER); oslDrawString(240,100,Resource::STR_WARNING_TEXT); oslDrawImageXY(mBack, (430) - (mBack->stretchX), (272) - (mBack->stretchY)); oslIntraFontSetStyle(gFont, 0.7f,RGBA(175,137,62,255), RGBA(0,0,0,0),INTRAFONT_ALIGN_CENTER); oslDrawString((510) - mBack->stretchX,(272) - (mBack->stretchY/2),Resource::STR_BACK_SK); }
void spikeDraw() { oslDrawImageXY(spike, spikx[0], spiky[0]); oslDrawImageXY(spike, spikx[1], spiky[1]); oslDrawImageXY(spike, spikx[2], spiky[2]); oslDrawImageXY(spike, spikx[3], spiky[3]); oslDrawImageXY(spike, spikx[4], spiky[4]); oslDrawImageXY(spike, spikx[5], spiky[5]); oslDrawImageXY(spike, spikx[6], spiky[6]); oslDrawImageXY(spike, spikx[7], spiky[7]); oslDrawImageXY(spike, spikx[8], spiky[8]); oslDrawImageXY(spike, spikx[9], spiky[9]); }
int connectToAP(int config){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); oslDrawString(30, 200, "Connecting to AP..."); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); int result = oslConnectToAP(config, 30, connectAPCallback); if (!result){ char ip[30] = ""; char resolvedIP[30] = ""; oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); oslGetIPaddress(ip); sprintf(buffer, "IP address: %s", ip); oslDrawString(30, 170, buffer); sprintf(buffer, "Resolving %s", ADDRESS); oslDrawString(30, 200, buffer); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); result = oslResolveAddress(ADDRESS, resolvedIP); oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); oslGetIPaddress(ip); if (!result) sprintf(buffer, "Resolved IP address: %s", ip); else sprintf(buffer, "Error resolving address!"); oslDrawString(30, 230, buffer); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); sceKernelDelayThread(3*1000000); }else{ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); sprintf(buffer, "Error connecting to AP!"); oslDrawString(30, 200, buffer); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); sceKernelDelayThread(3*1000000); } oslDisconnectFromAP(); return 0; }
void draw_selected_song_item_frame(OSL_IMAGE *shd_img, OSL_IMAGE *bg_l_img,\ OSL_IMAGE *bg_r_img, OSL_IMAGE *bg_c_img, int x, int y, float scale) { shd_img->stretchX = shd_img->sizeX * scale; oslDrawImageXY(shd_img, x, y); oslDrawImageSimpleXY(bg_l_img, x, y); bg_c_img->stretchX = shd_img->stretchX - bg_l_img->sizeX \ - bg_r_img->sizeX; oslDrawImageXY(bg_c_img, x+bg_l_img->sizeX, y); oslDrawImageSimpleXY(bg_r_img, x+shd_img->stretchX-bg_l_img->x, y); }
void Buffer::resize(int w, int h) { if (!shouldDelete) throw RubyException(rb_eRuntimeError, "Not allowed to resize this Buffer"); OSL_IMAGE *old_image = img; OSL_IMAGE *old_buffer = oslGetDrawBuffer(); img = oslCreateImage(w, h, OSL_IN_VRAM, img->pixelFormat); if (!img) { img = oslCreateImage(w, h, OSL_IN_RAM, img->pixelFormat); if (!img) throw RubyException(rb_eRuntimeError, "Could not recreate the buffer."); } else { Buffer::registerInVram(img); } setActual(); oslDrawImageXY(old_image, 0, 0); oslSetDrawBuffer(old_buffer); if (old_image->location == OSL_IN_RAM) oslDeleteImage(old_image); else Buffer::removeFromVram(old_image); }
int scanDirCallback(char *dirName){ oslStartDrawing(); drawCommonGraphics(); drawButtonBar(MODE_MEDIA_LIBRARY); int startX = (480 - scanBkg->sizeX) / 2; int startY = (272 - scanBkg->sizeY) / 2; oslDrawImageXY(scanBkg, startX, startY); skinGetColor("RGBA_POPUP_TITLE_TEXT", tempColor); skinGetColor("RGBA_POPUP_TITLE_TEXT_SHADOW", tempColorShadow); setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT); oslDrawString((480 - oslGetStringWidth(langGetString("SCANNING"))) / 2, startY + 3, langGetString("SCANNING")); skinGetColor("RGBA_POPUP_MESSAGE_TEXT", tempColor); skinGetColor("RGBA_POPUP_MESSAGE_TEXT_SHADOW", tempColorShadow); setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT); getFileName(dirName, buffer); if (strlen(buffer) > 70) buffer[70] = '\0'; oslDrawString((480 - oslGetStringWidth(buffer)) / 2, startY + 30, buffer); oslReadKeys(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); return 0; }
void draw_over_song_item_frame(OSL_IMAGE *shd_img, OSL_IMAGE *bg_l_img, \ OSL_IMAGE *bg_r_img, OSL_IMAGE *bg_c_img, int x, int y) { oslDrawImageSimpleXY(shd_img, x, y); oslDrawImageSimpleXY(bg_l_img, x, y); bg_c_img->stretchX = shd_img->sizeX - bg_l_img->sizeX - bg_r_img->sizeX; oslDrawImageXY(bg_c_img, x+bg_l_img->sizeX, y); oslDrawImageSimpleXY(bg_r_img, x+shd_img->sizeX-bg_l_img->x, y); }
void TitleScreen::draw() { //draw logo image oslDrawImageXY(GDSplash, (480/2) - (GDSplash->stretchX/2), (272/2) - (GDSplash->stretchY/2)); //Flashing float t = ((float)(clock() % CLOCKS_PER_SEC)) / ((float)CLOCKS_PER_SEC); int val = (t < 0.5f) ? t*511 : (1.0f-t)*511; oslIntraFontSetStyle(gFont, 0.7f,RGBA(255,255,255,255),(0xFF<<24)+(val<<16)+(val<<8)+(val),INTRAFONT_ALIGN_CENTER); oslDrawString(240,220,Resource::STR_PRESS_START); oslIntraFontSetStyle(gFont, 0.7f,RGBA(255,255,255,255), RGBA(0,0,0,0),INTRAFONT_ALIGN_CENTER); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Connect to Access Point: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int connectAPCallback(int state){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); oslDrawString(30, 200, "Connecting to AP..."); sprintf(buffer, "State: %i", state); oslDrawString(30, 230, buffer); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); return 0; }
void Buffer::resize(int w, int h) { OSL_IMAGE *old_image = img; OSL_IMAGE *old_buffer = oslGetDrawBuffer(); img = oslCreateImage(w, h, OSL_IN_VRAM, img->pixelFormat); if (!img) throw RubyException(rb_eRuntimeError, "Could not recreate the buffer."); setActual(); oslDrawImageXY(old_image, 0, 0); oslSetDrawBuffer(old_buffer); oslDeleteImage(old_image); }
void mp3FileDisplay() { oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); oslDrawImageXY(mp3bg, 0, 0); oslDrawImageXY(mp3_select,8,(current - curScroll)*55+MP3_CURR_DISPLAY_Y); // Displays the directories, while also incorporating the scrolling for(i=curScroll;i<MAX_MP3_DISPLAY+curScroll;i++) { // Handles the cursor and the display to not move past the MAX_MP3_DISPLAY. // For moving down //if ((folderIcons[i].active == 0) && (current >= i-1)) { if ((folderIcons[i].active == 0) && (current >= i-1)) { current = i-1; break; } // For moving up if (current <= curScroll-1) { current = curScroll-1; break; } // If the currently selected item is active, then display the name if (folderIcons[i].active == 1) { oslDrawStringf(MP3_DISPLAY_X, (i - curScroll)*55+MP3_DISPLAY_Y, "%.62s", folderIcons[i].name); // change the X & Y value accordingly if you want to move it (for Y, just change the +10) } } battery(370,2,1); digitaltime(420,4,0,hrTime); }
void MainMenuScreen::draw() { oslDrawImageXY(menubg, (480/2) - (menubg->stretchX/2), (272/2) - (menubg->stretchY/2)); (gMenu == 0) ? oslIntraFontSetStyle(gFont, 1.2f,RGBA(175,137,62,255), RGBA(0,0,0,255),INTRAFONT_ALIGN_CENTER) : oslIntraFontSetStyle(gFont, 0.6f,RGBA(120,120,120,255), RGBA(0,0,0,0xFF),INTRAFONT_ALIGN_CENTER); oslDrawString(340, 100,Resource::STR_START_GAME); (gMenu == 1) ? oslIntraFontSetStyle(gFont, 1.2f,RGBA(175,137,62,255), RGBA(0,0,0,255),INTRAFONT_ALIGN_CENTER) : oslIntraFontSetStyle(gFont, 0.6f,RGBA(120,120,120,255), RGBA(0,0,0,0xFF),INTRAFONT_ALIGN_CENTER); oslDrawString(340, 120,Resource::STR_MULTIPLAYER_CAPTION); (gMenu == 2) ? oslIntraFontSetStyle(gFont, 1.2f,RGBA(175,137,62,255), RGBA(0,0,0,255),INTRAFONT_ALIGN_CENTER) : oslIntraFontSetStyle(gFont, 0.6f,RGBA(120,120,120,255), RGBA(0,0,0,0xFF),INTRAFONT_ALIGN_CENTER); oslDrawString(340, 140,Resource::STR_HELP_CAPTION); (gMenu == 3) ? oslIntraFontSetStyle(gFont, 1.2f,RGBA(175,137,62,255), RGBA(0,0,0,255),INTRAFONT_ALIGN_CENTER) : oslIntraFontSetStyle(gFont, 0.6f,RGBA(120,120,120,255), RGBA(0,0,0,0xFF),INTRAFONT_ALIGN_CENTER); oslDrawString(340, 160,Resource::STR_TROPHIES_CAPTION); (gMenu == 4) ? oslIntraFontSetStyle(gFont, 1.2f,RGBA(175,137,62,255), RGBA(0,0,0,255),INTRAFONT_ALIGN_CENTER) : oslIntraFontSetStyle(gFont, 0.6f,RGBA(120,120,120,255), RGBA(0,0,0,0xFF),INTRAFONT_ALIGN_CENTER); oslDrawString(340, 180,Resource::STR_ABOUT_CAPTION); (gMenu == 5) ? oslIntraFontSetStyle(gFont, 1.2f,RGBA(175,137,62,255), RGBA(0,0,0,0xFF),INTRAFONT_ALIGN_CENTER) : oslIntraFontSetStyle(gFont, 0.6f,RGBA(120,120,120,255), RGBA(0,0,0,0xFF),INTRAFONT_ALIGN_CENTER); oslDrawString(340, 200,Resource::STR_EXIT_CAPTION); }
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 ); } }
int appdrawer() { int browser_x = 30; int browser_text_x = 52; int calc_x = 105; int calc_text_x = 127; int clock_x = 180; int clock_text_x = 202; int fm_x = 255; int fm_text_x = 277; int gallery_x = 330; int gallery_text_x = 352; int game_icon = 405; int game_text_icon = 427; int messenger_x = 30; int messenger_text_x = 52; int music_x = 105; int music_text_x = 127; int settings_x = 180; int settings_test_x = 202; int umd_x = 255; int umd_text_x = 277; //loads appdrawer icons appdrawer_loadImages(); if (!ic_launcher_clock || !backdrop) debugDisplay(); oslSetFont(Roboto); while (!osl_quit) { LowMemExit(); oslStartDrawing(); controls(); oslDrawImage(background); if (eDesktopActivator == 1) { navbarButtons(1); battery(370,2,3); if ((cursor->y <= 16) || (cursor->y >= 226)) { digitaltime(420,4,0,hrTime); } else if (cursor->y >= 16 && cursor->y <= 226) { digitaltime(420,-10,0,hrTime); } } else if (eDesktopActivator == 0) { navbarButtons(0); battery(370,2,1); digitaltime(420,4,0,hrTime); } if (DARK == 0) oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, INTRAFONT_ALIGN_CENTER); else oslIntraFontSetStyle(Roboto, fontSize, WHITE, 0, INTRAFONT_ALIGN_CENTER); oslDrawImageXY(backdrop, 1, 15); oslDrawImageXY(ic_launcher_browser, browser_x, 40); oslDrawStringf(browser_text_x, 90, "%s", lang_appDrawer[language][0]); oslDrawImageXY(ic_launcher_calculator, calc_x, 40); oslDrawStringf(calc_text_x, 90, "%s", lang_appDrawer[language][1]); oslDrawImageXY(ic_launcher_clock, clock_x, 40); oslDrawStringf(clock_text_x, 90, "%s", lang_appDrawer[language][2]); oslDrawImageXY(ic_launcher_filemanager, fm_x, 40); oslDrawStringf(fm_text_x, 90,"%s", lang_appDrawer[language][3]); oslDrawImageXY(ic_launcher_gallery, gallery_x, 40); oslDrawStringf(gallery_text_x, 90, "%s", lang_appDrawer[language][4]); oslDrawImageXY(ic_launcher_game, game_icon, 40); oslDrawStringf(game_text_icon, 90, "%s", lang_appDrawer[language][5]); oslDrawImageXY(ic_launcher_messenger, messenger_x, 130); oslDrawStringf(messenger_text_x, 185, "%s", lang_appDrawer[language][6]); oslDrawImageXY(ic_launcher_apollo, music_x, 130); oslDrawStringf(music_text_x, 185, "%s", lang_appDrawer[language][7]); oslDrawImageXY(ic_launcher_settings, settings_x, 130); oslDrawStringf(settings_test_x, 185, "%s", lang_appDrawer[language][8]); oslDrawImageXY(ic_launcher_umd, umd_x, 132); oslDrawStringf(umd_text_x, 185, "%s", lang_appDrawer[language][9]); androidQuickSettings(); volumeController(); appHighlight(1); oslDrawImage(cursor); if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } if (osl_keys->pressed.circle) { appdrawer_deleteImages(); home(); } if (cursor->x >= 15 && cursor->x <= 75 && cursor->y >= 25 && cursor->y <= 85 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); internet(); } if (experimentalF == 1) { // WIP calculator if (cursor->x >= 100 && cursor->x <= 140 && cursor->y >= 25 && cursor->y <= 85 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); calculator(); } } if (cursor->x >= 160 && cursor->x <= 225 && cursor->y >= 25 && cursor->y <= 85 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); pspclock(); } if (cursor->x >= 245 && cursor->x <= 295 && cursor->y >= 25 && cursor->y <= 85 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); filemanage(); } if (cursor->x >= 320 && cursor->x <= 370 && cursor->y >= 25 && cursor->y <= 85 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); galleryApp(); } if (cursor->x >= 390 && cursor->x <= 450 && cursor->y >= 25 && cursor->y <= 85 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); gameApp(); } if (experimentalF == 1) { //WIP ad-hoc messenger application if (cursor->x >= 15 && cursor->x <= 75 && cursor->y >= 115 && cursor->y <= 180 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); messenger(); } } if (cursor->x >= 100 && cursor->x <= 140 && cursor->y >= 115 && cursor->y <= 180 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); mp3player(); } if (cursor->x >= 160 && cursor->x <= 225 && cursor->y >= 115 && cursor->y <= 180 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); settingsMenu(); } if (cursor->x >= 245 && cursor->x <= 295 && cursor->y >= 115 && cursor->y <= 180 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); launchUMD("disc0:/PSP_GAME/SYSDIR/EBOOT.BIN"); } if (cursor->x >= 137 && cursor->x <= 200 && cursor->y >= 237 && cursor->y <= 271 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); home(); } if (cursor->x >= 200 && cursor->x <= 276 && cursor->y >= 237 && cursor->y <= 271 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); appdrawer_deleteImages(); home(); } if (cursor->x >= 276 && cursor->x <= 340 && cursor->y >= 237 && cursor->y <= 271 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); multitask(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } return 0; }
int messenger() { messengerbg = oslLoadImageFilePNG("system/app/messenger/messengerbg.png", OSL_IN_RAM, OSL_PF_8888); if (!messengerbg) debugDisplay(); oslSetFont(Roboto); while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, INTRAFONT_ALIGN_LEFT); controls(); oslDrawImageXY(messengerbg, 0, 0); navbarButtons(2); battery(330,2,0); digitaltime(381,4,0,hrTime); androidQuickSettings(); volumeController(); oslDrawImage(cursor); if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } if (osl_keys->pressed.circle) { oslDeleteImage(messengerbg); appdrawer(); } if ((cursor->x >= 444 && cursor->x <= 480) && (cursor->y >= 157 && cursor->y <= 213) && (osl_keys->pressed.cross)) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(messengerbg); appdrawer(); } if ((cursor->x >= 444 && cursor->x <= 480) && (cursor->y >= 76 && cursor->y <= 155) && (osl_keys->pressed.cross)) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(messengerbg); home(); } if ((cursor->x >= 444 && cursor->x <= 480) && (cursor->y >= 19 && cursor->y <= 75) && (osl_keys->pressed.cross)) { oslPlaySound(KeypressStandard, 1); multitask(); } captureScreenshot(); if (cursor->x >= 385 && cursor->x <= 428 && cursor->y >= 210 && cursor->y <= 258 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(messengerbg); newMessage(); } /* if (cursor->x >= 378 && cursor->x <= 434 && cursor->y >= 20 && cursor->y <= 52 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(messengerbg); doClient(); } */ oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } return 0; }
void newMessage() { new_message = oslLoadImageFilePNG("system/app/messenger/new_message.png", OSL_IN_RAM, OSL_PF_8888); if (!new_message) debugDisplay(); while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); controls(); oslDrawImageXY(new_message, 0, 0); navbarButtons(2); battery(330,2,0); digitaltime(381,4,0,hrTime); androidQuickSettings(); volumeController(); oslDrawImage(cursor); if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } if (osl_keys->pressed.circle) { oslDeleteImage(new_message); messenger(); } if ((cursor->x >= 444 && cursor->x <= 480) && (cursor->y >= 157 && cursor->y <= 213) && (osl_keys->pressed.cross)) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(messengerbg); messenger(); } if ((cursor->x >= 444 && cursor->x <= 480) && (cursor->y >= 76 && cursor->y <= 155) && (osl_keys->pressed.cross)) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(messengerbg); home(); } if ((cursor->x >= 444 && cursor->x <= 480) && (cursor->y >= 19 && cursor->y <= 75) && (osl_keys->pressed.cross)) { oslPlaySound(KeypressStandard, 1); multitask(); } captureScreenshot(); if (cursor->x >= 7 && cursor->x <= 435 && cursor->y >= 55 && cursor->y <= 86 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); doServer(); } oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, INTRAFONT_ALIGN_LEFT); oslDrawString(14, 245, tempMessage); if (cursor->x >= 10 && cursor->x <= 362 && cursor->y >= 228 && cursor->y <= 270 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); openOSK("Enter Message", "", 128, -1); } if ((cursor->x >= 10 && cursor->x <= 405 && cursor->y >= 88 && cursor->y <= 118 && osl_keys->pressed.cross) && oslIsWlanPowerOn()) doClient(); else if ((cursor->x >= 410 && cursor->x <= 442 && cursor->y >= 92 && cursor->y <= 118 && osl_keys->pressed.cross) && oslIsWlanPowerOn()) doServer(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } }
void Tower::RenderTower(const Coordinates2D &position) { oslDrawImageXY(mTowerImg, position.X, GameGUI::Instance()->mGame->GetGameMap()->mScrollAmount+position.Y); }
void TowerInstance::RenderTower() { oslDrawImageXY(mTower->mTowerImg, mTowerPosition.X + (mTower->mTowerImg->sizeX/2), (mTower->mTowerImg->sizeY/2) + mTowerPosition.Y + GameGUI::Instance()->mGame->GetGameMap()->mScrollAmount); }
/* 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; }
//First Boot Message void firstBootInitiation() { firstBoot = setFileDefaultsInt("system/settings/boot.bin", 1, firstBoot); iconPackLoad(); //Loads our images into memory loadIcons(); background = oslLoadImageFile(backgroundPath, OSL_IN_RAM, OSL_PF_8888); cursor = oslLoadImageFilePNG(cursorPath, OSL_IN_VRAM, OSL_PF_8888); navbar = oslLoadImageFile(navbarPath, OSL_IN_RAM, OSL_PF_8888); navbar2 = oslLoadImageFile(navbar2Path, OSL_IN_RAM, OSL_PF_8888); //notif = oslLoadImageFile("system/home/menu/notif.png", OSL_IN_RAM, OSL_PF_8888); welcome = oslLoadImageFilePNG("system/home/icons/welcome.png", OSL_IN_RAM, OSL_PF_8888); transbackground = oslLoadImageFilePNG("system/home/icons/transbackground.png", OSL_IN_RAM, OSL_PF_8888); control = oslLoadImageFilePNG("system/home/menu/brightnesscontrol.png", OSL_IN_VRAM, OSL_PF_8888); ic_launcher_apollo = oslLoadImageFilePNG(apolloPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_browser = oslLoadImageFile(browserPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_calculator = oslLoadImageFilePNG(calcPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_filemanager = oslLoadImageFilePNG(fmPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_gallery = oslLoadImageFilePNG(galleryPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_game = oslLoadImageFilePNG(gamePath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_messenger = oslLoadImageFilePNG(messagesPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_settings = oslLoadImageFilePNG(settingsPath, OSL_IN_RAM, OSL_PF_8888); ic_launcher_umd = oslLoadImageFilePNG(umdPath, OSL_IN_RAM, OSL_PF_8888); usbdebug = oslLoadImageFilePNG("system/home/icons/usbdebug.png", OSL_IN_RAM, OSL_PF_8888); music = oslLoadImageFilePNG("system/home/icons/music.png", OSL_IN_RAM, OSL_PF_8888); //Debugger - Displays an error message if the following resources are missing. if (!background || !cursor || !ic_allapps || !ic_allapps_pressed || !navbar || !ic_launcher_apollo || !ic_launcher_settings || !ic_launcher_messenger || !ic_launcher_browser || !batt100 || !batt80 || !batt60 || !batt40 || !batt20 || !batt10 || !batt0 || !battcharge || !navbar2 || !usbdebug || !music) debugDisplay(); //Sets the cursor's original position on the screen cursor->x = 240; cursor->y = 136; if (firstBoot!= 0) { while (!osl_quit) { oslStartDrawing(); controls(); oslDrawImage(background); oslDrawImageXY(ic_launcher_apollo, 105, 190); oslDrawImageXY(ic_launcher_browser, 276, 190); oslDrawImageXY(ic_launcher_settings, 331, 190); oslDrawImageXY(ic_launcher_messenger, 160, 190); oslSetTransparentColor(RGB(0,0,0)); appDrawerIcon(); oslDisableTransparentColor(); oslIntraFontSetStyle(Roboto, 0.5f, WHITE, 0, INTRAFONT_ALIGN_LEFT); digitaltime(420,4,0,hrTime); volumeController(); battery(370,2,1); navbarButtons(0); oslDrawImageXY(transbackground, 0, 0); oslDrawImageXY(welcome, 0, 0); oslIntraFontSetStyle(Roboto, 0.8f,BLACK,0,INTRAFONT_ALIGN_LEFT); oslDrawStringf(20,30, "%s", lang_welcome[language][0]); oslIntraFontSetStyle(Roboto, 0.6f,DARKGRAY,0,INTRAFONT_ALIGN_LEFT); oslDrawStringf(20,60, "%s", lang_welcome[language][1]); oslDrawStringf(20,80, "%s", lang_welcome[language][2]); oslIntraFontSetStyle(Roboto, 0.6f,WHITE,0,INTRAFONT_ALIGN_LEFT); oslDrawStringf(385,110, "%s", lang_welcome[language][3]); oslDrawImage(cursor); if (cursor->x >= 388 && cursor->x <= 464 && cursor->y >= 98 && cursor->y <= 132 && osl_keys->pressed.cross) { FILE * firstBootTxt = fopen("system/settings/boot.bin", "w"); fprintf(firstBootTxt, "0"); fclose(firstBootTxt); oslPlaySound(KeypressStandard, 1); oslDeleteImage(welcome); oslDeleteImage(transbackground); unloadIcons(); home(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } } if (firstBoot == 0) { oslDeleteImage(welcome); oslDeleteImage(transbackground); unloadIcons(); lockscreen(); home(); } }
int calculator() { //int result; int x = 1; int y = 1; /* int enterednumber; int numberuse = 0; int suppression = 1; int Number = 0; */ calcbackground = oslLoadImageFile("system/app/calculator/calcbg.png", OSL_IN_RAM, OSL_PF_8888); oslSetFont(Roboto); if (!calcbackground) debugDisplay(); while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); controls(); oslDrawImageXY(calcbackground, 0, 0); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); oslIntraFontSetStyle(Roboto, 0.8f,WHITE,0,0); oslDrawString(35,120,"7"); oslDrawString(90,120,"8"); oslDrawString(145,120,"9"); oslDrawString(35,160,"4"); oslDrawString(90,160,"5"); oslDrawString(145,160,"6"); oslDrawString(35,200,"1"); oslDrawString(90,200,"2"); oslDrawString(145,200,"3"); oslDrawString(90,240,"0"); oslDrawString(218,120,"/"); oslDrawString(218,160,"x"); oslDrawString(218,200,"-"); oslDrawString(218,240,"+"); oslIntraFontSetStyle(Roboto, 0.6f,WHITE,0,0); oslDrawString(260,120,"DEL"); oslDrawString(326,120,"sin"); oslDrawString(366,120,"cos"); oslDrawString(406,120,"tan"); oslDrawString(446,120,"ln"); if (osl_keys->pressed.left) x -= 1; if (x == 0) x = 8; if (osl_keys->pressed.right) x += 1; if (x == 10) x = 1; if (osl_keys->pressed.up) y -= 1; if (y == 0) y = 4; if (osl_keys->pressed.down) y += 1; if (y == 5) y = 1; if (y == 1 && x ==1) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(35,120,"7"); } else if (y == 1 && x == 2) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(90,120,"8"); } else if (y == 1 && x == 3) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(145,120,"9"); } else if (y == 1 && x == 4) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(218,120,"/"); } else if (y == 1 && x == 5) { oslIntraFontSetStyle(Roboto, 0.6f,RED,0,0); oslDrawString(260,120,"DEL"); } else if (y == 1 && x == 6) { oslIntraFontSetStyle(Roboto, 0.6f,RED,0,0); oslDrawString(326,120,"sin"); } else if (y == 1 && x == 7) { oslIntraFontSetStyle(Roboto, 0.6f,RED,0,0); oslDrawString(366,120,"cos"); } else if (y == 1 && x == 8) { oslIntraFontSetStyle(Roboto, 0.6f,RED,0,0); oslDrawString(406,120,"tan"); } else if (y == 1 && x == 9) { oslIntraFontSetStyle(Roboto, 0.6f,RED,0,0); oslDrawString(446,120,"ln"); } if (y == 2 && x == 1) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(35,160,"4"); } else if (y == 2 && x == 2) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(90,160,"5"); } else if (y == 2 && x == 3) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(145,160,"6"); } else if (y == 2 && x == 4) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(218,160,"x"); } if (y == 3 && x == 1) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(35,200,"1"); } else if (y == 3 && x == 2) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(90,200,"2"); } else if (y == 3 && x == 3) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(145,200,"3"); } else if (y == 3 && x == 4) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(218,200,"-"); } if (y == 4 && x == 1) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(90,240,"0"); } else if (y == 4 && x == 2) { oslIntraFontSetStyle(Roboto, 0.8f,RED,0,0); oslDrawString(218,240,"+"); } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.circle) { oslDeleteImage(calcbackground); appdrawer(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } return 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Draw info on selected item: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void drawMLinfo(){ static u64 lastMenuChange = 0; static int lastSelected = -1; OSL_FONT *font = fontNormal; OSL_IMAGE *tmpCoverArt = NULL; if (mediaLibraryStatus != STATUS_QUERYMENU) return; skinGetPosition("POS_MEDIALIBRARY_INFO_BKG", tempPos); oslDrawImageXY(infoBkg, tempPos[0], tempPos[1]); oslSetFont(font); skinGetColor("RGBA_LABEL_TEXT", tempColor); skinGetColor("RGBA_LABEL_TEXT_SHADOW", tempColorShadow); setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT); switch (mlQueryType) { case QUERY_COUNT: case QUERY_COUNT_RATING: case QUERY_COUNT_ARTIST: skinGetPosition("POS_MEDIALIBRARY_TOTAL_TRACKS_LABEL", tempPos); oslDrawString(tempPos[0], tempPos[1], langGetString("TOTAL_TRACKS")); skinGetPosition("POS_MEDIALIBRARY_TOTAL_TIME_LABEL", tempPos); oslDrawString(tempPos[0], tempPos[1], langGetString("TOTAL_TIME")); skinGetColor("RGBA_TEXT", tempColor); skinGetColor("RGBA_TEXT_SHADOW", tempColorShadow); setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT); snprintf(buffer, sizeof(buffer), "%.f", MLresult[commonMenu.selected - mlBufferPosition]->intField01); skinGetPosition("POS_MEDIALIBRARY_TOTAL_TRACKS_VALUE", tempPos); oslDrawString(tempPos[0], tempPos[1], buffer); formatHHMMSS(MLresult[commonMenu.selected - mlBufferPosition]->intField02, buffer, sizeof(buffer)); skinGetPosition("POS_MEDIALIBRARY_TOTAL_TIME_VALUE", tempPos); oslDrawString(tempPos[0], tempPos[1], buffer); break; case QUERY_SINGLE_ENTRY: skinGetPosition("POS_MEDIALIBRARY_GENRE_LABEL", tempPos); oslDrawString(tempPos[0], tempPos[1], langGetString("GENRE")); skinGetPosition("POS_MEDIALIBRARY_YEAR_LABEL", tempPos); oslDrawString(tempPos[0], tempPos[1], langGetString("YEAR")); skinGetPosition("POS_MEDIALIBRARY_TIME_LABEL", tempPos); oslDrawString(tempPos[0], tempPos[1], langGetString("TIME")); skinGetPosition("POS_MEDIALIBRARY_RATING_LABEL", tempPos); oslDrawString(tempPos[0], tempPos[1], langGetString("RATING")); skinGetPosition("POS_MEDIALIBRARY_PLAYED_LABEL", tempPos); oslDrawString(tempPos[0], tempPos[1], langGetString("PLAYED")); skinGetColor("RGBA_TEXT", tempColor); skinGetColor("RGBA_TEXT_SHADOW", tempColorShadow); setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT); skinGetPosition("POS_MEDIALIBRARY_GENRE_VALUE", tempPos); oslDrawString(tempPos[0], tempPos[1], MLresult[commonMenu.selected - mlBufferPosition]->genre); skinGetPosition("POS_MEDIALIBRARY_YEAR_VALUE", tempPos); oslDrawString(tempPos[0], tempPos[1], MLresult[commonMenu.selected - mlBufferPosition]->year); formatHHMMSS(MLresult[commonMenu.selected - mlBufferPosition]->seconds, buffer, sizeof(buffer)); skinGetPosition("POS_MEDIALIBRARY_TIME_VALUE", tempPos); oslDrawString(tempPos[0], tempPos[1], buffer); skinGetPosition("POS_MEDIALIBRARY_RATING_VALUE", tempPos); drawRating(tempPos[0], tempPos[1], MLresult[commonMenu.selected - mlBufferPosition]->rating); skinGetPosition("POS_MEDIALIBRARY_PLAYED_VALUE", tempPos); snprintf(buffer, sizeof(buffer), "%i", MLresult[commonMenu.selected - mlBufferPosition]->played); oslDrawString(tempPos[0], tempPos[1], buffer); if (commonMenu.selected != lastSelected){ sceRtcGetCurrentTick (&lastMenuChange); lastSelected = commonMenu.selected; if (coverArt){ oslDeleteImage(coverArt); coverArt = NULL; } coverArtFailed = 0; }else if (!coverArt && !coverArtFailed){ u64 currentTime; sceRtcGetCurrentTick(¤tTime); if (currentTime - lastMenuChange > COVERTART_DELAY){ char dirName[264]; int size = 0; cpuBoost(); snprintf(dirName, sizeof(dirName), "%s", MLresult[commonMenu.selected - mlBufferPosition]->shortpath); directoryUp(dirName); //Look for folder.jpg in the same directory: snprintf(buffer, sizeof(buffer), "%s/%s", dirName, "folder.jpg"); size = fileExists(buffer); if (size > 0 && size <= MAX_IMAGE_DIMENSION) { tmpCoverArt = oslLoadImageFileJPG(buffer, OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); } else { //Look for cover.jpg in same directory: snprintf(buffer, sizeof(buffer), "%s/%s", dirName, "cover.jpg"); size = fileExists(buffer); if (size > 0 && size <= MAX_IMAGE_DIMENSION) tmpCoverArt = oslLoadImageFileJPG(buffer, OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); } if (tmpCoverArt){ int coverArtWidth = skinGetParam("MEDIALIBRARY_COVERART_WIDTH"); int coverArtHeight = skinGetParam("MEDIALIBRARY_COVERART_HEIGHT"); coverArt = oslScaleImageCreate(tmpCoverArt, OSL_IN_RAM | OSL_SWIZZLED, coverArtWidth, coverArtHeight, OSL_PF_8888); oslDeleteImage(tmpCoverArt); tmpCoverArt = NULL; coverArt->stretchX = coverArtWidth; coverArt->stretchY = coverArtHeight; }else{ coverArtFailed = 1; } cpuRestore(); } } if (coverArt){ skinGetPosition("POS_MEDIALIBRARY_COVERART", tempPos); oslDrawImageXY(coverArt, tempPos[0], tempPos[1]); } break; } }
int mp3player() { mp3bg = oslLoadImageFilePNG(apolloBgPath, OSL_IN_RAM, OSL_PF_8888); mp3_select = oslLoadImageFilePNG(apolloSelectorPath, OSL_IN_RAM, OSL_PF_8888); if (!mp3bg || !mp3_select) debugDisplay(); oslSetFont(Roboto); int MenuSelection = 1; // Pretty obvious int selector_x = 8; //The x position of the first selection int selector_y = 43; //The y position of the first selection int selector_image_x; //Determines the starting x position of the selection int selector_image_y = 55; //Determines the starting y position of the selection int numMenuItems = 3; //Amount of items in the menu int selection = 0; while (!osl_quit) { LowMemExit(); selector_image_x = selector_x+(mp3XSelection*MenuSelection); //Determines where the selection image is drawn for each selection selector_image_y = selector_y+(mp3YSelection*MenuSelection); //Determines where the selection image is drawn for each selection oslStartDrawing(); oslReadKeys(); oslClearScreen(RGB(0,0,0)); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); oslDrawImageXY(mp3bg, 0, 0); oslDrawImageXY(mp3_select, selector_image_x, selector_image_y); oslDrawStringf(20,108,"MUSIC"); oslDrawStringf(20,163,"PSP/MUSIC"); oslDrawStringf(20,218,"PSP/GAME/CyanogenPSP/Downloads"); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); if (osl_keys->pressed.down) MenuSelection++; //Moves the selector down if (osl_keys->pressed.up) MenuSelection--; //Moves the selector up if (MenuSelection > numMenuItems) MenuSelection = 1; //Sets the selection to the first if (MenuSelection < 1) MenuSelection = numMenuItems; //Sets the selection back to last if (MenuSelection == 1 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(mp3bg); oslDeleteImage(mp3_select); mp3View("ms0:/MUSIC"); } else if (MenuSelection == 2 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(mp3bg); oslDeleteImage(mp3_select); mp3View("ms0:/PSP/MUSIC"); } else if (MenuSelection == 3 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); oslDeleteImage(mp3bg); oslDeleteImage(mp3_select); mp3View("ms0:/PSP/GAME/CyanogenPSP/downloads"); } if (osl_keys->pressed.circle) { oslDeleteImage(mp3bg); oslDeleteImage(mp3_select); appdrawer(); } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } return selection; }
void gatewayDraw() { oslDrawImageXY(gateway, gatewayx[0], gatewayy[0]); }
void powermenu() { power = oslLoadImageFilePNG("system/home/menu/powerMenu.png", OSL_IN_RAM, OSL_PF_8888); powerSelection = oslLoadImageFilePNG("system/home/menu/powerSelection.png", OSL_IN_RAM, OSL_PF_8888); recoverySelection = oslLoadImageFilePNG("system/home/menu/recoverySelection.png", OSL_IN_RAM, OSL_PF_8888); if (!power || !powerSelection || !recoverySelection) debugDisplay(); while (!osl_quit) { LowMemExit(); oslStartDrawing(); controls(); oslClearScreen(RGB(0,0,0)); oslDrawImage(background); oslDrawImageXY(ic_launcher_apollo, 105, 190); oslDrawImageXY(ic_launcher_browser, 276, 190); oslDrawImageXY(ic_launcher_settings, 331, 190); oslDrawImageXY(ic_launcher_messenger, 160, 190); navbarButtons(0); oslDrawImageXY(power, 100, 61); battery(370,2,1); digitaltime(420,4,0,hrTime); oslIntraFontSetStyle(Roboto, 0.75f, BLACK, 0, 0); oslDrawStringf(165, 100, "Power off"); oslDrawStringf(165, 165, "Recovery"); if (cursor->x >= 116 && cursor->x <= 364 && cursor->y >= 55 && cursor->y <= 125) { oslDrawImageXY(powerSelection, 100, 60); oslDrawStringf(165, 100, "Power off"); oslDrawStringf(165, 165, "Recovery"); if (osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); sceKernelExitGame(); } /*else if (osl_pad.held.cross) { scePowerRequestColdReset(0); scePowerRequestColdReset(50000); }*/ } if (cursor->x >= 116 && cursor->x <= 364 && cursor->y >= 126 && cursor->y <= 200) { oslDrawImageXY(recoverySelection, 100, 60); oslDrawStringf(165, 100, "Power off"); oslDrawStringf(165, 165, "Recovery"); if (osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); oslSyncFrame(); sceKernelDelayThread(3*1000000); oslDeleteImage(power); oslDeleteImage(powerSelection); oslDeleteImage(recoverySelection); mainRecoveryMenu(); } } oslDrawImage(cursor); if (osl_keys->pressed.circle) { oslDeleteImage(power); oslDeleteImage(powerSelection); oslDeleteImage(recoverySelection); return; } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } }
int soundPlay(char * path) { nowplaying = oslLoadImageFilePNG(nowplayingBgPath, OSL_IN_RAM, OSL_PF_8888); mp3Play = oslLoadImageFilePNG("system/app/apollo/play.png", OSL_IN_RAM, OSL_PF_8888); mp3Pause = oslLoadImageFilePNG("system/app/apollo/pause.png", OSL_IN_RAM, OSL_PF_8888); OSL_SOUND * sound = oslLoadSoundFile(path, OSL_FMT_NONE); if (!nowplaying) debugDisplay(); oslInitAudioME(3); oslPlaySound(sound,0); isPlaying = 1; int Play = 1; while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); oslReadKeys(); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); oslDrawImageXY(nowplaying, 0, 0); if (Play == 1) oslDrawImageXY(mp3Play, 230, 224); else if (Play == 0) oslDrawImageXY(mp3Pause, 230, 224); oslDrawStringf(240,76, "%.28s", folderIcons[current].name); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); if(osl_keys->pressed.select) { oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return 1; } if(osl_keys->pressed.cross && Play == 1) { Play = 0; oslPlaySound(KeypressStandard, 1); oslPauseSound(sound,-1); } else if(osl_keys->pressed.cross && Play == 0) { Play = 1; oslPlaySound(KeypressStandard, 1); oslPauseSound(sound,-1); } if(osl_keys->pressed.circle) { isPlaying = 0; oslStopSound(sound); oslDeleteSound(sound); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return 1; } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } oslStopSound(sound); oslDeleteSound(sound); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return 0; }
int bootAnimation() { int currentFrame = 0, i = 0; bootAnimActivator = setFileDefaultsInt("system/boot/bootAnimActivator.bin", 0, bootAnimActivator); firstBoot = setFileDefaultsInt("system/settings/boot.bin", 1, firstBoot); if (bootAnimActivator != 1) { if (firstBoot == 1) displayLangSelection("system/settings/language"); else firstBootInitiation(); } bootAnim[0] = oslLoadImageFilePNG("system/boot/part1/boot0.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[1] = oslLoadImageFilePNG("system/boot/part1/boot1.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[2] = oslLoadImageFilePNG("system/boot/part1/boot2.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[3] = oslLoadImageFilePNG("system/boot/part1/boot3.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[4] = oslLoadImageFilePNG("system/boot/part1/boot4.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[5] = oslLoadImageFilePNG("system/boot/part1/boot5.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[6] = oslLoadImageFilePNG("system/boot/part1/boot6.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[7] = oslLoadImageFilePNG("system/boot/part1/boot7.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[8] = oslLoadImageFilePNG("system/boot/part1/boot8.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[9] = oslLoadImageFilePNG("system/boot/part1/boot9.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[10] = oslLoadImageFilePNG("system/boot/part1/boot10.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[11] = oslLoadImageFilePNG("system/boot/part1/boot11.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); bootAnim[12] = oslLoadImageFilePNG("system/boot/part1/boot12.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); while(!osl_quit) { oslStartDrawing(); oslDrawImageXY(bootAnim[currentFrame], 80, -25); sceDisplayWaitVblankStart(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); sceKernelDelayThread(10000 * 2); currentFrame++; if(currentFrame > 12) { currentFrame = 0; i++; } if (i > 21) { for (i = 0; i <=12; i++) { oslDeleteImage(bootAnim[i]); } if (firstBoot == 1) displayLangSelection("system/settings/language"); else firstBootInitiation(); } } oslEndDrawing(); oslEndFrame(); oslSyncFrame(); return 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Main: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main(){ int skip = 0; int enabled = 1; int selectedConfig = 0; SetupCallbacks(); initOSLib(); oslIntraFontInit(INTRAFONT_CACHE_MED); oslNetInit(); //Loads image: bkg = oslLoadImageFilePNG("bkg.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); //Load font: OSL_FONT *font = oslLoadFontFile("flash0:/font/ltn0.pgf"); oslSetFont(font); if (!oslIsWlanPowerOn()) sprintf(message, "Please turn on the WLAN."); //Get connections list: struct oslNetConfig configs[OSL_MAX_NET_CONFIGS]; int numconfigs = oslGetNetConfigs(configs); if (!numconfigs){ sprintf(message, "No configuration found!"); enabled = 0; } while(runningFlag && !osl_quit){ if (!skip){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); if (enabled){ sprintf(buffer, "Press X to connect to %s.", configs[selectedConfig].name); oslDrawString(30, 50, buffer); oslDrawString(30, 80, "Press UP and DOWN to change settings."); } oslDrawString(30, 150, "Press /\\ to quit."); oslDrawString(30, 200, message); oslEndDrawing(); } oslEndFrame(); skip = oslSyncFrame(); oslReadKeys(); if (osl_keys->released.triangle) runningFlag = 0; if (osl_keys->released.cross){ connectToAP(selectedConfig + 1); }else if (osl_keys->released.up){ if (++selectedConfig >= numconfigs) selectedConfig = numconfigs - 1; }else if (osl_keys->released.down){ if (--selectedConfig < 0) selectedConfig = 0; } } //Quit OSL: oslNetTerm(); oslEndGfx(); sceKernelExitGame(); return 0; }
void MP3Play(char * path) { struct ID3Tag ID3; nowplaying = oslLoadImageFilePNG(nowplayingBgPath, OSL_IN_RAM, OSL_PF_8888); mp3Play = oslLoadImageFilePNG("system/app/apollo/play.png", OSL_IN_RAM, OSL_PF_8888); mp3Pause = oslLoadImageFilePNG("system/app/apollo/pause.png", OSL_IN_RAM, OSL_PF_8888); if (!nowplaying) debugDisplay(); scePowerSetClockFrequency(333, 333, 166); pspAudioInit(); int i, mp3Min = 0; MP3ME_Init(1); ParseID3(path, &ID3); MP3ME_Load(path); MP3ME_Play(); isPlaying = 1; while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); oslReadKeys(); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); if (MP3ME_playingTime > 59) { mp3Min += 1; MP3ME_playingTime = 0; } oslDrawImageXY(nowplaying, 0, 0); oslDrawStringf(240,76, "Playing: %.19s", folderIcons[current].name); oslDrawStringf(240,96, "Title: %.21s", ID3.ID3Title); oslDrawStringf(240,116, "Artist: %.20s", ID3.ID3Artist); oslDrawStringf(240,136, "Album: %.21s", ID3.ID3Album); oslDrawStringf(240,156, "Year: %.22s", ID3.ID3Year); oslDrawStringf(240,176, "Genre: %.21s", ID3.ID3GenreText); oslDrawStringf(435,206, "0%d:%.f", mp3Min, MP3ME_playingTime); if (MP3ME_isPlaying == 1) oslDrawImageXY(mp3Play, 230, 224); if (MP3ME_isPlaying == 0) oslDrawImageXY(mp3Pause, 230, 224); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); if(osl_keys->pressed.select) { oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return; } if(MP3ME_isPlaying == 1 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); MP3ME_Pause(); for(i=0; i<10; i++) { sceDisplayWaitVblankStart(); } } else if (MP3ME_isPlaying == 0 && osl_keys->pressed.cross) { MP3ME_Play(); } if (MP3ME_EndOfStream() == 1) { isPlaying = 0; endAudioLib(); MP3ME_Stop(); releaseAudio(); MP3ME_Play(); } if(osl_keys->pressed.circle) { endAudioLib(); MP3ME_Stop(); releaseAudio(); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); isPlaying = 0; setCpuBoot(); //Restore previous CPU state return; } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Main: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main(){ SetupCallbacks(); oslSrand(1); //Init network (for net conf dialog): oslNetInit(); int skip = 0; LedAnimFreq.f=2; const int calx1=-20,calx2=20,caly1=-20,caly2=20; //float fx,fy; float_or_int_t _movW,_movX,_movY,_movZ; DroneSck = oslNetSocketCreate(); DroneUdp = make_udpsocket(AT_PORT); initOSLib(); oslIntraFontInit(INTRAFONT_CACHE_MED); //Loads image: //OSL_IMAGE *bkg = oslLoadImageFileJPG("back1.jpg", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888); OSL_IMAGE *bkg = oslLoadImageFileJPG("back1.jpg", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_5650); OSL_IMAGE *img1 = oslCreateImage (130,130,OSL_IN_RAM,OSL_PF_8BIT); FirePalette (img1,255); oslClearImage (img1,0); //Load font: OSL_FONT *font = oslLoadFontFile("flash0:/font/ltn0.pgf"); oslSetFont(font); while(runningFlag && !osl_quit){ if (!skip){ oslStartDrawing(); oslDrawImageXY(bkg, 0, 0); oslReadKeys(); _movX.f = ((float)osl_pad.analogX/128)*mscale; _movY.f = ((float)osl_pad.analogY/128)*mscale; _movZ.f = 0; _movW.f = 0; if ((osl_pad.analogX > calx1) && (osl_pad.analogX < calx2)) _movX.f = 0; //Deadzone X if ((osl_pad.analogY > caly1) && (osl_pad.analogY < caly2)) _movY.f = 0; //Deadzone Y if (osl_pad.held.triangle) _movZ.f = delta; //Up if (osl_pad.held.cross) _movZ.f = -delta; //Down if (osl_pad.held.L) _movW.f = -delta; //CW if (osl_pad.held.R) _movW.f = delta; //CCW if (_movX.f==0 && _movY.f==0 && _movZ.f==0 && _movW.f==0) Hover=0; else Hover=1; oslDrawStringf(320, 10, "Tic#= %d",AT_SEQ); oslDrawStringf(10, 220, "x= %d y= %d z= %d w= %d !Hvr= %d",osl_pad.analogX,osl_pad.analogY,_movZ.i,_movW.i,Hover); oslDrawStringf(10, 240, "xf= %1.2f yf= %1.2f Scl= %1.2f",_movX.f,_movY.f,mscale); if (Connected==1) GameTic++; if (drawMenu==1) { Menu();} else { if (osl_pad.pressed.up) { //Drone.AddCmd "AT*ANIM=", CStr(Seq) & "," & Anim_Time(Seq) vb anim code snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_AHEAD,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_AHEAD],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.down) { snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_BEHIND,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_BEHIND],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.right) { snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_RIGHT,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_RIGHT],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.left) { snprintf(netbuf,1024,"AT*ANIM=%d,%d,%d%c",AT_SEQ++,ARDRONE_ANIM_FLIP_LEFT,MAYDAY_TIMEOUT[ARDRONE_ANIM_FLIP_LEFT],CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.start) { drawMenu=1;} if (osl_pad.pressed.circle){//Take off snprintf(netbuf,1024,"AT*REF=%d,%d%c",AT_SEQ++,AT_REF|512,CR);//TAKE OFF sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} if (osl_pad.pressed.square){//Land snprintf(netbuf,1024,"AT*REF=%d,%d%c",AT_SEQ++,AT_REF,CR); sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} } if (showjoypad) JoyPadGfx(img1); if (showfire) FireFx(img1); if (showjoypad||showfire) oslDrawImageXY(img1, 345, 85); oslEndDrawing(); } if (GameTic >= TicRoof){ GameTic=0; //snprintf(netbuf,1024,"AT*COMWDG=%d%cAT*PCMD=%d,%d,%d,%d,%d,%d%c",AT_SEQ++,CR,AT_SEQ++,Hover,_movX.i,_movY.i,_movZ.i,_movW.i,CR);//XY snprintf(netbuf,1024,"AT*PCMD=%d,%d,%d,%d,%d,%d%c",AT_SEQ++,Hover,_movX.i,_movY.i,_movZ.i,_movW.i,CR);//XY sendto(DroneUdp, netbuf, strlen(netbuf), 0, (struct sockaddr*)&dest, sizeof(dest));} oslEndFrame(); skip = oslSyncFrame(); } //Quit OSL: oslNetTerm(); oslEndGfx(); oslQuit(); sceKernelExitGame(); return 0; }