Пример #1
0
void picaso4d::begin() {

	DISPLAY_SERIAL.begin(BAUD_RATE);

	CORE_PIN9_CONFIG = PORT_PCR_MUX(6); //Taken from Audio library, needed to preserve AUDIO library capability on pin 9
	CORE_PIN26_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_PFE | PORT_PCR_MUX(3);

	CORE_PIN10_CONFIG = 0;
	CORE_PIN31_CONFIG = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3);

	pinMode(DISPLAY_RESET_PIN, OUTPUT);

	digitalWrite(DISPLAY_RESET_PIN, HIGH);
	delay(100);
	digitalWrite(DISPLAY_RESET_PIN, LOW);

	delay(4000);

	gfx_ScreenMode(ORIENTATION);
	_displayWidth = gfx_Get(X_MAX);
	_displayHeight = gfx_Get(Y_MAX);
}
Пример #2
0
void gfx_Part2(void)
{
	int i ;
	int k ;
	int l ;
	WORD orbitx ;
	WORD orbity ;
	WORD vx[20] ;    // : array[0..19] of word ;
	WORD vy[20] ; //     : array[0..19] of word ;
	gfx_Cls() ;
	putstr("gfx_M to gfx_T") ;
	printf("gfx_M to gfx_T") ;
	k = 180 ;
	l = 80 ;
	gfx_MoveTo(k, l);
	gfx_CircleFilled(k,l,5,BLUE) ;
	i = -90;   // 12 o'clock position
	while (i<270)
	{
		gfx_Orbit(i, 30, &orbitx, &orbity);
		k = 3;
		if ((i % 90) == 0 )
			k = 5;
		gfx_Circle(orbitx , orbity, k, BLUE);
		i += 30;   // each 30 degreees
	}

	gfx_OutlineColour(YELLOW) ;
	gfx_Panel(PANEL_RAISED,140,0,190,20, LIME) ;
	gfx_OutlineColour(0) ;                    // turn outline off

	vx[0] = 36;   vy[0] = 110;
	vx[1] = 36;   vy[1] = 80;
	vx[2] = 50;   vy[2] = 80;
	vx[3] = 50;   vy[3] = 110;
	vx[4] = 76;   vy[4] = 104;
	vx[5] = 85;   vy[5] = 80;
	vx[6] = 94;   vy[6] = 104;
	vx[7] = 76;   vy[7] = 70;
	vx[8] = 85;   vy[8] = 76;
	vx[9] = 94;   vy[9] = 70;
	vx[10] = 110; vy[10] = 66;
	vx[11] = 110; vy[11] = 80;
	vx[12] = 100; vy[12] = 90;
	vx[13] = 120; vy[13] = 90;
	vx[14] = 110; vy[14] = 80;
	vx[15] = 101; vy[15] = 70;
	vx[16] = 110; vy[16] = 76;
	vx[17] = 119; vy[17] = 70;
	// house
	gfx_Rectangle(6,50,66,110,RED);             // frame
	gfx_Triangle(6,50,36,9,66,50,YELLOW);       // roof
	gfx_Polyline(4, vx, vy, CYAN);            // door
	// man
	gfx_Circle(85, 56, 10, BLUE);               // head
	gfx_Line(85, 66, 85, 80, BLUE);             // body
	gfx_Polyline(3, &vx[4], &vy[4], CYAN);      // legs
	gfx_Polyline(3, &vx[7], &vy[7], BLUE);      // arms
	// woman
	gfx_Circle(110, 56, 10, PINK);              // head
	gfx_Polyline(5, &vx[10], &vy[10], BROWN);   // dress
	gfx_Line(104, 104, 106, 90, PINK);          // left arm
	gfx_Line(112, 90, 116, 104, PINK);          // right arm
	gfx_Polyline(3, &vx[15], &vy[15], SALMON);  // dress

	vx[0] = 10; vy[0] = 130;
	vx[1] = 35; vy[1] = 125;
	vx[2] = 80; vy[2] = 130;
	vx[3] = 60; vy[3] = 145;
	vx[4] = 80; vy[4] = 160;
	vx[5] = 35; vy[5] = 170;
	vx[6] = 10; vy[6] = 160;
	gfx_Polygon(7, vx, vy, RED);

	vx[0] = 110; vy[0] = 130;
	vx[1] = 135; vy[1] = 125;
	vx[2] = 180; vy[2] = 130;
	vx[3] = 160; vy[3] = 145;
	vx[4] = 180; vy[4] = 160;
	vx[5] = 135; vy[5] = 170;
	vx[6] = 110; vy[6] = 160;
	gfx_PolygonFilled(7, vx, vy, RED);

	gfx_PutPixel(40, 94, LIME) ;          // door knob
	gfx_Rectangle(0,180, 10,200, AQUA) ;
	gfx_RectangleFilled(20,180, 40,200, ORANGE) ;
	gfx_ScreenCopyPaste(0,0, 0,280, 40,40) ;
	gfx_ScreenMode(LANDSCAPE) ;
	//gfx_Set(CLIPPING, ON) ;
	//gfx_SetClipRegion() ;
	gfx_Slider(SLIDER_RAISED, 210, 100, 250,10, BLUE, 100, 50) ; // coordinates are different because we are in landscape mode
	gfx_ScreenMode(PORTRAIT) ;
	gfx_Transparency(ON) ;
	gfx_TransparentColour(YELLOW) ;  // how do we 'test' this?
	gfx_Triangle(6,250, 36,209, 66,250,YELLOW);
	gfx_TriangleFilled(110,210, 130,210, 120,230,CYAN);
}