Example #1
0
int main()
{
    //Initial setup
    vbDisplayOn();

    //Copy tileset and tilemap into memory
    copymem((void*)CharSeg0, (void*)CHADJUSTMENT, 256*16);
    copymem((void*)BGMap(0), (void*)BGADJUSTMENT, 450*16);

    //Setup worlds
    //(This uses structs to access world data, the old method using functions is commented out)
    WA[31].head = (WRLD_LON|WRLD_OVR);
    WA[31].w = 384;
    WA[31].h = 224;
    //vbSetWorld(31, (WRLD_LON|WRLD_OVR), 0, 0, 0, 0, 0, 0, 384, 224);
    
    WA[30].head = (WRLD_RON|WRLD_OVR);
    WA[30].my = 224;
    WA[30].w = 384;
    WA[30].h = 224;
    //vbSetWorld(30, (WRLD_RON|WRLD_OVR), 0, 0, 0, 0, 0, 224, 384, 224);

    WA[29].head = WRLD_END;
    //vbSetWorld(29, WRLD_END, 0, 0, 0, 0, 0, 0, 0, 0);

    //Set brightness registers
    vbDisplayShow();

    //Main loop (Empty because we're done but don't want to reach the end)
    for (;;);

    return 0;
}
Example #2
0
void fade_and_wait()
{
	//vbFXFadeIn(3);
	vbDisplayShow();
	while(!vbPadKeyDown());
	vbDisplayHide();
	//vbFXFadeOut(3);
}
Example #3
0
/* The first thing that the user will see. */
void focus_screen_mainproc()
{
	timer_handle_t wait_timer;
	volatile int two_seconds_passed = 0; /* I wonder if this is undefined 
	behavior... as long as the variable doesn't go out of scope while the 
	timer's in effect, I should be okay... */
	
	
	//setmem((void*)BGMap(0), 0x00, 0x2000); /* Just use the zeroth char for all tiles */
	//copymem((void*)CharSeg0, (void*)char_line, 16); /* Only need to use 1 char! */
	
	/* Give time for mirrors to adjust... */
	
	load_warning_scr();
	vbDisplayShow();
	
	/* Failure of this function is grounds for halting the program! */
	wait_timer = request_timer(200, set_true, &two_seconds_passed);
	//while(!(two_seconds_passed && vbPadKeyDown()));
	fade_and_wait();
	vbDisplayHide();
	remove_timer(wait_timer);
	
	load_ipdfoc_scr();
	fade_and_wait();
	//vbDisplayOn();
	
	//curr_game_
	//vbPadKeyDown();
	//while(vbPadKeyDown() != K_BTNS);
	
	/* jump_to_reset(); */
	/* return TRI_DEMO; */
	
	
}
Example #4
0
void triangle_mainproc()
{
	WA[31].head = WRLD_END;
	vbDisplayShow();
	int poly_count;

	/* Bind vector to routine */
	vpu_vector = (unsigned long) vpu_int;
	frame_begin = 0;

	VIP_REGS[INTENB] = 0;
	VIP_REGS[INTENB] |= XPEND;

	while(!(vbPadKeyDown()))
	{
		//int i;
		/* for(i = 0; i < 384; i++)
		{
			plot_point(i, i, i/12);
		} */
		//Synchronize with display
		while(!frame_has_begun());

		//Draw lines until VIP says that "need to draw"

		//Worst case performance test
		/*
		draw_line(create_point(0, 0, 0), create_point(383, 223, 0));
		draw_line(create_point(0, 0, 0), create_point(383, 223, 0));
		draw_line(create_point(0, 0, 0), create_point(383, 223, 0));
		*/


		/* Bresenham test pattern */
		/* abs(tan(x/y)) = 0.26 (15 degrees) */
		draw_line(create_point(192, 112, 0), create_point(383, 62, 0));
		draw_line(create_point(192, 112, 0), create_point(0, 62, 0));
		draw_line(create_point(192, 112, 0), create_point(0, 162, 0));
		draw_line(create_point(192, 112, 0), create_point(383, 162, 0));

		/* abs(tan(x/y)) = sqrt(3) */
		draw_line(create_point(192, 112, 0), create_point(258, 0, 0));
		draw_line(create_point(192, 112, 0), create_point(126, 0, 0));
		draw_line(create_point(192, 112, 0), create_point(126, 223, 0));
		draw_line(create_point(192, 112, 0), create_point(258, 223, 0));

		/* abs(tan(x/y)) = 1/sqrt(3) (About equal to aspect ratio) */
		draw_line(create_point(192, 112, 0), create_point(383, 0, 0));
		draw_line(create_point(192, 112, 0), create_point(0, 0, 0));
		draw_line(create_point(192, 112, 0), create_point(0, 223, 0));
		draw_line(create_point(192, 112, 0), create_point(383, 223, 0));

		/* Vertical/horizontal */
		draw_line(create_point(192, 112, 0), create_point(383, 112, 0));
		draw_line(create_point(192, 112, 0), create_point(192, 0, 0));
		draw_line(create_point(192, 112, 0), create_point(0, 112, 0));
		draw_line(create_point(192, 112, 0), create_point(192, 223, 0));



		/* Bresenham test pattern */
		/* abs(tan(x/y)) = 0.26 (15 degrees) */
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {383, 62, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {0, 62, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {0, 162, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {383, 162, 0});
		//
		///* abs(tan(x/y)) = sqrt{3} */
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {258, 0, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {126, 0, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {126, 223, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {258, 223, 0});
		//
		///* abs(tan(x/y)) = 1/sqrt{3} (About equal to aspect ratio) */
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {383, 0, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {0, 0, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {0, 223, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {383, 223, 0});
                //
		///* Vertical/horizontal */
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {383, 112, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {192, 0, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {0, 112, 0});
		//draw_line((VB_POINT) {192, 112, 0}, (VB_POINT) {192, 223, 0});


		//draw_line(create_point(0, 0, 0), create_point(383, 223, 0));
		//draw_line(create_point(0, 0, 0), create_point(383, 223, 0));
		//poly_count++;
	}


	vbDisplayHide();
	jump_to_reset();
}