void JoyPadGfx(OSL_IMAGE *img1){ static int jx;int jy,i,v; static int np; static u8 *rawdata; //oslLockImage(img1); for (i=0;i<130;i++){ rawdata=(u8*)oslGetImageLine(img1, i); for (v=0;v<130;v++){ np=*rawdata; if (np>2){ np=np-3; *rawdata=np; } rawdata++; } } jx=1+((osl_pad.analogX+128)/2); jy=1+((osl_pad.analogY+128)/2); rawdata=(u8*)oslGetImageLine(img1, jy); *(rawdata+jx-1)=255; *(rawdata+jx)=255; *(rawdata+jx+1)=255; rawdata=(u8*)oslGetImageLine(img1, jy-1); *(rawdata+jx)=255; rawdata=(u8*)oslGetImageLine(img1, jy+1); *(rawdata+jx)=255; //oslUnlockImage(img1); //oslDrawStringf(30, 50, "L1= %d",(int)oslGetImageLine(img1, 1)); //oslDrawStringf(30, 70, "L2= %d",(int)oslGetImageLine(img1, 2)); //oslDrawStringf(30, 90, "L3= %d",(int)oslGetImageLine(img1, 3)); //remember to draw image at main!! }
void FireFx(OSL_IMAGE *img1){ int x,y,np; const int decay=1; u8 *rawdata1; u8 *rawdata2; //oslLockImage(img1); rawdata1=(u8*)oslGetImageLine(img1, 129); for (x=1;x<128;x++){ np=oslRandf(0,1)*255; *rawdata1=np; rawdata1++; } for (y=1;y<130;y++){ rawdata1=(u8*)oslGetImageLine(img1, y); rawdata2=(u8*)oslGetImageLine(img1, y+1); for (x=1;x<129;x++){ np=(*(rawdata1+x-1) + *(rawdata1+x) + *(rawdata1+x+1) + *(rawdata2+x))/4; np=np-decay; if (np<0) np=0; rawdata2=(u8*)oslGetImageLine(img1, y-1); *(rawdata2+x)=np; } } //Remember to draw image at main!! }
static OSL_IMAGE *logoCreeImageFond() { OSL_IMAGE *fond; unsigned char *data; int i, j; fond = oslCreateImage(480, 272, OSL_IN_RAM, OSL_PF_8BIT); if (!fond) return 0; fond->palette = oslCreatePalette(256, OSL_PF_8888); if (!fond->palette) { oslDeleteImage(fond); return 0; } for (j=0;j<HEIGHT;j++) { data = (unsigned char*)oslGetImageLine(fond, j); for (i=0;i<WIDTH/2;i++) { *data++ = i; *data++ = i; } } oslUncacheImage(fond); return fond; }
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); }