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);
}
Пример #2
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);

}
Пример #3
0
void draw_rb_note_at(alt_up_pixel_buffer_dma_dev* pixel_buffer, int location, int x_location)
// FUNCTION: Draws the template for a 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_rockband 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);

}
Пример #4
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);
}
Пример #5
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

	}
}
Пример #6
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 tower_indicator(int tower_type, alt_up_pixel_buffer_dma_dev* pixel_buffer){
	//Orange is the colouring hi-lighting an unselected tower, Yellow is the colour for a selected tower
	switch(tower_type){//Highlights a tower yellow depending on the type passed in as a parameter
	//Changes hi-lighting back to orange for unselected towers
	case 1: alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,119,12,134,RED,0);//highlights tower 1
			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);
			break;
	case 2: alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,149,12,164,RED,0);//highlights tower 2
			alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,179,12,194,ORANGE,0);
			alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,119,12,134,ORANGE,0);
			break;
	case 3: alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer,0,179,12,194,RED,0);//highlights tower 3
			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);
			break;
	}
}
void draw_grids(alt_up_pixel_buffer_dma_dev* pixel_buffer){
	int i,j;
	int increment = 40;
	int x1 = BG_UPPER_X;
	int y1 = BG_UPPER_Y;
	int x2 = BG_UPPER_X + increment;
	int y2 = BG_LOWER_Y - ((NUMROW-1)*increment);

	for(i = 0; i < (NUMTOW/NUMROW); i++){
		for(j = 0; j < NUMROW; j++){
			alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, x1 + (i* increment), y1+(j*increment),x2+ (i* increment), y2+(j*increment), SEA_COLOUR, 0);
		}
	}



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

	//Print status message
	printf("Program Started...\n");
//===================================================================================================
//                              		INITIALIZE HARDWARE
//===================================================================================================

	initialize_hardware();

//	//Print Background
//	int i,j;
//	for (i=0; i<240; i++){
//		for (j=0; j<320; j++){
//			alt_up_pixel_buffer_dma_draw(pixel_buffer, world[i][j], j, i);
//		}
//	}

	//Draws the rectangle for the Game Grid (150 by 150)
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, 149, 44, 300, 195, 0x3333, 0);

	alt_up_char_buffer_clear(char_buffer);
	alt_up_char_buffer_init(char_buffer);


//===================================================================================================
//===================================================================================================



//===================================================================================================
//                               Game Grid and other initialization
//===================================================================================================

	int GameGrid[GRID_WIDTH][GRID_HEIGHT] = {0};
	int UserHasQuit = 0;
	int GameStatus = 0;

	//===========================================================
	//Create Player 1 struct and initialize positions
	struct Player Player1;
	Player1.CurrentPositionX = 37;
	Player1.CurrentPositionY = 75;

	Player1.PreviousPositionX = 37;
	Player1.PreviousPositionY = 75;

	Player1.DirectionX = 1;
	Player1.DirectionY = 0;


	//===========================================================
	//Create Player 2 struct and initialize positions
	struct Player Player2;
	Player2.CurrentPositionX = 113;
	Player2.CurrentPositionY = 75;

	Player2.PreviousPositionX = 113;
	Player2.PreviousPositionY = 75;

	Player2.DirectionX = -1;
	Player2.DirectionY = 0;


	//===========================================================
	//  Sets the starting position as being filled
	GameGrid[Player1.CurrentPositionX][Player1.CurrentPositionY] = 1;
	GameGrid[Player2.CurrentPositionX][Player2.CurrentPositionY] = 1;

//===================================================================================================
//===================================================================================================



//===================================================================================================
//                               Controls
//===================================================================================================

	alt_up_char_buffer_string(char_buffer, "Press Enter to Start!", 4, 40);
	alt_up_char_buffer_string(char_buffer, "Press 'P' to Pause", 4, 42);

	alt_up_char_buffer_string(char_buffer, "Player 1: RED", 4, 46);
	alt_up_char_buffer_string(char_buffer, "W- Up", 8, 47);
	alt_up_char_buffer_string(char_buffer, "S- Down", 8, 48);
	alt_up_char_buffer_string(char_buffer, "A- Left", 8, 49);
	alt_up_char_buffer_string(char_buffer, "D- Right", 8, 50);


	alt_up_char_buffer_string(char_buffer, "Player 2: BLUE", 4, 53);
	alt_up_char_buffer_string(char_buffer, "Arrow Up- Up", 8, 54);
	alt_up_char_buffer_string(char_buffer, "Arrow Down - Down", 8, 55);
	alt_up_char_buffer_string(char_buffer, "Arrow Left- Left", 8, 56);
	alt_up_char_buffer_string(char_buffer, "Arrow Right- Right", 8, 57);


//===================================================================================================
//									START GAME
//===================================================================================================

	while(UserHasQuit != 1){


	// Function to read when user has pressed entered to start the game
	/*
	if( UserHasPressedEnter )
		GameStatus = 1;
	*/
	// This is the beginning of the game
		while( GameStatus != 1) {

			//Starts the timer to read keyboard inputs until we update the player positions and collisions
			UpdatePlayerMovement(&Player1, &Player2);

			//Updating the collision detection, movement, and screen
			//UpdateGame(&Player1, &Player2, &GameGrid, GameStatus, pixel_buffer);


		}


	}
	return 0;
}
Пример #10
0
void Video_drawRect(VideoBuffer *video_buffer, int x0, int y0, int x1, int y1, int color, int backbuffer)
{
	alt_up_pixel_buffer_dma_draw_rectangle(video_buffer->pixel_buffer, x0, y0, x1, y1, color, backbuffer);
}
Пример #11
0
/*draws and updates the cursor on the screen*/
void draw_cursor(int pos[],int colour, alt_up_pixel_buffer_dma_dev* pixel_buffer){
	//alt_up_pixel_buffer_dma_draw_box(pixel_buffer, BG_UPPER_X, BG_UPPER_Y, BG_LOWER_X, BG_LOWER_Y, SEA_COLOUR, 0);

	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, prev_cur.pos[0], prev_cur.pos[1],prev_cur.pos[2], prev_cur.pos[3], SEA_COLOUR, 0);
	alt_up_pixel_buffer_dma_draw_rectangle(pixel_buffer, pos[0], pos[1],pos[2], pos[3], colour, 0);
}
Пример #12
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);
		}
	}
}
Пример #13
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);

}
Пример #14
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);
}