Пример #1
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);
}
Пример #2
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
}
Пример #3
0
void drawFullGraph(unsigned char* voltArray){
	const unsigned elementCount = 307;
	unsigned temp;
	for(temp = 0; temp < elementCount; ++temp){
		alt_up_pixel_buffer_dma_draw_vline(pixel_buffer_dev,drawX0 + temp,voltArray[temp],drawY1,INFOCOLOR,backbuffer);

	}
}
Пример #4
0
void drawHelpLines(void){
	//Redraw the indicationlines
	//Smaller lines(horizontal)
	int tPos;
	for (tPos = 0; tPos < 228; tPos +=46){
		alt_up_pixel_buffer_dma_draw_hline(pixel_buffer_dev, 12,  15, tPos,SYSLINECOLOR, backbuffer); //Draw a small horizontal line for indication
	}
	//Smaller lines (vertical)
	for (tPos = 319; tPos > 31; tPos -=31){
		alt_up_pixel_buffer_dma_draw_vline(pixel_buffer_dev, tPos, 223, 226,SYSLINECOLOR, backbuffer); //Draw a small vertical line for indication
	}
}
Пример #5
0
void bluebackground(alt_up_pixel_buffer_dma_dev* pixel_buffer)
{
	// PURPOSE:		draws a light blue background to back buffer
	// REQUIRES:	pixel_buffer != NULL
	// RETURNS:		nothing

	int i;
	for(i=0; i<320; i++)
	{
		alt_up_pixel_buffer_dma_draw_vline(pixel_buffer, i, 0, 239, 0x122B, 1);

	}
	// alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 0, 0, 319, 239, 0x122B, 1);
	return;
}
Пример #6
0
void draw_correct_zone(alt_up_pixel_buffer_dma_dev* pixel_buffer, int CORRECT_ZONE_HEIGHT)
// FUNCTION: Draws the correct zone for the note game
// REQUIRES: 1 <= CORRECT_ZONE_HEIGHT <= 50
// RETURNS: None
{
	int i;
	alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, 0, 319, 220-4*CORRECT_ZONE_HEIGHT, 0x0000, 1); // Top of the correct zone


	for(i=0; i<320; i++)
	{
		alt_up_pixel_buffer_dma_draw_vline(pixel_buffer, i, 221-4*CORRECT_ZONE_HEIGHT, 219, 0xCCCC, 1);

	}
	alt_up_pixel_buffer_dma_draw_hline(pixel_buffer, 0, 319, 220, 0x0000, 1); // Bottom of the correct zone

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


		}
	}
}