コード例 #1
0
ファイル: screens.c プロジェクト: CalivmaInnovation/FlyBoard
void credits() {
	cpct_memset(SCR_VMEM, 0, 0x4000);
	cpct_drawStringM0 ("CREDITS", getScreenPosition(6, 0), 15, 0);

	cpct_drawStringM0 ("DEVELOPERS", getScreenPosition(5, 3), 15, 0);
	cpct_drawStringM0 ("Cesar Ivorra Oliver", getScreenPosition(1, 5), 15, 0);
	cpct_drawStringM0 ("Alex Almira Molla", getScreenPosition(1, 7), 15, 0);

	cpct_drawStringM0 ("GAME POWERED BY", getScreenPosition(2, 11), 15, 0);
	cpct_drawStringM0 ("CPCtelera", getScreenPosition(5, 13), 15, 0);

	cpct_drawStringM0 ("SPECIAL THANKS", getScreenPosition(3, 18), 15, 0);
	cpct_drawStringM0 ("Francisco Gallego", getScreenPosition(1, 20), 15, 0);

	cpct_drawStringM0 ("Press Space", getScreenPosition(4, 23), 15, 0);
	cpct_drawStringM0 ("to go main menu", getScreenPosition(2, 24), 15, 0);
	cpct_scanKeyboard_f ();
	while (!cpct_isKeyPressed(Key_Space)) {
		cpct_waitVSYNC();
		cpct_akp_musicPlay();

		cpct_scanKeyboard_f ();
	}
	gameScene=MENUSCREEN;
}
コード例 #2
0
ファイル: main.c プロジェクト: amm297/amstrad
/*MENU*/
int menu(){
   u8* memptr;
   int init = 50;
   int pushed =0;
   int cont =0;
   cpct_clearScreen(0);

   memptr = cpct_getScreenPtr(VMEM,10,10);
   cpct_drawSprite(portada1,memptr,60,60);

   //Opciones
   memptr = cpct_getScreenPtr(VMEM,20,90);
   cpct_drawStringM0("Nueva Partida",memptr,1,0);

   memptr = cpct_getScreenPtr(VMEM,20,110);
   cpct_drawStringM0("Creditos",memptr,1,0);

   memptr = cpct_getScreenPtr(VMEM,20,130);
   cpct_drawStringM0("Constroles",memptr,1,0);

   memptr = cpct_getScreenPtr(VMEM,20,150);
   cpct_drawStringM0("Salir",memptr,1,0);

    /*memptr = cpct_getScreenPtr(VMEM,18,180);
   cpct_drawStringM0("Pulsa Intro",memptr,4,5);*/

   //Indicador
   while(1){

      cpct_scanKeyboard();
      if(cpct_isKeyPressed(Key_CursorDown) && cont > 150){
        cpct_drawSolidBox(memptr, 0, 2, 8);
        if(pushed<3) pushed ++;
        cont =0;
      }
      if(cpct_isKeyPressed(Key_CursorUp) && cont > 150){
        cpct_drawSolidBox(memptr, 0, 2, 8);
        if(pushed>0) pushed --;
        cont = 0;
      }

      switch (pushed){
        case 0: init = 90;break;
        case 1: init = 110;break;
        case 2: init = 130;break;
        case 3: init = 150;break;
      }
      memptr = cpct_getScreenPtr(VMEM,15,init);
      cpct_drawSprite(marcador,memptr, 2, 8);
      if(cpct_isKeyPressed(Key_Space)){
        switch (pushed){
        case 0: return 1;break;
        case 1: return 2;break;
        case 2: return 3;break;
        case 3: return 0;break;
      }
      }
      cont++;
   }
}
コード例 #3
0
ファイル: main.c プロジェクト: AugustoRuiz/cpctelera
//
// MAIN: Using keyboard to move a sprite example
//
void initialize() {
   u8* pvideomem;               // Pointer to video memory

   // Disable firmware to prevent it from interfering with setPalette and setVideoMode
   cpct_disableFirmware();

   // Set up the hardware palette using hardware colour values
   cpct_setPalette(g_palette, 16);
   cpct_setBorder(HW_BLACK);
   
   // Set video mode 0 (160x200, 16 colours)
   cpct_setVideoMode(0);

   // Draw floor. As cpct_drawSolidBox cannot draw boxes wider than 63 bytes
   // and Screen width is 80 bytes, we draw 2 boxes of SCR_W/2 (40 bytes) each
   pvideomem = cpct_getScreenPtr(CPCT_VMEM_START,       0, FLOOR_Y);
   cpct_drawSolidBox(pvideomem, FLOOR_COLOR, SCR_W/2, FLOOR_HEIGHT);
   pvideomem = cpct_getScreenPtr(CPCT_VMEM_START, SCR_W/2, FLOOR_Y);
   cpct_drawSolidBox(pvideomem, FLOOR_COLOR, SCR_W/2, FLOOR_HEIGHT);

   // Draw instructions
   pvideomem = cpct_getScreenPtr(CPCT_VMEM_START,  0, 20);
   cpct_drawStringM0("  Sprite Flip Demo  ", pvideomem, 2, 0);   
   pvideomem = cpct_getScreenPtr(CPCT_VMEM_START,  0, 34);
   cpct_drawStringM0("[Cursor]",   pvideomem, 4, 0);
   pvideomem = cpct_getScreenPtr(CPCT_VMEM_START, 40, 34);
   cpct_drawStringM0("Left/Right", pvideomem, 3, 0);
}
コード例 #4
0
ファイル: game.c プロジェクト: AugustoRuiz/cpctelera
////////////////////////////////////////////////////////////////////////////////
// Initializes elements of the screen on the initialization of a new game
//
void initializeGameScreen(u16 hiscore) {
   u8* pscr;   // Pointer to the screen location where we want to draw
   u8  c;      // Colour pattern to draw
   u8  str[6]; // Score
   
   // Clear the screen
   cpct_clearScreen(0);

   //
   // Draw backgrounds and Hi-Score
   //
   c = cpct_px2byteM0(8,8);  // Colour pattern 8-8 (black-black)
   
   // Draw black background for scoreboard
   pscr = cpct_getScreenPtr(CPCT_VMEM_START, 54,   0);  
   cpct_drawSolidBox(pscr, c, 26, 200);

   // Draw "HI" string 
   pscr = cpct_getScreenPtr(CPCT_VMEM_START, 60,  16);   
   cpct_drawStringM0("HI", pscr, 3, 8);

   // Draw HI-Score
   pscr = cpct_getScreenPtr(CPCT_VMEM_START, 60,  24);
   sprintf(str, "%5u", hiscore);
   cpct_drawStringM0(str, pscr, 15, 8);

   // Draw Credits
   pscr = cpct_getScreenPtr(CPCT_VMEM_START, 60, 172);
   cpct_drawSprite(G_credits, pscr, 20, 27);

   // Draw tiled frame around playing area
   drawFrame(CPCT_VMEM_START, 0);
}
コード例 #5
0
ファイル: screens.c プロジェクト: CalivmaInnovation/FlyBoard
void mainMenu() {
		u8 option=0;
		cpct_etm_setTileset2x4(g_tile_tileset_bg);
		cpct_etm_drawTilemap2x4_f(MAP_WIDTH_TILES, MAP_HEIGHT_TILES, SCR_VMEM, g_background);

		cpct_drawSprite (g_tile_titulo, getScreenPosition(5, 2), 32, 16);
		cpct_drawStringM0 ("PLAY GAME", getScreenPosition(5, 5), 15, 7);
		cpct_drawStringM0 ("CONTROLS", getScreenPosition(5, 7), 15, 7);
		cpct_drawStringM0 ("CREDITS", getScreenPosition(5, 9), 15, 7);

		initScroll();
		initPlayer();
		cpct_scanKeyboard_f ();
		do {
		    waitNVSYNCs(3);
			cpct_akp_musicPlay();

			Road();
			drawPlayer();
			if ( cpct_isKeyPressed (Key_CursorUp) && option != 0) {
				--option;
			}
			else if ( cpct_isKeyPressed (Key_CursorDown) && option != 2) {
				++option;
			}

			switch (option) {
				case 0:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 7), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(3, 5), 4, 8);
					break;
				case 1:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 5), 4, 8);
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 9), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(3, 7), 4, 8);
					break;
				case 2:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 7), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(3, 9), 4, 8);
					break;
			}
			cpct_scanKeyboard_f ();
//			waitNVSYNCs(5);
	} while (!cpct_isKeyPressed(Key_Return));

		switch (option) {
    		case 0:	playMenu();
				break;
    		case 1: 
				gameScene=CONTROLSSCREEN;
				break;
		    case 2: 
				gameScene=CREDITSSCEENE;
				break;
		}
}
コード例 #6
0
ファイル: screens.c プロジェクト: CalivmaInnovation/FlyBoard
void playMenu() {
		u8 option=0;

		cpct_etm_setTileset2x4(g_tile_tileset_bg);
		cpct_etm_drawTilemap2x4_f(MAP_WIDTH_TILES, MAP_HEIGHT_TILES, SCR_VMEM, g_background);

		cpct_drawSprite (g_tile_titulo, getScreenPosition(5, 2), 32, 16);
		cpct_drawStringM0 ("PLAY GAME", getScreenPosition(5, 5), 15, 7);
		cpct_drawStringM0 ("INFINITY MODE", getScreenPosition(6, 7), 15, 7);
		cpct_drawStringM0 ("LEVELS MODE", getScreenPosition(6, 9), 15, 7);

		initScroll();
		initPlayer();
		cpct_scanKeyboard_f ();
		do {
			waitNVSYNCs(3);
			cpct_akp_musicPlay();
			Road();
			drawPlayer();
			if ( cpct_isKeyPressed (Key_Esc)) {
				gameScene=MENUSCREEN;
				return;
			}
			else if ( cpct_isKeyPressed (Key_CursorUp) && option != 0) {
				--option;
			}
			else if ( cpct_isKeyPressed (Key_CursorDown) && option != 1) {
				++option;
			}

			switch (option) {
				case 0:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(4, 9), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(4, 7), 4, 8);
					break;
				case 1:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(4, 7), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(4, 9), 4, 8);
					break;
			}
			cpct_scanKeyboard_f ();
//			waitNVSYNCs(5);
	} while (!cpct_isKeyPressed(Key_Return));

		switch (option) {
			case 0:
				cpct_akp_stop();
				gameScene=PLAYGAMESCREEN;
				break;
			case 1:
				cpct_akp_stop();
				gameScene=NEXTLEVELSCREEN;
				break;
		}
}
コード例 #7
0
ファイル: message.c プロジェクト: Trewdbal/cpctelera
void drawMessage() {
   // Draw message only if there is time to draw it
   if (g_message.time > 1) {
      // Draw the message
      cpct_drawStringM0(g_message.str, g_message.videopos, 1, 0);
      g_message.time--;
   } else if (g_message.time > 0) {
      // Clean the message
      cpct_drawStringM0(g_message.str, g_message.videopos, 0, 0);
      g_message.time=0;
   }
}
コード例 #8
0
ファイル: screens.c プロジェクト: CalivmaInnovation/FlyBoard
void newLevel() {
	u8 str[6];
	initLevel();
	sprintf(str, "%2u", level);
	cpct_memset(SCR_VMEM, 0, 0x4000);
	cpct_drawStringM0 ("LEVEL", getScreenPosition(7, 11), 15, 0);
	cpct_drawStringM0 (str, getScreenPosition(13, 11), 15, 0);
	cpct_drawStringM0 ("Press Space", getScreenPosition(4, 23), 15, 0);
	cpct_drawStringM0 ("to go next level", getScreenPosition(2, 24), 15, 0);
	cpct_scanKeyboard_f ();
	while (!cpct_isKeyPressed(Key_Space)) {
		cpct_scanKeyboard_f ();
	}
	levelMode();
}
コード例 #9
0
ファイル: main.c プロジェクト: amm297/amstrad
/* CREDITOS */
void credits(){
u8* memptr;
  cpct_clearScreen(0);

  memptr = cpct_getScreenPtr(VMEM, 18, 30); 
  cpct_drawStringM0("Grupo Pyxis", memptr, 1, 0); 

  memptr = cpct_getScreenPtr(VMEM, 23, 60); 
  cpct_drawStringM0("Miembros:", memptr, 1, 0); 
  
  memptr = cpct_getScreenPtr(VMEM, 10, 80); 
  cpct_drawStringM0("Alberto Martinez", memptr,2, 0); 
  memptr = cpct_getScreenPtr(VMEM, 27, 95); 
  cpct_drawStringM0("Martinez", memptr,2, 0); 
  
  memptr = cpct_getScreenPtr(VMEM, 13, 115); 
  cpct_drawStringM0("Josep Domenech", memptr,2, 0);
  memptr = cpct_getScreenPtr(VMEM, 27, 125); 
  cpct_drawStringM0("Mingot", memptr, 2, 0);  

  memptr = cpct_getScreenPtr(VMEM, 12, 175); 
  cpct_drawStringM0("Pulsa espacio", memptr, 1, 0); 



  while (1){
    cpct_scanKeyboard_f();
     if(cpct_isKeyPressed(Key_Space)) {

        return;
      }

   }
}
コード例 #10
0
ファイル: main.c プロジェクト: amm297/amstrad
/* Controles */
void controles(){
  u8* memptr;
  cpct_clearScreen(0);

  memptr = cpct_getScreenPtr(VMEM, 23, 60); 
  cpct_drawStringM0("Controles:", memptr, 1, 0); 
  
  memptr = cpct_getScreenPtr(VMEM, 11, 80); 
  cpct_drawStringM0("Movimiento: ", memptr, 2, 0); 
  memptr = cpct_getScreenPtr(VMEM, 27, 95); 
  cpct_drawStringM0("Flechas", memptr, 2, 0); 
  
  memptr = cpct_getScreenPtr(VMEM, 13, 115); 
  cpct_drawStringM0("Esc: Menu", memptr, 2, 0); 
  memptr = cpct_getScreenPtr(VMEM, 13, 130); 
  cpct_drawStringM0("Disparar: X", memptr, 2, 0); 

  memptr = cpct_getScreenPtr(VMEM, 12, 175); 
  cpct_drawStringM0("Pulsa espacio", memptr, 1, 0); 

   while (1){
    cpct_scanKeyboard_f();
     if(cpct_isKeyPressed(Key_Space)) {

        return;
      }

   }
}
コード例 #11
0
ファイル: main.c プロジェクト: amm297/amstrad
/*GAME OVER*/
void gameOver(){
    u8* memptr;
  cpct_clearScreen(0);
  memptr = cpct_getScreenPtr(VMEM,10,10);
  cpct_drawStringM0("Lounge Gladiator",memptr,1,0);

    memptr = cpct_getScreenPtr(VMEM,10,50);
   cpct_drawSprite(gameover,memptr,60,28);


  memptr = cpct_getScreenPtr(VMEM, 12, 175); 
  cpct_drawStringM0("Pulsa espacio", memptr, 1, 0); 



  while (1){
    cpct_scanKeyboard_f();
     if(cpct_isKeyPressed(Key_Space)) {

        return;
      }

   }
}
コード例 #12
0
ファイル: game.c プロジェクト: AugustoRuiz/cpctelera
////////////////////////////////////////////////////////////////////////////////
// Shows messages at the end of the game and asks for keypress for starting again
//
void showGameEnd(u16 score) {
   u8* pscr;   // Pointer to the screen place where to show messages
   u8  str[6]; // String array to draw numbers on screen

   // Draw GAME OVER string
   pscr = cpct_getScreenPtr(CPCT_VMEM_START,  8, 24);
   cpct_drawStringM0("GAME  OVER", pscr, 6, 0);

   // Draw SCORE string
   pscr = cpct_getScreenPtr(CPCT_VMEM_START, 16, 48);
   cpct_drawStringM0(  "SCORE", pscr, 9, 0);

   // Draw the score got in this game
   pscr = cpct_getScreenPtr(CPCT_VMEM_START, 16, 56);
   sprintf(str, "%5u", score);
   cpct_drawStringM0(str, pscr, 14, 0);

   // Draw PRESS SPACE string
   pscr = cpct_getScreenPtr(CPCT_VMEM_START, 6, 112);
   cpct_drawStringM0("PRESS SPACE", pscr, 11, 0);

   // Wait for SPACE being pressed before continuing
   wait4Key(Key_Space);
}
コード例 #13
0
ファイル: screens.c プロジェクト: CalivmaInnovation/FlyBoard
void controls() {
	cpct_memset(SCR_VMEM, 0, 0x4000);
	cpct_drawStringM0 ("CONTROLS", getScreenPosition(5, 3), 15, 0);

	cpct_drawStringM0 ("W: Move Up", getScreenPosition(4, 7), 15, 0);
	cpct_drawStringM0 ("S: Move Down", getScreenPosition(4, 9), 15, 0);
	cpct_drawStringM0 ("A: Move Left", getScreenPosition(4, 11), 15, 0);
	cpct_drawStringM0 ("D: Move Right", getScreenPosition(4, 13), 15, 0);

	cpct_drawStringM0 ("Press Space", getScreenPosition(4, 23), 15, 0);
	cpct_drawStringM0 ("to go main menu", getScreenPosition(2, 24), 15, 0);

	cpct_scanKeyboard_f ();
	while (!cpct_isKeyPressed(Key_Space)) {
		cpct_waitVSYNC();
		cpct_akp_musicPlay();
		cpct_scanKeyboard_f ();
	}
	// gameScene=MENUSCREEN;
	gameScene=MENUSCREEN;
}
コード例 #14
0
ファイル: main.c プロジェクト: lronaldo/cpctelera
////////////////////////////////////////////////////////////////////////////////
// Sets a video memory buffer with a background colour and a string
// drawn in the middle of the screen
//
void setUpVideoBuffer(u8* vmem, u16 c_pattern, u8* string, u8 pen, u8 bpen) {
   cpct_memset_f64(vmem, c_pattern, VMEM_SIZE);
   vmem = cpct_getScreenPtr(vmem, 0, 80);
   cpct_drawStringM0(string, vmem, pen, bpen);
}