예제 #1
0
void HuaQi(long x,long y,long cl)
{
     
  if(cl == 1) { setcolor(WHITE); setfillstyle(WHITE, SOLID_FILL, NULL); }
  else { setcolor(RED);  setfillstyle(RED, SOLID_FILL, NULL); }
     
  fillcircle(BL + x*SIDE , BH + y*SIDE , QI);

}
예제 #2
0
void no_poigrass()
{
	setcolor(BLACK);
	setfillcolor(BLACK);
	fillcircle(poigrass.cor[0].x+20/2,poigrass.cor[0].y+20/2,20/2);
	fillcircle(poigrass.cor[1].x+20/2,poigrass.cor[1].y+20/2,20/2);
	fillcircle(poigrass.cor[2].x+20/2,poigrass.cor[2].y+20/2,20/2);
	if(cp==2)
	{
	setcolor(BLACK);
	setfillcolor(BLACK);
    fillcircle(poigrass.cor[3].x+20/2,poigrass.cor[3].y+20/2,20/2);
	fillcircle(poigrass.cor[4].x+20/2,poigrass.cor[4].y+20/2,20/2);
	}
	if(cp==3)
	{
	setcolor(BLACK);
	setfillcolor(BLACK);
	fillcircle(poigrass.cor[3].x+20/2,poigrass.cor[3].y+20/2,20/2);
	fillcircle(poigrass.cor[4].x+20/2,poigrass.cor[4].y+20/2,20/2);
	fillcircle(poigrass.cor[5].x+20/2,poigrass.cor[5].y+20/2,20/2);
	fillcircle(poigrass.cor[6].x+20/2,poigrass.cor[6].y+20/2,20/2);
	}
	poigrass.cor[0].x=240;
	poigrass.cor[0].y=700;
	poigrass.cor[1].x=340;
	poigrass.cor[1].y=700;
	poigrass.cor[2].x=240;
    poigrass.cor[2].y=700;
	if(cp==2)
	{
	poigrass.cor[3].x=60;
	poigrass.cor[3].y=700;
	poigrass.cor[4].x=500;
	poigrass.cor[4].y=700;
	}
	if(cp==3)
	{
    poigrass.cor[3].x=60;
	poigrass.cor[3].y=700;
	poigrass.cor[4].x=500;
	poigrass.cor[4].y=700;
	poigrass.cor[5].x=600;
	poigrass.cor[5].y=700;
	poigrass.cor[6].x=520;
	poigrass.cor[6].y=700;
	}
}
예제 #3
0
void main()
{
	initgraph(640, 480);
	
	int x = 320;
	
	// 画初始图形
	setlinecolor(YELLOW);
	setfillcolor(GREEN);
	fillcircle(x, 240, 20);
	
	char c;
	while(c != 27)
	{
		// 获取按键
		c = getch();
		
		// 先擦掉上次显示的旧图形
		setlinecolor(BLACK);
		setfillcolor(BLACK);
		fillcircle(x, 240, 20);
		
		// 根据输入,计算新的坐标
		switch(c)
		{
			case 'a': x-=2; break;
			case 'd': x+=2; break;
			case 27: break;
		}
		
		// 绘制新的图形
		setlinecolor(YELLOW);
		setfillcolor(GREEN);
		fillcircle(x, 240, 20);
		
		// 延时
		Sleep(10);
	}
	
	closegraph();
}
예제 #4
0
void set_poigrass1()
{
	setfillcolor(WHITE);
	fillcircle(poigrass.cor[0].x+20/2,poigrass.cor[0].y+20/2,20/2);
	fillcircle(poigrass.cor[1].x+20/2,poigrass.cor[1].y+20/2,20/2);
	fillcircle(poigrass.cor[2].x+20/2,poigrass.cor[2].y+20/2,20/2);
	if(cp==2)
	{
	fillcircle(poigrass.cor[3].x+20/2,poigrass.cor[3].y+20/2,20/2);
	fillcircle(poigrass.cor[4].x+20/2,poigrass.cor[4].y+20/2,20/2);
	}
	if(cp==3)
	{
	fillcircle(poigrass.cor[3].x+20/2,poigrass.cor[3].y+20/2,20/2);
	fillcircle(poigrass.cor[4].x+20/2,poigrass.cor[4].y+20/2,20/2);
	fillcircle(poigrass.cor[5].x+20/2,poigrass.cor[5].y+20/2,20/2);
	fillcircle(poigrass.cor[6].x+20/2,poigrass.cor[6].y+20/2,20/2);
	}
}
예제 #5
0
void set_poigrass()
{
	setfillcolor(GREEN);
	fillcircle(poigrass.cor[0].x+20/2,poigrass.cor[0].y+20/2,20/2);
	fillcircle(poigrass.cor[1].x+20/2,poigrass.cor[1].y+20/2,20/2);
	fillcircle(poigrass.cor[2].x+20/2,poigrass.cor[2].y+20/2,20/2);
	if(cp==1)
		Sleep(60);
	if(cp==2)
	{
	fillcircle(poigrass.cor[3].x+20/2,poigrass.cor[3].y+20/2,20/2);
	fillcircle(poigrass.cor[4].x+20/2,poigrass.cor[4].y+20/2,20/2);
	Sleep(40);
	}
	if(cp==3)
	{
	fillcircle(poigrass.cor[3].x+20/2,poigrass.cor[3].y+20/2,20/2);
	fillcircle(poigrass.cor[4].x+20/2,poigrass.cor[4].y+20/2,20/2);
	fillcircle(poigrass.cor[5].x+20/2,poigrass.cor[5].y+20/2,20/2);
	fillcircle(poigrass.cor[6].x+20/2,poigrass.cor[6].y+20/2,20/2);
	Sleep(40);
	}
}
예제 #6
0
void show_snake()
{
	setfillcolor(YELLOW);
    setcolor(YELLOW);
	p0=head;
	while(p0->next!=NULL)
	{
		bar(p0->x,p0->y,p0->x+20,p0->y+20);
		bar(p0->next->x,p0->next->y,p0->next->x+20,p0->next->y+20);
		p0=p0->next;
	}
	setfillcolor(BLACK);
	setcolor(BLACK);
	bar(head->x,head->y,head->x+20,head->y+20);
    setfillcolor(YELLOW);
	setcolor(YELLOW);
	fillcircle(head->x+20/2,head->y+20/2,20/2);
	if(cp==3)
      Sleep(0);
	else Sleep(30);
}
예제 #7
0
 void Circle::draw()
 {
	 setfillcolor(Incol);
	 setlinestyle(style, width);
	fillcircle (cen.x,cen.y, radius);
}
예제 #8
0
 void Circle::erase()
 {
     setfillcolor(BLACK);
	 setlinestyle(style, width);
	fillcircle (cen.x,cen.y, radius);
 }
예제 #9
0
파일: dialog.C 프로젝트: SixByNine/sigproc
int radio::draw(){  
  if (on) fillcircle(x,y,2); else fillcircle(x,y,0);
  cpgsci(1);
  cpgtext(x+0.02,y-0.005,label);
  return(0);
}
void Display_balance(void)
{
	int16_t	x_pos, y_pos;
	int8_t	roll_axis, pitch_axis;

	while(BUTTON1 != 0)
	{
		ReadAcc();


		// Refresh accSmooth values
		// Note that because it takes 4.096ms to refresh the whole GLCD this loop cannot run 
		// faster than 244Hz, but that's close enough to the actual loop time so that the 
		// actual Acc LPF effect is closely mirrored on the balance meter.
		getEstimatedAttitude(); 

		// HORIZONTAL: 	Pitch = X, Roll = Y
		// UPSIDEDOWN:	Pitch = X, Roll = Y
		// AFT:			Pitch = X, Roll = Y
		// VERTICAL:	Pitch = Y, Roll = X
		// SIDEWAYS:	Pitch = Y, Roll = X

		if ((Config.Orientation == VERTICAL) || (Config.Orientation == SIDEWAYS))
		{
			roll_axis = PITCH;
			pitch_axis = ROLL;
		}
		else
		{
			roll_axis = ROLL;
			pitch_axis = PITCH;
		}

		// We need to reverse the polarity reversal so that the meter is once again
		// related to the KK2.0, not the model.
		// For some reason, pitch has to be reversed on he KK2.1
#ifdef KK21
		x_pos = ((int8_t)pgm_read_byte(&Acc_Pol[Config.Orientation][pitch_axis]) * -accSmooth[pitch_axis]) + 32;
#else
		x_pos = ((int8_t)pgm_read_byte(&Acc_Pol[Config.Orientation][pitch_axis]) * accSmooth[pitch_axis]) + 32;
#endif
		y_pos = ((int8_t)pgm_read_byte(&Acc_Pol[Config.Orientation][roll_axis]) * accSmooth[roll_axis]) + 64;

		if (x_pos < 0) x_pos = 0;
		if (x_pos > 64) x_pos = 64;
		if (y_pos < 0) y_pos = 0;
		if (y_pos > 128) y_pos = 128;

		// Print bottom markers
		LCD_Display_Text(12, (prog_uchar*)Wingdings, 2, 55); 	// Left

		// Draw balance meter
		drawrect(buffer, 0, 0, 128, 64, 1);		// Border
		drawrect(buffer, 54, 22, 21, 21, 1);	// Target
		drawline(buffer, 64, 8, 64, 56, 1); 	// Crosshairs
		drawline(buffer, 32, 32, 96, 32, 1); 
		fillcircle(buffer, y_pos, x_pos, 8, 1);	// Bubble

		// Refresh GLCD 
		write_buffer(buffer,1);
		clear_buffer(buffer);
	}
}
예제 #11
0
void show_mine()
{
    setfillcolor(LIGHTMAGENTA);
	setcolor(LIGHTMAGENTA);
    fillcircle(mine.cor.x+20/2,mine.cor.y+20/2,20/2);
}
void Display_sticks(void)
{
	int8_t	i;
	int8_t	offset;
	int8_t	temp_aileron, temp_elevator, temp_rudder;
	bool	CalibrateDone = false;

	// Save original settings in case user aborts
	temp_aileron = Config.AileronPol;
	temp_elevator = Config.ElevatorPol;
	temp_rudder = Config.RudderPol;

	// Reset to defaults - not ideal, but it works
	Config.AileronPol = NORMAL;
	Config.ElevatorPol =  NORMAL;
	Config.RudderPol = NORMAL;

	// Until exit button pressed
	while((BUTTON1 != 0) && (!CalibrateDone))
	{
		offset = 0;

		// Clear screen buffer
		clear_buffer(buffer);

		// Draw graphic
		for (i = 0; i < 2; i++)
		{
			drawrect(buffer, 17 + offset, 0, 40, 40, 1);			// Box
			drawline(buffer, 38 + offset,20, 48 + offset,  3, 1); 	// Line 1
			drawline(buffer, 41 + offset,21, 56 + offset,  6, 1); 	// Line 2
			fillcircle(buffer, 38 + offset, 21, 2, 1);				// Centre
			fillcircle(buffer, 51 + offset, 5, 4, 1);				// End

			offset = 52;
		}

		// Print bottom text and markers
		LCD_Display_Text(12, (const unsigned char*)Wingdings, 0, 57); 		// Left

		// If uncalibrated
		if (!CalibrateDone)
		{
			RxGetChannels();

			// Display "No RX signal" if no input detected
			if(RxChannel[AILERON] == 0)
			{
				LCD_Display_Text(135,(const unsigned char*)Verdana14,14,43); 	// "No RX signal"
			}

			// Sticks have not moved far enough
			else if ((RxChannel[AILERON] > 3000) && (RxChannel[AILERON] < 4500))
			{
				LCD_Display_Text(136,(const unsigned char*)Verdana14,9,43); 		// "Hold as shown"
			}

			// Sticks should now be in the right position
			// Reverse wrong input channels
			else
			{
				if (RCinputs[AILERON] < 0)
				{
					Config.AileronPol = REVERSED;
				}

				if (RCinputs[ELEVATOR] < 0)
				{
					Config.ElevatorPol = REVERSED;
				}

				if (RCinputs[RUDDER] < 0)
				{
					Config.RudderPol = REVERSED;
				}

				// If all positive - done!
				if ((RCinputs[AILERON] > 0) && (RCinputs[ELEVATOR] > 0) && (RCinputs[RUDDER] > 0))
				{
					CalibrateDone = true;
				}
			}
		}

		// Update buffer
		write_buffer(buffer,1);
		_delay_ms(100);
	}

	// Save value and return
	if (CalibrateDone)
	{
		LCD_Display_Text(137,(const unsigned char*)Verdana14,40,43); 	// "Done!"
		// Update buffer
		write_buffer(buffer,1);
		clear_buffer(buffer);
		Save_Config_to_EEPROM();
 	}
	else
	{
		// Restore old settings if failed
		Config.AileronPol = temp_aileron;
		Config.ElevatorPol = temp_elevator;
		Config.RudderPol = temp_rudder;
	}
}
예제 #13
0
//========== DRAW ================= DRAW =================== DRAW ====================
void LCDST7565::drawMenu() {
	uint8_t i, label_len;
	this->clear();
	//this->fillrect(0, 0, 128, 7, BLACK);
	this->drawstring(centerString(_title), 0, _title);
	invertRect(0,0,128,8);
	  i=0;
	  while ((i<N_LINES-1) & (i<_n_items)) {
	    this->drawstring(LEFT_MARGIN, i+1, _menu_items[_draw_index+i].label);
	    switch(_menu_items[_draw_index+i].type)
	    {
	    case MENU_ITEM_TYPE_CHECK:
	    {
	    	uint8_t y = (i+1) * 8;
	    	drawrect(GUI_CHECKBOX_X, y, 7, 7, BLACK);
	    	if(_menu_items[_draw_index+i].checked)
	    	{
	    		drawline(GUI_CHECKBOX_X, y, GUI_CHECKBOX_X + 6, y + 6, BLACK);
	    		drawline(GUI_CHECKBOX_X, y + 6, GUI_CHECKBOX_X + 6, y, BLACK);
	    	}
	    	break;
	    }
	    case MENU_ITEM_TYPE_RADIO:
	    {
	    	uint8_t y = (i+1) * 8 + 4;
	    	if(_menu_items[_draw_index+i].checked)
	    	{
	    		fillcircle(GUI_RADIO_X, y, 2, BLACK);
	    	}
	    	else
	    	{
	    		drawcircle(GUI_RADIO_X, y, 2, BLACK);
	    	}
	    	break;
	    }
	    case MENU_ITEM_TYPE_INLINE_INT:
	    {
	    	char s[8];
	    	sprintf(s, "%i", _menu_items[_draw_index+i].inlineValue);
		    this->drawstring(122 - strlen(s) * 6, i+1, s);
	    	break;
	    }
	    }
	    i++;
	  }

	  /*// Draw arrow to indicate current item:
	  this->drawline(0, 11+(8*_current_line), LEFT_MARGIN-5,
	                                                11+(8*_current_line), BLACK);
	  this->drawline(LEFT_MARGIN-5, 8+(8*_current_line), LEFT_MARGIN-2,
	                                                11+(8*_current_line), BLACK);
	  this->drawline(LEFT_MARGIN-5, 14+(8*_current_line), LEFT_MARGIN-2,
	                                                11+(8*_current_line), BLACK);
	  this->drawline(LEFT_MARGIN-5, 14+(8*_current_line), LEFT_MARGIN-5,
	                                                8+(8*_current_line), BLACK);*/
	  this->drawbitmap(0, 8 * (_current_line+1), menu_arrow, 16, 8, BLACK);


	  // Draw up arrow if there are items above view
	  if (_draw_index > 0) {
	    this->drawline(123, 11, 125, 8, BLACK);
	    this->drawline(127, 11, 125, 8, BLACK);
	  }
	  // Draw down arrow if there are items below view
	  if ((_n_items - _draw_index) >= N_LINES) {
	    this->drawline(123, DOWN_ARROW_Y, 125, DOWN_ARROW_Y + 3, BLACK);
	    this->drawline(127, DOWN_ARROW_Y, 125, DOWN_ARROW_Y + 3, BLACK);
	  }

	  this->drawMenuButton(BUT_DOWN, 0);
	  this->drawMenuButton(BUT_UP, 1);
	  switch( _menu_items[_item_index].type )
	  {
	  case MENU_ITEM_TYPE_CHECK:
	  case MENU_ITEM_TYPE_RADIO:
	  {
		  this->drawMenuButton(BUT_BACK, 2);
		  this->drawMenuButton(BUT_SET, 3);
		  break;
	  }
	  case MENU_ITEM_TYPE_INLINE_INT:
	  {
		  this->drawMenuButton(BUT_LEFT, 2);
		  this->drawMenuButton(BUT_RIGHT, 3);
		  break;
	  }
	  default:
	  {
		  this->drawMenuButton(BUT_BACK, 2);
		  this->drawMenuButton(BUT_OK, 3);
		  break;
	  }
	  }
	  this->display();
}