예제 #1
0
//---------------------------------------------------------------------------------
int main(void) {
	short scrX=0, scrY=0;
	unsigned short pad0, move;

    // Initialize SNES 
	consoleInit();

	// Copy tiles to VRAM
	bgInitTileSet(0, &LandTiles, &LandPalette, 1, (&LandTiles_end - &LandTiles), (&LandPalette_end - &LandPalette), BG_16COLORS, 0x0000);
	bgInitTileSet(2, &CloudTiles, &CloudPalette, 0, (&CloudTiles_end - &CloudTiles), (&CloudPalette_end - &CloudPalette),  BG_4COLORS, 0x1000);

	// Copy Map to VRAM
	bgInitMapSet(0, &Maps, (&Maps_end - &Maps),SC_32x32, 0x2000);
	bgInitMapSet(2, &Mapsc, (&Mapsc_end - &Mapsc),SC_32x32, 0x2400);

	// Now Put in 16 color mode and put cloud on top of screen
	setMode(BG_MODE1,BG3_MODE1_PRORITY_HIGH); bgSetDisable(1);  

	// Set BG3 SubScreen and 
	bgSetEnableSub(2);
	
	// enable Subscreen Color ADD/SUB and Color addition on BG1 and Backdrop color
	setColorEffect(CM_SUBBGOBJ_ENABLE, CM_MSCR_BACK | CM_MSCR_BG1);

	// Wait for nothing :P
	while(1) {
        // change scrolling 
	    scrX++; 
		bgSetScroll(2, scrX,0);

		WaitForVBlank();
	}
	return 0;
}
예제 #2
0
//---------------------------------------------------------------------------------
int main(void) {
    // Initialize SNES 
	consoleInit();
	
	// Put current handler to our function
	spr_queue = 0xff; spr_mutex = 0;
	__nmi_handler=myconsoleVblank; 

	// Init Sprites gfx and palette with default size of 16x16 (and don't load sprite tiles)
	oamInitGfxSet(&gfxpsrite, 2, &palsprite, 16*2, 0, ADRGFXSPR, OBJ_SIZE16);

	// Define sprites parmaters
	oamSet(0,  100, 100, 3, 0, 0, 0, 0); // Put sprite in 100,100, with maximum priority 3 from tile entry 0, palette 0
	oamSetEx(0, OBJ_SMALL, OBJ_SHOW);
	
	// Now Put in 16 color mode and disable all backgrounds
	setMode(BG_MODE1,0); bgSetDisable(0); bgSetDisable(1); bgSetDisable(2);

	// add new sprite to queue
	addSprite(&gfxpsrite, ADRGFXSPR);
	
	// Wait for nothing :P
	while(1) {
			// Refresh pad values in VBL and Get current #0 pad
		pad0 = padsCurrent(0);
		
		if (pad0) {
			// Key A pressed
			if(pad0 & KEY_A) {
				// if not yet pressed
				if (padkeya == 0) {
					padkeya=1;  // avoid adding new sprite continuisly
					// add new sprite to queue
					addSprite((&gfxpsrite)+8*4*2, ADRGFXSPR);
				}
				
			}
			else
				padkeya=0;
		}
		
		// Wait VBL 'and update sprites too ;-) )
		WaitForVBlank();
	}
	return 0;
}
예제 #3
0
파일: Mode1.c 프로젝트: beletsky/pvsneslib
//---------------------------------------------------------------------------------
int main(void) {
    // Initialize SNES 
	consoleInit();
	 
	// Copy tiles to VRAM
	bgInitTileSet(0, &patterns, &palette, 0, (&patterns_end - &patterns), (&palette_end - &palette), BG_16COLORS, 0x4000);

	// Copy Map to VRAM
	bgInitMapSet(0, &map, (&map_end - &map),SC_32x32, 0x0000);

	// Now Put in 16 color mode and disable other BGs except 1st one
	setMode(BG_MODE1,0);  bgSetDisable(1); bgSetDisable(2);
	
	// Wait for nothing :P
	while(1) {
		WaitForVBlank();
	}
	return 0;
}
예제 #4
0
파일: splash.c 프로젝트: nArnoSNES/ac2016
//---------------------------------------------------------------------------------
void splash(void) {
   
    int counter = 0;
	consoleInitText(0, 0, &snesfont);
	consoleSetShadowCol(0,RGB15(16,16,16));

	setMode(BG_MODE1,0);  bgSetDisable(1);  bgSetDisable(2);

	consoleDrawText(12,10,"WARNING !");
	consoleDrawText(1,14,"This is game is played in Tate");
	consoleDrawText(2,16,"(Screen should be vertical)");

	while(counter<400) {
		counter++;
		WaitForVBlank();
	}

	consoleDrawText(12,10,"         ");
	consoleDrawText(1,14,"                              ");
	consoleDrawText(2,16,"                           ");
	return;
}
예제 #5
0
//---------------------------------------------------------------------------------
int main(void) {
	u16 scrX=0, scrY=0;
	u16 pad0, move;

    // Initialize SNES 
	consoleInit();
    
    // Initialize text console with our font
	consoleInitText(0, 1, &snesfont);

	// Copy tiles to VRAM
	bgInitTileSet(1, &patterns, &palette, 0, (&patterns_end - &patterns), 16*2, BG_16COLORS, 0x4000);

	// Copy Map to VRAM
	bgInitMapSet(1, &map, (&map_end - &map),SC_64x64, 0x1000);

	// Now Put in 16 color mode and disable last BG
	setMode(BG_MODE1,0);  bgSetDisable(2);
	
	// Wait for nothing :P
	while(1) {
        // no move currently
        move = 0;
        
		// Refresh pad values
		scanPads();
		
		// Get current #0 pad
		pad0 = padsCurrent(0);
		
		// Update scrolling with current pad
		switch (pad0) {
			case KEY_RIGHT	: scrX+=2; move = 1; break;
			case KEY_LEFT	: scrX-=2; move = 1; break;
			case KEY_DOWN	: scrY+=2; move = 1; break;
			case KEY_UP		: scrY-=2; move = 1; break;
		}
        if (move) bgSetScroll(1, scrX,scrY);
		
        // Just inform user
        consoleDrawText(0,0,"SCR X=%d Y=%d",scrX,scrY);

		WaitForVBlank();
	}
	return 0;
}
예제 #6
0
파일: Mode1.c 프로젝트: Aliandrana/snesnet
int main(void) {
    // Initialize SNES 
	consoleInit();

    // Initialize text console with our font
	consoleInitText(0, 1, &snesfont);

	 
	// Copy tiles to VRAM
	bgInitTileSet(1, &patterns, &palette, 0, (&patterns_end - &patterns), (&palette_end - &palette), BG_16COLORS, 0x4000);

	// Copy Map to VRAM
	bgInitMapSet(1, &map, (&map_end - &map),SC_32x32, 0x0000);

	// Now Put in 16 color mode and disable other BGs except 1st one
	//setMode(BG_MODE1,0);  bgSetDisable(1); bgSetDisable(2);
		setMode(BG_MODE1,0);  bgSetDisable(2);
	
	// Just inform user
 //   consoleDrawText(1,1,"test text");
	
	// Wait for nothing :P
	//while(1) {
	//	WaitForVBlank();
	//}
	
	
	
	sendByte(0x02);	//send magic byte
	
	
	int pad0;
	int set=0;
		while(1) {
			set=0;

		// Refresh pad values
		scanPads();
		
		// Get current #0 pad
		pad0 = padsCurrent(0);
		clean();
		// Update scrolling with current pad
		switch (pad0) {
			case  KEY_UP	:
								set=1;
								consoleDrawText(22,14,"g");   //7 r
								consoleDrawText(22,19,"a");   //1 x
								 consoleDrawText(25,21,"b");  //2 a
								 consoleDrawText(22,23,"c");  //3 b
								 consoleDrawText(20,21,"d");  //4 y
								 consoleDrawText(12,20,"e");  //5 se 
								 consoleDrawText(15,20,"f");  //6 st
								 				 			
								break;
			case  KEY_RIGHT	:  
								set=2;
								consoleDrawText(22,14,"n"); 
								consoleDrawText(22,19,"h"); 
								 consoleDrawText(25,21,"i"); 
								 consoleDrawText(22,23,"j");
								 consoleDrawText(20,21,"k");
								 consoleDrawText(12,20,"l");
								 consoleDrawText(15,20,"m");  			
							break;
			case KEY_DOWN	:  
								set=3;
								consoleDrawText(22,14,"u"); 
								consoleDrawText(22,19,"o"); 
								 consoleDrawText(25,21,"p"); 
								 consoleDrawText(22,23,"q");
								 consoleDrawText(20,21,"r");
								 consoleDrawText(12,20,"s");
								 consoleDrawText(15,20,"t");  				
							break;
			case 	KEY_LEFT	:  
								set=4;
								consoleDrawText(20,14,"blank"); 
								consoleDrawText(22,19,"v"); 
								 consoleDrawText(25,21,"w"); 
								 consoleDrawText(22,23,"x");
								 consoleDrawText(20,21,"y");
								 consoleDrawText(12,20,"z");
								 consoleDrawText(15,20," ");  				
							break;
			case 	KEY_L	: 
			
							if(pos!=0){	pos--;
								str[pos]=0x00;
								consoleDrawText(3+pos,9,"                          ");
							}
						while(pad0 & KEY_L){
												
							scanPads();
							pad0 = padsCurrent(0);
						}
						
							break;		
			case 	KEY_R	: 
			
						sendString();
						while(pad0 & KEY_R){
												
							scanPads();
							pad0 = padsCurrent(0);
						}
						
							break;											
		}
		
/*
   KEY_A      = BIT(7),  //!< pad A button.
  KEY_B      = BIT(15),  //!< pad B button.
  KEY_SELECT = BIT(13),  //!< pad SELECT button.
  KEY_START  = BIT(12),  //!< pad START button.
  KEY_RIGHT  = BIT(8),  //!< pad RIGHT button.
  KEY_LEFT   = BIT(9),  //!< pad LEFT button.
  KEY_DOWN   = BIT(10),  //!< pad DOWN button.
  KEY_UP     = BIT(11),  //!< pad UP button.
  KEY_R      = BIT(4),  //!< Right shoulder button.
  KEY_L      = BIT(5),  //!< Left shoulder button.
  KEY_X      = BIT(6), //!< pad X button.
  KEY_Y      = BIT(14), //!< pad Y button.
  * */

									
			
		if(  (pad0&KEY_UP)&&(pad0&KEY_A)  ){ addChar(11,7,'b'); }
		if(  (pad0&KEY_UP)&&(pad0&KEY_B)  ){ addChar(11,15,'c'); }
		if(  (pad0&KEY_UP)&&(pad0&KEY_X)  ){ addChar(11,6,'a'); }
		if(  (pad0&KEY_UP)&&(pad0&KEY_Y)  ){ addChar(11,14,'d'); }		
		if(  (pad0&KEY_UP)&&(pad0&KEY_START)  ){ addChar(11,12,'f'); }		
		if(  (pad0&KEY_UP)&&(pad0&KEY_SELECT)  ){ addChar(11,13,'e'); }		
		if(  (pad0&KEY_UP)&&(pad0&KEY_R)  ){ addChar(11,4,'g'); }		
		
		if(  (pad0&KEY_DOWN)&&(pad0&KEY_A)  ){ addChar(10,7,'p'); }
		if(  (pad0&KEY_DOWN)&&(pad0&KEY_B)  ){ addChar(10,15,'q'); }
		if(  (pad0&KEY_DOWN)&&(pad0&KEY_X)  ){ addChar(10,6,'o'); }
		if(  (pad0&KEY_DOWN)&&(pad0&KEY_Y)  ){ addChar(10,14,'r'); }		
		if(  (pad0&KEY_DOWN)&&(pad0&KEY_START)  ){ addChar(10,12,'t'); }		
		if(  (pad0&KEY_DOWN)&&(pad0&KEY_SELECT)  ){ addChar(10,13,'s'); }		
		if(  (pad0&KEY_DOWN)&&(pad0&KEY_R)  ){ addChar(10,4,'u'); }	
		
		if(  (pad0&KEY_LEFT)&&(pad0&KEY_A)  ){ addChar(9,7,'w'); }
		if(  (pad0&KEY_LEFT)&&(pad0&KEY_B)  ){ addChar(9,15,'x'); }
		if(  (pad0&KEY_LEFT)&&(pad0&KEY_X)  ){ addChar(9,6,'v'); }
		if(  (pad0&KEY_LEFT)&&(pad0&KEY_Y)  ){ addChar(9,14,'y'); }		
		//if(  (pad0&KEY_LEFT)&&(pad0&KEY_START)  ){ addChar(9,12,'f'); }		
		if(  (pad0&KEY_LEFT)&&(pad0&KEY_SELECT)  ){ addChar(9,13,'z'); }		
		if(  (pad0&KEY_LEFT)&&(pad0&KEY_R)  ){ addChar(9,4,' '); }	
				
		if(  (pad0&KEY_RIGHT)&&(pad0&KEY_A)  ){ addChar(8,7,'i'); }
		if(  (pad0&KEY_RIGHT)&&(pad0&KEY_B)  ){ addChar(8,15,'j'); }
		if(  (pad0&KEY_RIGHT)&&(pad0&KEY_X)  ){ addChar(8,6,'h'); }
		if(  (pad0&KEY_RIGHT)&&(pad0&KEY_Y)  ){ addChar(8,14,'k'); }		
		if(  (pad0&KEY_RIGHT)&&(pad0&KEY_START)  ){ addChar(8,12,'m'); }		
		if(  (pad0&KEY_RIGHT)&&(pad0&KEY_SELECT)  ){ addChar(8,13,'l'); }		
		if(  (pad0&KEY_RIGHT)&&(pad0&KEY_R)  ){ addChar(8,4,'n'); }			
		
		
		

		consoleDrawText(7,3,"snesnet text demo");

        consoleDrawText(7,14,"back");
        if(set==0) consoleDrawText(20,14,"send");
        consoleDrawText(6,17,"set");
        
        
		WaitForVBlank();
	}
	
	return 0;
}