Пример #1
0
void display_Input(int angle, int velocity )
{

	char buffer[11]; //stores string to print
	const float multipler_to_make_out_of_100 = 1.34;
	alt_up_char_buffer_string(char_buffer, "Angle: ", 0, 1);
	sprintf(buffer, "%d", angle); //convert int to string

	//To display 3 digits all the time, we need to add '0's in front if value is less than 3 digits
	if (angle < 10)
	{

		buffer[2] = buffer[0];
		buffer[1] = '0';
		buffer[0] = '0';

	}
	else if(angle < 100)
	{
		buffer[2] = buffer[1];
		buffer[1] = buffer[0];
		buffer[0] = '0';
	}

	buffer[3] ='\0';

	alt_up_char_buffer_string(char_buffer, buffer, 6, 1);
	sprintf(buffer, "%d", (int)(velocity * multipler_to_make_out_of_100));


	if (velocity * multipler_to_make_out_of_100 < 10)
	{

		buffer[2] = buffer[0];
		buffer[1] = '0';
		buffer[0] = '0';

	}
	else if(velocity * multipler_to_make_out_of_100 < 100)
	{
		buffer[2] = buffer[1];
		buffer[1] = buffer[0];
		buffer[0] = '0';
	}

	buffer[3] ='\0';

	alt_up_char_buffer_string(char_buffer, "Power: ", 11, 1);
	alt_up_char_buffer_string(char_buffer, buffer, 21, 1);

	//charge bar: top left is fixed, while bottom right is dependent on velocity
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x0_chargeBar, y0_chargeBar, (velocity) + x0_chargeBar, chargeBar_Width +  y0_chargeBar, 0xF800, 0);
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x0_chargeBar, y0_chargeBar, (velocity) + x0_chargeBar, chargeBar_Width +  y0_chargeBar, 0xF800, 1);

}
Пример #2
0
/* Draws bullet */
void draw_bullet(alt_up_pixel_buffer_dma_dev* pixel_buffer, int x_start, int y_start, int color) {
	if(!levelThreeFlag){
		alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_start, y_start, x_start + 2, y_start + 2, color, 0);
	}
	else if(levelThreeFlag){
		if((x_start+2) < FOG){
			alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_start, y_start, x_start + 2, y_start + 2, color, 0);

		}
	}
}
Пример #3
0
void drawPartGraph(unsigned char* voltArray, unsigned elementCount){
	//calculate the width of every element
	float f = 307 / elementCount;
	int elementWidth = (int)f;
	int lastElementWidth = 307 - ((elementCount - 1) * elementWidth);
	int temp;
	for (temp = 0 ; temp < elementCount-1; ++temp ){
		alt_up_pixel_buffer_dma_draw_box(pixel_buffer_dev, drawX0 + temp * elementWidth, voltArray[temp], drawX0 + (temp+1) * elementWidth,drawY1, INFOCOLOR,backbuffer);
	}
	//draw the last element
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer_dev,drawX1 -lastElementWidth, voltArray[elementCount-1], drawX1, drawY1, INFOCOLOR,backbuffer);
	//alt_up_pixel_buffer_dma_draw_box(pixel_buffer_dev, drawX0 + (elementCount - 2) * lastElementWidth, voltArray[elementCount-1], drawX1,drawY1, INFOCOLOR,backbuffer);
	return;
}
/* Draws ocean and planks background */
void draw_ocean(alt_up_pixel_buffer_dma_dev* pixel_buffer){
	int i,j;
	int pixel_el = 0;
	int color_inc = 0x0001;

	// Draws planks
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 45, 14, 240, 0x79E5, 0);
	for(i = 45; i < 240; i+=4 ) {
		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, 0, 14, i, BLACK, 0);
	}

	// Draws ocean
	for(i = 45; i < 240; i++) {
		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, 14, 320, i, BLACK + color_inc, 0);
		if(i == 85) {
			printf("Y = %i COLOR_inc = %X\n", i, color_inc);
		}
		if(i % 8 == 0) {
			//printf("%X\n", BLACK + color_inc);
			color_inc++;
		}

	}

}
Пример #5
0
void draw_how_to_play_guide(alt_up_pixel_buffer_dma_dev* pixel_buffer, alt_up_char_buffer_dev* char_buffer) {
	alt_up_char_buffer_clear(char_buffer);
	draw_menu_text(char_buffer);
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 31, 320, 240, BLACK, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 70, 10, 140, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 0, 10, 70, 30, YELLOW, 0);
	alt_up_char_buffer_string(char_buffer, "O B J E C T I V E", 3, 12);
	alt_up_char_buffer_string(char_buffer, "_________________", 3, 13);
	alt_up_char_buffer_string(char_buffer, "In SHARKS VS. BABIES, players play as babies, trying to protect their", 3, 15);
	alt_up_char_buffer_string(char_buffer, "base against the enemy sharks. The player can purchase towers using the", 3, 17);
	alt_up_char_buffer_string(char_buffer, "resources currently avalable to them and place them on a grid in order to", 3, 19);
	alt_up_char_buffer_string(char_buffer, "fight the enemy sharks. Each tower is unique and has different attributes.", 3, 21);
	alt_up_char_buffer_string(char_buffer, "However, be wary that each type of shark has different attributes and some", 3, 23);
	alt_up_char_buffer_string(char_buffer, "towers may be more or less effective against the different types of sharks.", 3, 25);
	alt_up_char_buffer_string(char_buffer, "The objective of the game is to prevent the sharks from reaching the dock.", 3, 27);
	alt_up_char_buffer_string(char_buffer, "A C Q U I R I N G  R E S O U R C E S", 3, 32);
	alt_up_char_buffer_string(char_buffer, "____________________________________", 3, 33);
	alt_up_char_buffer_string(char_buffer, "Resources can be acquired in two ways:", 3, 35);
	alt_up_char_buffer_string(char_buffer, "1) Resources will periodically fall from the sky. The player can attempt to", 3, 38);
	alt_up_char_buffer_string(char_buffer, "obtain these resources by navigating a boat at the top of the screen.", 3, 40);
	alt_up_char_buffer_string(char_buffer, "There are three types of resources, each yielding a different amount.", 3, 42);
	alt_up_char_buffer_string(char_buffer, "2) The player can place a resource generating tower that slowly generates", 3, 45);
	alt_up_char_buffer_string(char_buffer, "resources for the player. Note that these towers cannot attack the enemies", 3, 47);
	alt_up_char_buffer_string(char_buffer, "and have low HP.", 3, 49);

}
Пример #6
0
void prepareBackground(void){
	alt_up_pixel_buffer_dma_clear_screen(pixel_buffer_dev, backbuffer);  //Clear the backbuffer
	//Main lines
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer_dev, 0, 0, 319, 239, BACKGROUNDCOLOR, backbuffer); //Make the backbuffer the correct color
	alt_up_pixel_buffer_dma_draw_hline(pixel_buffer_dev, 12,  319, 226,SYSLINECOLOR, backbuffer); //Draw the horizontal sysline to the backbuffer
	alt_up_pixel_buffer_dma_draw_vline(pixel_buffer_dev, 12, 0, 226,SYSLINECOLOR, backbuffer); //Draw the vertical line
}
Пример #7
0
/* If one or two player will collide, this function will call another function for winning/losing animation.
	Check Collision
		Resets game if collision detected
		Draw Box of black to wipe game screen
	Else
		Update Player Positions

	Update Screen

*/
void UpdateGame( struct Player* Player1, struct Player* Player2, int** Grid, int *GameStatus, alt_up_pixel_buffer_dma_dev* pixel_buffer) {
	int terminate =0;
	//===========================================================
	// Check Collision
	terminate = CheckPlayerCollision( Player1, Player2, Grid);


	if (terminate != 0){

		//===========================================================
		// If collision detected
		*GameStatus = 0;
		GameReset(Player1, Player2, Grid);

		//===========================================================
		// Draws black box to clear the positions
		alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 150, 45, 299, 194, 0, 0);

		// Display win or lose

	}

	else{
		//===========================================================
		// Updating the grid
		UpdatePositions( Player1, Player2, Grid);

		//===========================================================
		// Draw pixels where the players are
		UpdateScreen(Player1, Player2, pixel_buffer);
	}
}
Пример #8
0
void draw_qnote_on_sheetmusic(alt_up_pixel_buffer_dma_dev * pixel_buffer, int pitch, int location)
// FUNCTION: Draws a quarter note with the given pitch at the given location to the back buffer
// REQUIRES: 0 <= pitch <= 7 && 0 <= location <= 15
// RETURNS: None
{
	// Symbolic constants
	int h_spacing = 18;
	int first_note_left = 21;
	int lowc_bottom = 153;

	// Declare variables
	int left, right, top, bottom;

	left = first_note_left + location*h_spacing;
	right = left + 8;
	bottom = lowc_bottom - 5*pitch;
	top = bottom - 6;

	// Draw note with stem
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, left, bottom, right, top, 0x0000, 1);
	if(pitch<6) // Draw stem extending upwards
		alt_up_pixel_buffer_dma_draw_vline(pixel_buffer, right, top, top-32, 0x0000, 1);
	else // Draw stem extending downwards
		alt_up_pixel_buffer_dma_draw_vline(pixel_buffer, left, bottom, bottom+32, 0x0000, 1);

	// Check if the pitch is low C, and if so draw an extra horizontal line
	if(pitch==0)
		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, left-3, right+3, bottom-3, 0x0000, 1);
}
void draw_boardwalk(alt_up_pixel_buffer_dma_dev* pixel_buffer) {
	int i;
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 45, 14, 240, 0x79E5, 0);
	for(i = 45; i < 240; i+=4 ) {
		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, 0, 14, i, BLACK, 0);
	}
}
Пример #10
0
int main()
{
	alt_up_pixel_buffer_dma_dev* pixel_buffer;
	pixel_buffer = alt_up_pixel_buffer_dma_open_dev("/dev/video_pixel_buffer_dma_0");
	if (pixel_buffer == 0) {
		printf("error initializing pixel buffer (check name in alt_up_pixel_buffer_dma_open_dev)\n");
	}
	alt_up_pixel_buffer_dma_change_back_buffer_address(pixel_buffer, PIXEL_BUFFER_BASE);
	alt_up_pixel_buffer_dma_swap_buffers(pixel_buffer);
	while (alt_up_pixel_buffer_dma_check_swap_buffers_status(pixel_buffer));
	alt_up_pixel_buffer_dma_clear_screen(pixel_buffer, 0);

	int hw = 0;
	if (hw) {
           IOWR_32DIRECT(drawer_base,0,10); // Set x1
           IOWR_32DIRECT(drawer_base,4,20); // Set y1
           IOWR_32DIRECT(drawer_base,8,50); // Set x2
           IOWR_32DIRECT(drawer_base,12,60); // Set y2
           IOWR_32DIRECT(drawer_base,16,0xFFFF);  // Set colour
           IOWR_32DIRECT(drawer_base,20,1);  // Start drawing
           while(IORD_32DIRECT(drawer_base,20)==0); // wait until done
 	} else {
           alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 10,20,50,60,0xFFFF,0);
 	}
    return 0;
}
Пример #11
0
void draw_help_menu(alt_up_pixel_buffer_dma_dev* pixel_buffer, alt_up_char_buffer_dev* char_buffer, alt_up_ps2_dev *ps2_kb, KB_CODE_TYPE  decode_mode) {
	int count = 0;
	int exit_flag = 0;
	int current_menu = HOW_TO_PLAY_MENU;
	alt_u8 data;
	char ascii;
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 10, 319, 30, BLUE, 0);
	draw_menu_text(char_buffer);
	draw_how_to_play_guide(pixel_buffer, char_buffer);
	while(exit_flag == 0) {
		if (decode_scancode(ps2_kb, &decode_mode, &data, &ascii) == 0) {
			if(data == LEFT || data == RIGHT || data == ESC) count++;
			if(data == LEFT && count >= 2) {
				if(current_menu != HOW_TO_PLAY_MENU) current_menu--;
				draw_current_menu(pixel_buffer, char_buffer, current_menu);
				count = 0;
			}
			if(data == RIGHT && count >= 2) {
				if(current_menu != DEVS_MENU) current_menu++;
				draw_current_menu(pixel_buffer, char_buffer, current_menu);
				count = 0;
			}
			if(data == ESC && count >= 2) {
				exit_flag = 1;
			}
		}

	}
	alt_up_char_buffer_clear(char_buffer);
	alt_up_pixel_buffer_dma_clear_screen(pixel_buffer, 0);
}
Пример #12
0
/*
 * System clock that run the animation for all objects in the environment
 */
alt_u32 my_alarm_callback (void* paras)
{
	if(lock == 1) return alt_ticks_per_second()/1000;
	int i;
	for(i = 0; i < ((struct Env*)paras)->size; i++) {
		if((*(((struct Env*)paras)->o+i))->isRunable == 1 ) {
			(*(((struct Env*)paras)->o+i))->animate(&((*(((struct Env*)paras)->o+i))->currImg),
						(*(((struct Env*)paras)->o+i))->x, (*(((struct Env*)paras)->o+i))->y, (*(((struct Env*)paras)->o+i))->scale, 1,
						*(((struct Env*)paras)->o+i), ((struct Env*)paras)->m);
			if((*(((struct Env*)paras)->o+i))->curr_frame < 40000000)
				(*(((struct Env*)paras)->o+i))->curr_frame++;
			else
				(*(((struct Env*)paras)->o+i))->curr_frame = 1;
			if((*(((struct Env*)paras)->o+i))->curr_frame > (*(((struct Env*)paras)->o+i))->end_frame)
				(*(((struct Env*)paras)->o+i))->action((void*)(((struct Env*)paras)->o[i]));
			if((*(((struct Env*)paras)->o+i))->curr_frame == (*(((struct Env*)paras)->o+i))->end_frame) {
				alt_up_pixel_buffer_dma_draw_box(pixel_buffer,(*(((struct Env*)paras)->o+i))->x, (*(((struct Env*)paras)->o+i))->y, (*(((struct Env*)paras)->o+i))->x+(*(((struct Env*)paras)->o+i))->scale+10, (*(((struct Env*)paras)->o+i))->y+(*(((struct Env*)paras)->o+i))->scale+10, 0x0000, 0);
				setXY_noBound(*(((struct Env*)paras)->o+i), 150, 500);
			} else if((*(((struct Env*)paras)->o+i))->curr_frame == (*(((struct Env*)paras)->o+i))->end_frame+2) {
				(*(((struct Env*)paras)->o+i))->isRunable = 0;
			}
		}

	}
	if(((struct Env*)paras)->redraw) {
		redraw(((struct Env*)paras)->m);
		((struct Env*)paras)->redraw = false;
	}
	return alt_ticks_per_second()/15; //100ms
}
Пример #13
0
void eraser_rb(alt_up_pixel_buffer_dma_dev* pixel_buffer, int location, int x_location, int CORRECT_ZONE_HEIGHT)
// FUNCTION: Draws over the note at the given location in the appropriate background colour to the backbuffer
// REQUIRES: 1 <= location <= 60 && 1 <= x_location <= 80 && 1 <= CORRECT_ZONE_HEIGHT <= 50
// RETURNS: None
{
	if(location < 55 - CORRECT_ZONE_HEIGHT - 2) // location is completely outside of correct zone. Erase in blue background colour.
	{
#if 1
		// Draw double thickness square in blue background colour
		alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, x_location*4 - 9, location*4 - 12, x_location*4 + 11, location*4 + 8,0x122B, 1);

		alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, x_location*4 - 8, location*4 - 11,  x_location*4 + 10, location*4 + 7,0x122B, 1);

		alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_location*4 - 9, location*4 - 16,  x_location*4 + 11, location*4 - 13,0x122B, 1);

#endif

#if 0
		alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_location*4 - 9, location*4 - 16,  x_location*4 + 11, location*4 + 10,0x122B, 1);
#endif
	}
	else // Some overlap with correct zone. Redraw a portion of the correct zone
	{
#if 1
		// Draw double thickness square in blue background colour
		alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, x_location*4 - 9, location*4 - 12, x_location*4 + 11, location*4 + 8,0x122B, 1);

		alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, x_location*4 - 8, location*4 - 11,  x_location*4 + 10, location*4 + 7,0x122B, 1);

		alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_location*4 - 9, location*4 - 16,  x_location*4 + 11, location*4 - 13,0x122B, 1);

#endif

#if 0
		// alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_location*4 - 9, location*4 - 16,  x_location*4 + 11, location*4 + 10,0x122B, 1);
#endif

		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, x_location*4 - 9, x_location*4 + 11, 220-4*CORRECT_ZONE_HEIGHT, 0x0000, 1); // Top of the correct zone

		alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_location*4 - 9, 221-4*CORRECT_ZONE_HEIGHT,  x_location*4 + 11, 219, 0xCCCC, 1); // Correct zone

		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, x_location*4 - 9, x_location*4 + 11, 220, 0x0000, 1); // Bottom of the correct zone

	}
}
Пример #14
0
void draw_sharks_guide(alt_up_pixel_buffer_dma_dev* pixel_buffer, alt_up_char_buffer_dev* char_buffer){
	alt_up_char_buffer_clear(char_buffer);
	draw_menu_text(char_buffer);
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 31, 320, 240, BLACK, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 70, 10, 140, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 195, 10, 260, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 140, 10, 190, 30, YELLOW, 0);

	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 62, 40, 102, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 62, 82, 102, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 16, 22);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 16, 24);
	alt_up_char_buffer_string(char_buffer, "A.RATE: X", 16, 26);
	alt_up_char_buffer_string(char_buffer, "SPEED: XX", 16, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 16, 30);

	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 40, 154, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 82, 154, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 29, 22);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 29, 24);
	alt_up_char_buffer_string(char_buffer, "A.RATE: X", 29, 26);
	alt_up_char_buffer_string(char_buffer, "SPEED: XX", 29, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 29, 30);

	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 40, 204, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 82, 204, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 42, 22);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 42, 24);
	alt_up_char_buffer_string(char_buffer, "A.RATE: X", 42, 26);
	alt_up_char_buffer_string(char_buffer, "SPEED: XX", 42, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 42, 30);

	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 218, 40, 258, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 218, 82, 258, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 55, 22);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 55, 24);
	alt_up_char_buffer_string(char_buffer, "A.RATE: X", 55, 26);
	alt_up_char_buffer_string(char_buffer, "SPEED: XX", 55, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 55, 30);

	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 140, 154, 180, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 182, 154, 232, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 29, 47);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 29, 49);
	alt_up_char_buffer_string(char_buffer, "A.RATE: X", 29, 51);
	alt_up_char_buffer_string(char_buffer, "SPEED: XX", 29, 53);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 29, 55);

	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 140, 204, 180, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 182, 204, 232, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 42, 47);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 42, 49);
	alt_up_char_buffer_string(char_buffer, "A.RATE: X", 42, 51);
	alt_up_char_buffer_string(char_buffer, "SPEED: XX", 42, 53);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 42, 55);

}
Пример #15
0
void set_UserTank(int* angle, int* velocity, psController ps, tank* user, tank* enemy, terrain tr)
{
	char done_Charging = 0;
	char hasxBeenPressed = 0;

	//Draw background of power bar
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x0_chargeBar, y0_chargeBar, (MAX_VELOCITY) + x0_chargeBar, chargeBar_Width +  y0_chargeBar, 0x7BEF, 0);
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x0_chargeBar, y0_chargeBar, (MAX_VELOCITY) + x0_chargeBar, chargeBar_Width +  y0_chargeBar, 0x7BEF, 1);
	//loop continues until x is pressed and released, a collision occurs, or velocity maxed out
	while(done_Charging == 0)
	{
		update_Controller_Keys(&ps);
		set_Angle( angle, ps);
		done_Charging = set_Velocity( velocity, ps);

		if(ps.b.x == 1)
			hasxBeenPressed = 1;

		//X has been released
		if(ps.b.x == 0 && hasxBeenPressed == 1)
			done_Charging = 1;

		if(ps.b.right == 1)
		{
			moveTank(user, 2, 1); //go right
			drawTank(user, tr);
			drawTank(enemy, tr);
			updateVGA();
		}
		else if(ps.b.left)
		{
			moveTank(user, 1, 1); // go left
			drawTank(user, tr);
			drawTank(enemy, tr);
			updateVGA();
		}
		display_Input(*angle, *velocity);
		delay();
	}


}
void draw_sharkfin(alt_up_pixel_buffer_dma_dev * pixel_buffer, int x_start, int y_start, int color) {
	int c = 1;
	int y;
	int i,j;
	int pixel_el = 0;
/*	for(y = y_start; y < y_start + 24; y++) {
		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, x_start, x_start + c , y, color , 0);
		x_start--;
		c++;
	}*/

	for(i = y_start; i < y_start+30; i++)
	{

		for(j = x_start; j < x_start+25; j++){


			if(shark_bmp[pixel_el]!= 0x2589){

				if(levelThreeFlag == 0){
					alt_up_pixel_buffer_dma_draw_box(pixel_buffer, j, i, j, i, shark_bmp[pixel_el], 0);
				}
				else if(levelThreeFlag == 1){
					if(x_start < (FOG)){
						alt_up_pixel_buffer_dma_draw_box(pixel_buffer, j, i, j, i, shark_bmp[pixel_el], 0);
					}
				}
			}

			pixel_el++;

		}

	}






}
Пример #17
0
void heads_up_display_static(void){
	alt_up_char_buffer_dev *char_buffer_score;
	alt_up_pixel_buffer_dma_dev* pixel_buffer;

	char_buffer_score = alt_up_char_buffer_open_dev("/dev/char_drawer");
	alt_up_char_buffer_init(char_buffer_score); //initializes character buffer
	alt_up_char_buffer_clear(char_buffer_score); //clears the character buffer of an previous characters
	alt_up_char_buffer_string(char_buffer_score,"Score:", 5, 50); //updates score
	alt_up_char_buffer_string(char_buffer_score,"Milk:", 5, 52); //updates resources
	alt_up_char_buffer_string(char_buffer_score,"Level:", 5, 54); //updates level
	alt_up_char_buffer_string(char_buffer_score,"Time:", 5, 56); //updates time

	pixel_buffer = alt_up_pixel_buffer_dma_open_dev("/dev/pixel_buffer_dma");

	alt_up_pixel_buffer_dma_draw_box(pixel_buffer,1,120,11,130,BLACK,0);//draws black baby's body
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer,1,130,11,133,WHITE,0);//draws diaper

	alt_up_pixel_buffer_dma_draw_box(pixel_buffer,1,150,11,160,BEIGE,0);//draws beige baby's body
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer,1,160,11,163,WHITE,0);//draws diaper

	alt_up_pixel_buffer_dma_draw_box(pixel_buffer,1,180,11,190,YELLOW,0);//draws yellow baby's body
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer,1,190,11,193,WHITE,0);//draws diaper

	//draws rectangle around indicator of tower choice
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,119,12,134,ORANGE,0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,149,12,164,ORANGE,0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,179,12,194,ORANGE,0);
}
Пример #18
0
void draw_developers_guide(alt_up_pixel_buffer_dma_dev* pixel_buffer, alt_up_char_buffer_dev* char_buffer){
	alt_up_char_buffer_clear(char_buffer);
	draw_menu_text(char_buffer);
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 31, 320, 240, BLACK, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 195, 10, 260, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 260, 10, 319, 30, YELLOW, 0);
	alt_up_char_buffer_string(char_buffer, "D E V E L O P E R S", 31, 12);
	alt_up_char_buffer_string(char_buffer, "___________________", 31, 13);
	alt_up_char_buffer_string(char_buffer, "CYRIL CANONIZADO", 33, 19);
	alt_up_char_buffer_string(char_buffer, "DAVID LU", 37, 23);
	alt_up_char_buffer_string(char_buffer, "KEVAL SHAH", 36, 27);
	alt_up_char_buffer_string(char_buffer, "BRYCE TOWNS", 36, 31);
}
Пример #19
0
void draw_rb_incorrect_note_at(alt_up_pixel_buffer_dma_dev* pixel_buffer, int location, int x_location)
// FUNCTION: Draws the template for an incorrect note in the rock band game mode to the back buffer.
// Doesn't write the pitch to the char buffer. This is done inside the update_rb function.
// REQUIRES: 1 <= location <= 60
// RETURNS: None
{
	/*
	// Draw double thickness square in black
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, x_location*4 - 9, location*4 - 12, x_location*4 + 11, location*4 + 8,0x0000, 1);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, x_location*4 - 8, location*4 - 11,  x_location*4 + 10, location*4 + 7,0x0000, 1);
	*/

	// Fill the inside in green
	uint16_t fill_colour = drawRGB24toRGB565(0x66, 0x33, 0x00); // Brown cave colour
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x_location*4 - 7, location*4 - 10,  x_location*4 + 9, location*4 + 6, fill_colour, 1);

}
Пример #20
0
void draw_controls_guide(alt_up_pixel_buffer_dma_dev* pixel_buffer, alt_up_char_buffer_dev* char_buffer){
	alt_up_char_buffer_clear(char_buffer);
	draw_menu_text(char_buffer);
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 31, 320, 240, BLACK, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 140, 10, 190, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 260, 10, 319, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 195, 10, 260, 30, YELLOW, 0);
	alt_up_char_buffer_string(char_buffer, "C O N T R O L S", 33, 12);
	alt_up_char_buffer_string(char_buffer, "_______________", 33, 13);
	alt_up_char_buffer_string(char_buffer, "UP ARROW ----- Move Cursor Up / Navigate Menus", 17, 19);
	alt_up_char_buffer_string(char_buffer, "DOWN ARROW --- Move Cursor Down / Navigate Menus", 17, 22);
	alt_up_char_buffer_string(char_buffer, "RIGHT ARROW -- Move Cursor Right / Navigate Menus", 17, 25);
	alt_up_char_buffer_string(char_buffer, "LEFT ARROW --- Move Cursor Left / Navigate Menus", 17, 28);
	alt_up_char_buffer_string(char_buffer, "A ------------ Move Resource Collecting Boat Left", 17, 31);
	alt_up_char_buffer_string(char_buffer, "D ------------ Move Resource Collecting Boat Right", 17, 34);
	alt_up_char_buffer_string(char_buffer, "(1 to 9) ----- Select Tower To Place", 17, 37);
	alt_up_char_buffer_string(char_buffer, "SPACEBAR ----- Place Tower On Current Grid ", 17, 40);
	alt_up_char_buffer_string(char_buffer, "ESC ---------- Pause Menu / Return To Previous Menu", 17, 43);
}
void draw_jellyfish(int jelly_x, int jelly_y){

	int i = jelly_x;
	int j = jelly_y;
	int pixel_el = 0;
	for(i = jelly_x; i < jelly_x+40; i++)
		{
			for(j = jelly_y; j < jelly_y+40; j++){

				if(jellyfish[pixel_el]!= 0x051D){
					alt_up_pixel_buffer_dma_draw_box(pixel_buffer, i, j, i+1, j+1, jellyfish[pixel_el], 0);

				}

				pixel_el++;
			}

		}
}
Пример #22
0
/********************************************************************************
 * This program demonstrates use of the character and pixel buffer HAL code for
 * the DE2 Media computer. It:
 * 	-- places a blue box on the VGA display, and places a text string inside the box.
 *		-- draws a big A on the screen, for ALTERA
 *		-- "bounces" a colored box around the screen 
********************************************************************************/
int main(void)
{
	alt_up_pixel_buffer_dma_dev *pixel_buffer_dev;
	alt_up_char_buffer_dev *char_buffer_dev;

	/* used for drawing coordinates */
	int x1, y1, x2, y2, deltax_1, deltax_2, deltay_1, deltay_2, delay = 0;

	/* create a message to be displayed on the VGA display */
	char text_top_row[40] = "Altera DE2\0";
	char text_bottom_row[40] = "Media Computer\0";

	/* initialize the pixel buffer HAL */
	pixel_buffer_dev = alt_up_pixel_buffer_dma_open_dev ("/dev/VGA_Pixel_Buffer");
	if ( pixel_buffer_dev == NULL)
		alt_printf ("Error: could not open VGA pixel buffer device\n");
	else
		alt_printf ("Opened character VGA pixel buffer device\n");
	/* clear the graphics screen */
	alt_up_pixel_buffer_dma_clear_screen(pixel_buffer_dev, 0);

	/* output text message in the middle of the VGA monitor */
	char_buffer_dev = alt_up_char_buffer_open_dev ("/dev/VGA_Char_Buffer");
	if (char_buffer_dev == NULL)
	{
		alt_printf ("Error: could not open character buffer device\n");
		return -1;
	}
	else
		alt_printf ("Opened character buffer device\n");
	alt_up_char_buffer_string (char_buffer_dev, text_top_row, 35, 29);
	alt_up_char_buffer_string (char_buffer_dev, text_bottom_row, 35, 30);

	/* now draw a background box for the text */
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer_dev, 34*4, 28*4, 50*4, 32*4, 0x187F, 0);

	/* now draw a big A for ALTERA */
	draw_big_A (pixel_buffer_dev);

	/* now draw a red rectangle with diagonal green lines */
	x1 = 20; y1 = 20;
	x2 = 50; y2 = 50;
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer_dev, x1, y1, x2, y2, 0xF800, 0);
	alt_up_pixel_buffer_dma_draw_line(pixel_buffer_dev, x1, y1, x2, y2, 0x07e0, 0);
	alt_up_pixel_buffer_dma_draw_line(pixel_buffer_dev, x1, y2, x2, y1, 0x07e0, 0);
	alt_up_pixel_buffer_dma_swap_buffers(pixel_buffer_dev);

	/* set the direction in which the box will move */
	deltax_1 = deltax_2 = deltay_1 = deltay_2 = 1;

	while(1)
	{
		if (alt_up_pixel_buffer_dma_check_swap_buffers_status(pixel_buffer_dev) == 0)
		{
			/* If the screen has been drawn completely then we can draw a new image. This 
			 * section of the code will only be entered once every 60th of a second, because 
			 * this is how long it take the VGA controller to copy the image from memory to 
			 * the screen. */
			delay = 1 - delay;

			if (delay == 0)
			{
				/* The delay is inserted to slow down the animation from 60 frames per second 
				 * to 30. Every other refresh cycle the code below will execute. We first erase 
				 * the box with Erase Rectangle */
				alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer_dev, x1, y1, x2, y2, 0, 0);
				alt_up_pixel_buffer_dma_draw_line(pixel_buffer_dev, x1, y1, x2, y2, 0, 0);
				alt_up_pixel_buffer_dma_draw_line(pixel_buffer_dev, x1, y2, x2, y1, 0, 0);

				// move the rectangle
				x1 = x1 + deltax_1;
				x2 = x2 + deltax_2;
				y1 = y1 + deltay_1;
				y2 = y2 + deltay_2;
				if ((deltax_1 > 0) && (x1 >= alt_up_pixel_buffer_dma_x_res(pixel_buffer_dev) - 1))
				{
					x1 = alt_up_pixel_buffer_dma_x_res(pixel_buffer_dev) - 1;
					deltax_1 = -deltax_1;
				}
				else if ((deltax_1 < 0) && (x1 <= 0))
				{
					x1 = 0;
					deltax_1 = -deltax_1;
				}
				if ((deltax_2 > 0) && (x2 >= alt_up_pixel_buffer_dma_x_res(pixel_buffer_dev) - 1))
				{
					x2 = alt_up_pixel_buffer_dma_x_res(pixel_buffer_dev) - 1;
					deltax_2 = -deltax_2;
				}
				else if ((deltax_2 < 0) && (x2 <= 0))
				{
					x2 = 0;
					deltax_2 = -deltax_2;
				}
				if ((deltay_1 > 0) && (y1 >= alt_up_pixel_buffer_dma_y_res(pixel_buffer_dev) - 1))
				{
					y1 = alt_up_pixel_buffer_dma_y_res(pixel_buffer_dev) - 1;
					deltay_1 = -deltay_1;
				}
				else if ((deltay_1 < 0) && (y1 <= 0))
				{
					y1 = 0;
					deltay_1 = -deltay_1;
				}
				if ((deltay_2 > 0) && (y2 >= alt_up_pixel_buffer_dma_y_res(pixel_buffer_dev) - 1))
				{
					y2 = alt_up_pixel_buffer_dma_y_res(pixel_buffer_dev) - 1;
					deltay_2 = -deltay_2;
				}
				else if ((deltay_2 < 0) && (y2 <= 0))
				{
					y2 = 0;
					deltay_2 = -deltay_2;
				}

				// redraw Rectangle with diagonal lines
				alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer_dev, x1, y1, x2, y2, 0xF800, 0);
				alt_up_pixel_buffer_dma_draw_line(pixel_buffer_dev, x1, y1, x2, y2, 0x07e0, 0);
				alt_up_pixel_buffer_dma_draw_line(pixel_buffer_dev, x1, y2, x2, y1, 0x07e0, 0);

				// redraw the box in the foreground
				alt_up_pixel_buffer_dma_draw_box(pixel_buffer_dev, 34*4, 28*4, 50*4, 32*4, 0x187F, 0);

				draw_big_A (pixel_buffer_dev);
			}

			/* Execute a swap buffer command. This will allow us to check if the screen has 
			 * been redrawn before generating a new animation frame. */
			alt_up_pixel_buffer_dma_swap_buffers(pixel_buffer_dev);
		}
	}
}
Пример #23
0
void clearDrawingboard(void){
	//Clean up the entire draw section
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer_dev, drawX0,drawY0 , drawX1, drawY1, BACKGROUNDCOLOR, backbuffer); //Make the backbuffer the correct color
}
Пример #24
0
void draw_sheetmusic()
{
	// Symbolic constants
	int x_indent = 16;
	int y_indent = 100;
	int space_height = (240 - 2*y_indent)/4;

	// Declare variables
	int i;

	if(m == blank)
	{
		rb.background_flag = FALSE;
		if(v.blank_flag == FALSE)
		{
			alt_up_pixel_buffer_dma_draw_box(v.pixel_buffer, 0, 0, 319, 239, 0xFFFF, 1); // White box to fill the back buffer
			for(i=0; i<5; i++) // Draw 5 horizontal lines of the musical staff to the back buffer
				alt_up_pixel_buffer_dma_draw_hline(v.pixel_buffer, x_indent-2, 320-(x_indent-2), y_indent+space_height*i, 0x0000, 1);

			// Double bar line at the start
			alt_up_pixel_buffer_dma_draw_box(v.pixel_buffer, x_indent-4, y_indent, x_indent-2, 240-y_indent, 0x0000, 1);
			alt_up_pixel_buffer_dma_draw_vline(v.pixel_buffer, x_indent, y_indent, 240-y_indent, 0x0000, 1);

			// Double bar line at the end
			alt_up_pixel_buffer_dma_draw_box(v.pixel_buffer, 320-(x_indent-4), y_indent, 320-(x_indent-2), 240-y_indent, 0x0000, 1);
			alt_up_pixel_buffer_dma_draw_vline(v.pixel_buffer, 320-x_indent, y_indent, 240-y_indent, 0x0000, 1);

			// Three bar lines to divide the staff into four measures
			alt_up_pixel_buffer_dma_draw_vline(v.pixel_buffer, (160+x_indent)/2, y_indent, 240-y_indent, 0x0000, 1);
			alt_up_pixel_buffer_dma_draw_vline(v.pixel_buffer, 160, y_indent, 240-y_indent, 0x0000, 1);
			alt_up_pixel_buffer_dma_draw_vline(v.pixel_buffer, (480-x_indent)/2, y_indent, 240-y_indent, 0x0000, 1);

			// Draw some notes: C major scale
			draw_qnote_on_sheetmusic(v.pixel_buffer, 0, 0);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 1, 1);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 2, 2);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 3, 3);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 4, 4);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 5, 5);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 6, 6);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 7, 7);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 7, 8);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 6, 9);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 5, 10);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 4, 11);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 3, 12);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 2, 13);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 1, 14);
			draw_qnote_on_sheetmusic(v.pixel_buffer, 0, 15);

			// Blue box and message near top of the screen
			alt_up_pixel_buffer_dma_draw_box(v.pixel_buffer, 100, 26, 220, 40, 0x122B, 1);
			alt_up_char_buffer_clear(v.char_buffer);
			alt_up_char_buffer_string(v.char_buffer, "Waiting for user input...", 28, 8);
			v.blank_flag = TRUE;

			// Swap buffers
			alt_up_pixel_buffer_dma_swap_buffers(v.pixel_buffer);
			while (alt_up_pixel_buffer_dma_check_swap_buffers_status(v.pixel_buffer));


		}
	}
}
Пример #25
0
void draw_towers_guide(alt_up_pixel_buffer_dma_dev* pixel_buffer, alt_up_char_buffer_dev* char_buffer){
	alt_up_char_buffer_clear(char_buffer);
	draw_menu_text(char_buffer);
	alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 31, 320, 240, BLACK, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 0, 10, 70, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 140, 10, 190, 30, BLUE, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 70, 10, 140, 30, YELLOW, 0);

	/* Tower Row 1 Col 1 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 10, 40, 50, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 10, 82, 50, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 3, 22);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 3, 24);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 3, 26);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 3, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 3, 30);

	/* Tower Row 1 Col 2 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 62, 40, 102, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 62, 82, 102, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 16, 22);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 16, 24);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 16, 26);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 16, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 16, 30);

	/* Tower Row 1 Col 3 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 40, 154, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 82, 154, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 29, 22);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 29, 24);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 29, 26);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 29, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 29, 30);

	/* Tower Row 1 Col 4 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 40, 204, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 82, 204, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 42, 22);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 42, 24);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 42, 26);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 42, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 42, 30);

	/* Tower Row 1 Col 5 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 218, 40, 258, 80, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 218, 82, 258, 132, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 55, 22);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 55, 24);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 55, 26);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 55, 28);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 55, 30);


	/* Tower Row 2 Col 1 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 10, 140, 50, 180, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 10, 182, 50, 232, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 3, 47);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 3, 49);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 3, 51);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 3, 53);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 3, 55);

	/* Tower Row 2 Col 2 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 62, 140, 102, 180, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 62, 182, 102, 232, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 16, 47);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 16, 49);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 16, 51);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 16, 53);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 16, 55);

	/* Tower Row 2 Col 3 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 140, 154, 180, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 114, 182, 154, 232, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 29, 47);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 29, 49);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 29, 51);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 29, 53);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 29, 55);

	/* Tower Row 2 Col 4 */
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 140, 204, 180, RED, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 166, 182, 204, 232, WHITE, 0);
	alt_up_char_buffer_string(char_buffer, "HP: XXX", 42, 47);
	alt_up_char_buffer_string(char_buffer, "COST: XXX", 42, 49);
	alt_up_char_buffer_string(char_buffer, "DMG: XXX", 42, 51);
	alt_up_char_buffer_string(char_buffer, "F.RATE: X", 42, 53);
	alt_up_char_buffer_string(char_buffer, "EFF: XXX", 42, 55);
}
Пример #26
0
void Video_drawBox(VideoBuffer *video_buffer, int x0, int y0, int x1, int y1, int color, int backbuffer)
{
	alt_up_pixel_buffer_dma_draw_box(video_buffer->pixel_buffer, x0, y0, x1, y1, color, backbuffer);
}
Пример #27
0
// Function will draw a baby image using info generated by the initialize function
//void draw_baby(Tower* baby[], int num, int body_pos[], int diaper_pos[], int colour, alt_up_pixel_buffer_dma_dev* pixel_buffer){
void draw_baby(Tower* baby, alt_up_pixel_buffer_dma_dev* pixel_buffer, int tower_type){

	int i,j,k;
	int col_swap = 0;
	int pixel_el = 0;


	short int image_to_draw[750];

	//Check which .bmp image to draw. Depends on what the tower on this grid's type is
	switch (tower_type){
	case 1:
		for(k = 0; k < 750; k++){
		image_to_draw[k] = baby_bmp[k];
		}
		col_swap = 0x0F00;
		break;
	case 2:

		for(k = 0; k < 750; k++){
		image_to_draw[k] = baby_bmp[k];
		}
		break;
	case 3:

		for(k = 0; k < 750; k++){
		image_to_draw[k] = infantry_bmp[k];
		}
		break;

	case 4:
		for(k = 0; k < 750; k++){
		image_to_draw[k] = baby_bmp[k];
		}
		col_swap = 0xF81F;
		break;

	case 5:
		for(k = 0; k < 750; k++){
		image_to_draw[k] = baby_bmp[k];
		}
		col_swap = 0xFBE0;
		break;

	case 6:
		for(k = 0; k < 750; k++){
		image_to_draw[k] = baby_bmp[k];
		}
		col_swap = 0xFFF0;
		break;

	case 7:
		for(k = 0; k < 750; k++){
		image_to_draw[k] = baby_bmp[k];
		}
		col_swap = 0x0FFF;
		break;

	case 8:
		for(k = 0; k < 750; k++){
		image_to_draw[k] = baby_bmp[k];
		}
		col_swap = 0xF0F0;
		break;

	}

	//printf("data = %x after array \n");
	// go through the bmp array, and draw image pixel by pixel, skipping transparent pixels.
	for(i = 0; i < 30; i++)
	{
		for(j = 0; j < 25; j++){

			if(image_to_draw[pixel_el]!= BLACK){
				if(tower_type == 1 || tower_type == 4 || tower_type == 5 || tower_type == 6 || tower_type == 7 || tower_type == 8){
					alt_up_pixel_buffer_dma_draw_box(pixel_buffer, baby->body_pos[0]+j, baby->body_pos[1]+i,baby->body_pos[0]+j, baby->body_pos[1]+i, col_swap, 0);
				}
				else{
					alt_up_pixel_buffer_dma_draw_box(pixel_buffer, baby->body_pos[0]+j, baby->body_pos[1]+i,baby->body_pos[0]+j, baby->body_pos[1]+i, image_to_draw[pixel_el], 0);
				}
			}

			pixel_el++;
		}

	}





}
Пример #28
0
int main(void) {

	alt_up_char_buffer_dev * char_buf_dev;

	char_buf_dev = alt_up_char_buffer_open_dev("/dev/char_buffer");
	// open the Char Buffer port
	if (char_buf_dev == NULL)
		alt_printf("Error: could not open char buffer device \n");
	else
		alt_printf("Opened char buffer device \n");
	alt_up_char_buffer_clear(char_buf_dev);
	alt_up_char_buffer_string(char_buf_dev, "ECE4440 Team MSB", 5, 5);
	alt_up_char_buffer_string(char_buf_dev, "Video Demo", 5, 10);
	alt_up_char_buffer_string(char_buf_dev, "Blue", 15, 20);
	alt_up_char_buffer_string(char_buf_dev, "Red", 40, 20);
	alt_up_char_buffer_string(char_buf_dev, "Green", 40, 40);
	alt_up_char_buffer_string(char_buf_dev, "Purple", 15, 40);


	alt_up_pixel_buffer_dma_dev * pixel_buf_dev;
	// open the Pixel Buffer port
	pixel_buf_dev = alt_up_pixel_buffer_dma_open_dev("/dev/pixel_buffer");
	if (pixel_buf_dev == NULL)
		alt_printf("Error: could not open pixel buffer device \n");
	else
		alt_printf("Opened pixel buffer device \n");
	//Clear and draw a blue box on the screen
	alt_up_pixel_buffer_dma_clear_screen(pixel_buf_dev, 0);
	alt_up_pixel_buffer_dma_swap_buffers(pixel_buf_dev);
	alt_up_pixel_buffer_dma_draw_box(pixel_buf_dev, 0, 0, 200, 200, 0x3FF, 0); //blue box
	alt_up_pixel_buffer_dma_draw_box(pixel_buf_dev, 200, 200, 400, 400, 0xFFC00, 1); //green box
	alt_up_pixel_buffer_dma_draw_box(pixel_buf_dev, 200, 0, 400, 200, 0x3FF00000, 0); //red box
	alt_up_pixel_buffer_dma_draw_box(pixel_buf_dev, 0, 200, 200, 400, 0x3FF003FF, 1); //light blue box
	int image[60][60] = {{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,0,0,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,0,255,255,255,255,255,0,0,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,0,255,0,255,255,255,255,0,255,255,255,0,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,0,255,255,0,255,255,255,255,0,0,255,0,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,0,255,255,255,255,0,0,255,255,0,0,255,255,255,255,0,0,0,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,0,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255,0,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,255,0,0,0,0,0,0,0,255,255,255,255,0,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,0,0,255,255,255,255,0,0,0,255,255,0,255,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,0,0,255,255,255,255,255,0,255,255,255,255,0,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,0,0,0,0,0,0,0,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,204,0,204,204,204,204,255,204,204,204,204,255,204,204,204,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,0,255,255,255,255,255,255,0,255,255,204,255,204,255,255,255,255,255,255,204,204,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,204,255,255,255,255,255,255,204,255,255,0,255,204,255,255,255,255,255,255,204,204,204,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,0,0,0,0,255,255,255,255,255,255,255,204,204,0,204,204,255,255,0,204,204,204,255,204,255,255,255,255,255,204,255,255,204,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,255,255,204,255,255,255,255,255,255,204,255,255,255,255,0,255,204,204,255,255,204,255,255,204,204,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,255,204,255,255,204,255,255,204,204,0,204,0,255,255},
			{255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,204,255,255,255,255,255,255,204,255,255,255,255,204,204,204,0,255,0,204,255,255,255,204,255,255},
			{255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,204,255,255,255,255,204,255,255},
			{255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,255,255,255,255,0,255,255,255,255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},
			{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}};

	int i, j;
	for (i = 0; i < 60; i++){
		for (j = 0; j < 60; j++){
			if (image[i][j] < 255)
				alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x0, 100+i, 100+j);
			else
				alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0xFFFFFFFF, 100+i, 100+j);
		}
	}

	/*alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 100, 100);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 101, 101);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 102, 102);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 103, 103);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 104, 102);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 105, 101);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 106, 100);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 105, 100);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 104, 100);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 103, 100);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 102, 100);
	alt_up_pixel_buffer_dma_draw(pixel_buf_dev, 0x3FF003FF, 101, 100);*/


	return 0;
}