⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drawing.h

📁 scara机器人的一种简单的实现方法
💻 H
字号:
#include "graphics.h"
#include "process.h"
#include "conio.h"
#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "com_data.h"

extern void RCCDsp(int x,int y,float xt,float yt,
		   int z,int A1,int A2,int Color,char *s);
extern void drawbutton(int left_x,int top_y,int right_x,int bottom_y,
		       int flag,int col);

struct angle{
  float alpha;
  float beta;
  float gama;
};



void Draw_robot()
{
  setcolor(WHITE);
  setviewport(25,110,624,464,1);//  line(0,0,499,230);

  line(330,250,400,250);
  line(330,240,400,240);
  line(330,240,330,250);
  line(400,250,400,240);

  line(340,240,340,170);      line(350,170,350,130);
  line(340,170,390,170);      line(350,130,380,130);
  line(390,170,390,240);      line(380,130,380,170);

  line(140,120,385,120);      line(383,120,383,130);
  line(140,120,140,140);      line(383,130,347,130);
  line(140,140,260,140);      line(347,130,347,125);
  line(260,140,260,120);      line(300,120,300,125);
			      line(300,125,383,125);
  line(385,120,385,100);      line(345,100,347,95);
  line(385,100,245,100);      line(347,95,383,95);
			      line(383,95,385,100);
  line(230,120,230,95);       line(355,95,355,65);
  line(230,95,260,95);        line(355,65,375,65);
  line(260,95,260,100);       line(375,65,375,95);

  line(235,95,235,70);        line(355,65,357,63);
  line(235,70,255,70);        line(357,63,373,63);
  line(255,70,255,95);        line(373,63,375,65);

  line(235,70,237,68);        line(145,120,145,70);
  line(237,68,253,68);        line(145,70,198,70);
  line(253,68,255,70);        line(195,72,195,120);

  line(175,72,175,120);       line(170,55,172,53);
  line(170,70,170,55);        line(172,53,198,53);
  line(170,55,200,55);        line(198,53,200,55);
  line(200,55,200,70);        line(177,53,177,30);
			      line(177,30,193,30);
  line(170,70,172,72);        line(193,30,193,53);
  line(172,72,198,72);        line(177,30,179,28);
  line(198,72,200,70);        line(179,28,191,28);
			      line(191,28,193,30);
  line(155,140,155,170);      line(157,170,157,180);
  line(155,170,165,170);      line(157,180,163,180);
  line(165,170,165,140);      line(163,180,163,170);

  line(220,140,220,160);      line(220,160,222,162);
  line(220,160,240,160);      line(222,162,238,162);
  line(240,160,240,140);      line(238,162,240,160);


  return;
}

int Mouse_treat(void)
{
  char ch;
  int  mouse_state;

  setcolor(WHITE);
  outtextxy(420, 110,"Is mouse installed? ");
  outtextxy(420, 135,"'Y ' for Yes, ");
  outtextxy(420, 150,"'N ' for No. ");

  ch = getch();
  setcolor(CYAN);
  outtextxy(420, 110,"Is mouse installed? ");
  outtextxy(420, 135,"'Y ' for Yes, ");
  outtextxy(420, 150,"'N ' for No. ");
  if (ch=='y' || ch=='Y') mouse_state = TRUE;
  else                              mouse_state = FALSE;

  return mouse_state;
}

int    Menu_from_key(void)
{
   char Key_value;
   int  chosed_button;
   int  state;

   for (;;) {
     Key_value = getch();
     switch (Key_value) {
	  case 'a':
	    chosed_button = STEP_MOVEMENT;
	    drawbutton(55,80,105,105,0,7);
	    delay(100);
	    drawbutton(55,80,105,105,1,7);
	    RCCDsp(58,87,0.4,0.4,2,0,0,BLUE,"单步");
	    setcolor(BLUE);
	    outtextxy(85,88,"A");
	    state = TRUE;
	  break;
	  case 'b':
	    chosed_button = CONTINUOUS_MOVEMENT;
	    drawbutton(55,125,105,150,0,7);
	    delay(100);
	    drawbutton(55,125,105,150,1,7);
	    RCCDsp(58,132,0.4,0.4,2,0,0,BLUE,"连续");
	    setcolor(BLUE);
	    outtextxy(85,133,"B");
	    state = TRUE;
	  break;
	  case 'c':
	    chosed_button = PAUSE;
	    drawbutton(55,170,105,195,0,7);
	    delay(100);
	    drawbutton(55,170,105,195,1,7);
	    RCCDsp(58,177,0.4,0.4,2,0,0,BLUE,"暂停");
	    setcolor(BLUE);
	    outtextxy(85,178,"C");
	    state = TRUE;
	  break;
	  case 'd':
	    chosed_button = STOP;
	    drawbutton(55,215,105,240,0,7);
	    delay(100);
	    drawbutton(55,215,105,240,1,7);
	    RCCDsp(58,222,0.4,0.4,2,0,0,BLUE,"急停");
	    setcolor(BLUE);
	    outtextxy(85,223,"D");
	    state = TRUE;
	  break;
	  case 0x1b:
	    chosed_button = QUIT;
	    drawbutton(55,260,105,285,0,7);
	    delay(100);
	    drawbutton(55,260,105,285,1,7);
	    state = TRUE;
	  break;
	  default:
	    state = FALSE;
     }
     if (state==TRUE) break;
   }

   return chosed_button;
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -