예제 #1
0
void disfringe(){
	 int y=0;
	 int x=0;
	 int yy;
	 int xx;
	 int xtile;
	 int ytile;
	 
	 for(yy=0;yy<17;yy++){
		 for(xx=0;xx<30;xx++){
			 x=xx+starttx;
			 y=yy+startty;
			 if( mappe[0][0][y][x][3] > 1){
				 ytile=floor(mappe[0][0][y][x][3] / tilesetw);
				 xtile=mappe[0][0][y][x][3]-((ytile)*tilesetw);
				 blitAlphaImageToScreen(xtile*16 ,ytile*16,unita , unita, tile, xx*unita, yy*unita);
			 }
			 if( mappe[0][0][y][x][4] > 1){
				 ytile=floor(mappe[0][0][y][x][4] / tilesetw);
				 xtile=mappe[0][0][y][x][4]-((ytile)*tilesetw);
				 blitAlphaImageToScreen(xtile*16 ,ytile*16,unita , unita, tile, xx*unita, yy*unita);
			 }
			 if( mappe[0][0][y][x][5] > 1){
				 if(mappe[0][0][y][x][5] == 2){
				 	 printTextScreen(xx*unita+5,yy*unita+5,"B", RGB(255,0,0));
				 }else{
				 	 printTextScreen(xx*unita+5,yy*unita+5,"?", RGB(0,0,0));
				 }
			 }
	 	 }
	 }
}
예제 #2
0
void loadTheme()
{
	int i, bytesRead;

	SceUID fp;
	fp = sceIoOpen("ms0:/lockdown.thm", PSP_O_RDONLY, 0777);

	if (fp < 0)
	{
		fp = sceIoOpen("flash0:/lockdown.thm", PSP_O_RDONLY, 0777);

		if (fp < 0)
		{
			printTextScreen(0, 0, "Error loading flash0:/lockdown.thm.", RGB(255, 0, 0));
			printTextScreen(0, 8, "Place theme at ms0:/lockdown.thm to load from memory stick.", RGB(255, 0, 0));
			sceDisplayWaitVblankStart();
			flipScreen();
			sceKernelSleepThread();
		}
	}

	for (i = 0; i < NUMFILES; i++)
	{
		bytesRead = sceIoRead(fp, &images[i].hdr, sizeof(imagehdr));
		if (bytesRead != sizeof(imagehdr))
		{
			printTextScreen(0, 0, "Unexpected end of header.", RGB(255, 0, 0));
			sceDisplayWaitVblankStart();
			flipScreen();
			sceKernelSleepThread();
		}
		images[i].blockid = sceKernelAllocPartitionMemory(2, "block", 0, (sizeof(unsigned char) * images[i].hdr.size), NULL);
		if (images[i].blockid < 0)
		{
			printTextScreen(0, 0, "Memory allocation error.", RGB(255, 0, 0));
			sceDisplayWaitVblankStart();
			flipScreen();
			sceKernelSleepThread();
		}
		images[i].data = (unsigned char*) sceKernelGetBlockHeadAddr(images[i].blockid);
		bytesRead = sceIoRead(fp, images[i].data, images[i].hdr.size);
		if (bytesRead != images[i].hdr.size)
		{
			printTextScreen(0, 0, "Unexpected end of data.", RGB(255, 0, 0));
			sceDisplayWaitVblankStart();
			flipScreen();
			sceKernelSleepThread();
		}
	}

	sceIoClose(fp);
}
//pauses the game
//
//
//
//
void Pause(Image* theme0,Image* theme1)
{SceCtrlData pad;
int timer = 0;

Color White = RGB(255, 255, 255);
Color Black = RGB(0, 0, 0); 

while(1)
{
	sceCtrlReadBufferPositive(&pad, 1);
	timer++;

	if (pad.Buttons & PSP_CTRL_START)
	{ timer++;
	if (timer > 14)
	{ break;
	}
	}

	if (pad.Buttons & PSP_CTRL_TRIANGLE)
	{ timer++;
	if (timer > 14)
	{ break;
	}
	}

	if (timer == 14)
	{timer = 0;
	}

	fillScreenRect(Black, 0, 0, 480, 272);
	blitAlphaImageToScreen(0, 0, 90, 272, theme0, 0, 0);
	blitAlphaImageToScreen(0, 0, 90, 272, theme1, 390, 0);
	if (timer < 7)
	{
		printTextScreen(210,  130, "PAUSE", White);
	}
	if (timer > 7)
	{
		printTextScreen(210,  130, "PAUSE", Black);
	}

	sceDisplayWaitVblankStart();
	flipScreen(); }}
예제 #4
0
//FPS
void FPS() {
    time_t currentTime;
    time(&currentTime);
    // aumenta il frame a ogni ciclo
    ++framesPerSecond;
    if( difftime (currentTime,lastTime) > 1.0f ) {
        lastTime = currentTime;
        sprintf(strFrameRate,"Fps: %d", (int)framesPerSecond);// inserisce nella variabile la frase
        framesPerSecond = 0;
    }
    printTextScreen(5,5,strFrameRate,RGB(255,0,0));
}
//shows the current round the player is at
void RoundDisplay(int Round)
{
	char RoundAsChar[3];
	int timer = 0; 
	Color White = RGB(255, 255, 255);
	Color Black = RGB(0, 0, 0);

	while(1)
	{timer++;
	if (timer == 150)
	{ break;
	}

	fillScreenRect(Black, 0, 0, 480, 272);   
	printTextScreen(200,  135, "Round", White);
	sprintf(RoundAsChar, "%d", Round);
	printTextScreen(250, 135, RoundAsChar, White);
	sceDisplayWaitVblankStart();
	flipScreen();
	}
}
//shows the game over screen
//
//
//
void GameOver(int Score)
{
	char ScoreAsChar[5];
	int timer = 0; 
	Color White = RGB(255, 255, 255);
	Color Black = RGB(0, 0, 0);

	while(1)
	{
		timer++;
		if (timer == 300)
		{ break;
		}

		fillScreenRect(Black, 0, 0, 480, 272);   
		sprintf(ScoreAsChar, "%d", Score);
		printTextScreen(245, 145, ScoreAsChar, White);
		printTextScreen(200, 145, "Score:", White);
		printTextScreen(200,  135, "Game Over", White);
		sceDisplayWaitVblankStart();
		flipScreen();
	}
}
예제 #7
0
파일: main.c 프로젝트: bensaraceno/PSP
void DisplayReservedBalls(int rBalls) {
	static char rb[10];
	sprintf(rb, "Reserve Balls %d", rBalls);
	printTextScreen(1, 30, rb, COLOR_RED);
}
예제 #8
0
파일: main.c 프로젝트: bensaraceno/PSP
void DisplayCurrentScore(int s) {
	static char scoreStr[20];
	sprintf(scoreStr, "Current Score: %d", s);
	printTextScreen(1, 20, scoreStr, COLOR_RED);
}
예제 #9
0
파일: main.c 프로젝트: bensaraceno/PSP
void DisplayHighScore(int hs) {
	static char hScoreStr[20];
	sprintf(hScoreStr, "High Score: %d", hs);
	printTextScreen(1, 10, hScoreStr, COLOR_RED);
}
예제 #10
0
void scrividbg(int x,int y,char *frase,int variabile) {
    char numero[100];
    sprintf(numero,"%s%d",frase, (int)variabile);
    printTextScreen(x,y,numero,RGB(255,0,0));
}