Пример #1
0
void Screen::update()
{
  BMI bmi;
  getBMI(&bmi, 0);

  fillPixelFormat(&bmi);
  fillScreenRect();
}
Пример #2
0
void DrawPaddle(Paddle *p) {
	// Ensure paddle stays in the playable game area
	if (p->yPos + p->h >= SCREEN_HEIGHT) p->yPos = SCREEN_HEIGHT - p->h; else if (p->yPos <= SCREEN_START) p->yPos = SCREEN_START;
	p->xPosOld = p->xPos; p->yPosOld = p->yPos; // Mark the paddle position
	// Draw the paddle
	fillScreenRect(p->color, p->xPos, p->yPos, p->w, p->h);
	drawRectScreen(0xFF000000, p->xPos, p->yPos, p->w, p->h);
}
//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(); }}
//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();
	}
}
Пример #6
0
int main()
{
    initGraphics();
    SceCtrlData pad, pad_old;
    sceCtrlReadBufferPositive(&pad_old, 1);
    
    starfield.nb_stars = 0;
    starfield.z_move = 1;
    starfield_add_stars(&starfield, 600);
    
    while(1) {
    	fillScreenRect(RGB(0, 0, 0), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

      starfield_move_and_draw(&starfield);
	  Print(0,0,RGB(255, 255, 255),"StarField - Ported to the TIFF exploit by BlackSith");
	  Print(2,1,RGB(255, 255, 255),"Originally ported to the PSP by Karmon");
	  Print(0,30,RGB(255, 255, 255),"..Press Start to Exit..");

      //char str_buffer[40];
      if(t_disp > 0)
      {
         t_disp--;
         //sprintf(str_buffer, sizeof(str_buffer), "Stars:%d \nSpeed:%d", starfield.nb_stars, starfield.z_move);
         //print(3, SCREEN_HEIGHT-10, RGB(255, 255, 255), str_buffer);
      }

      /*if(frame == 0)
      {
         gettimeofday(&tv, NULL);
         start_fps = tv.tv_sec;
      }

      if(show_fps > 0)
      {
         gettimeofday(&tv, NULL);
         //snprintf(str_buffer, sizeof(str_buffer), "FPS: %ld", frame/(tv.tv_sec-start_fps+1));
         //printTextScreen(3, 3, str_buffer, RGB(255, 255, 255));
      }*/
      frame++;
    
      sceCtrlReadBufferPositive(&pad, 1);
      if(pad.Buttons != pad_old.Buttons){
      	pad_old = pad;
        if(pad.Buttons & PSP_CTRL_UP) {
          starfield.z_move++;
          t_disp = MSG_DISP_TIME;
      } else if(pad.Buttons & PSP_CTRL_DOWN) {
          starfield.z_move--;
          t_disp = MSG_DISP_TIME;
        }
        if(pad.Buttons & PSP_CTRL_RIGHT) {
          starfield_add_stars(&starfield, 100);
          t_disp=MSG_DISP_TIME;
      } else if(pad.Buttons & PSP_CTRL_LEFT) {
          starfield_del_stars(&starfield, 100);
          t_disp=MSG_DISP_TIME;
        }
        if(pad.Buttons & PSP_CTRL_CROSS) {
          if(show_fps > 0)
            show_fps--;
          else
            show_fps++;
			  }
			}
			flipScreen();
			sceDisplayWaitVblankStart();
		if(pad.Buttons & PSP_CTRL_START) { vshKernelExitVSHVSH(0); }
		}

    //sceKernelSleepThread();
    return(0);
}