Esempio n. 1
0
void	init_scene(t_scene **scene)
{
	t_coord	coord;
	t_vec3	v;

	init_coord(&coord, 0, 0, -50);
	init_vec3(&v, 0, 0, 1);
	//init_plane(scene, coord, v, 0x0000FF);

	init_coord(&coord, 0, -3, 0);
	init_vec3(&v, 0, 1, 0);
	init_plane(scene, coord, v, 0x00FF66);
	
	init_coord(&coord, -5, 4, -21);
	init_circle(scene, coord, 0xFFFFFF, 4);

	init_coord(&coord, 0, 4, -21);
	init_circle(scene, coord, 0xFF0000, 2);

	init_coord(&coord, 5, 2, -25);
	init_vec3(&v, 0, 0, 1);
	init_cylinder(scene, coord, v, 2, 0x0000FF);
	
	init_coord(&coord, -10, -2, -25);
	init_vec3(&v, 0, 0, 1);
	init_cone(scene, coord, v, 0x00FFFF);
}
Esempio n. 2
0
void context::stop_answer()
{
  mst=0;
  bmodemsendcomm(NULL,v.dial_terminate,0);
  f->conresult(14,"NO CARRIER");
  init_circle(0);
}
Esempio n. 3
0
int main(void)
{
	int n = 0;
	V_NODE *rear = NULL;
	
	printf("Please input n:\n");
	scanf("%d", &n);
	rear = init_circle(n);
	j_game(rear);
	return 0;
}
Esempio n. 4
0
int main(int argc, const char *argv[])
{
    V_NODE *rear = NULL;
    V_NODE *p =NULL;
    int n = 0;
    printf("please input n:\n");
    scanf("%d",&n);
    rear=init_circle(n);
    j_game(rear);

    return 0;
}
Esempio n. 5
0
int main(){
	struct Shape s;
	struct Circle c;
	struct Shape* p;
	
	init_shape(&s);
	init_circle(&c);

	draw(&s);
	draw((struct Shape*)&c);

	p = &s;
	draw(p);
	p = (struct Shape*)&c;
	draw(p);
}
Esempio n. 6
0
int main(int argc, char** argv) {

    struct Square square;
    struct Circle circle;
    struct Triangle triangle;

    init_square(&square, 2);
    init_circle(&circle, 4);
    init_triangle(&triangle, 3, 4, 5);

    struct Shape * shapes[3];
    shapes[0] = (struct Shape *) □
    shapes[1] = (struct Shape *) &circle;
    shapes[2] = (struct Shape *) ▵

    int i;
    for (i = 0; i < 3; ++i) {
        (*shapes[i]).print();
        printf("area: %f\n", (*shapes[i]).area(shapes[i]));
        printf("perimeter: %f\n\n", (*shapes[i]).perimeter(shapes[i]));
    }
    return (EXIT_SUCCESS);
}
Esempio n. 7
0
void Renderer::init()
{
	init_shaders();

	ortho = new Matrix4f();
	mx_translate = new Matrix4f();
	mx_scale = new Matrix4f();
	mx_rotate = new Matrix4f();
    
    init_rect();
    init_grid();
	InitPassGrid();
    init_line();
	init_tower();
	init_circle();
	init_ring();
	InitTriangle();
	InitPolygon();
	initHexGrid();
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	glCullFace(GL_BACK);
}
Esempio n. 8
0
int context::circle()
{
  char r[200];int last=0;

  mst=0;

  default_queue.node.homedir="d:\\temp\\out";
  while(1){
    if (!bmodeminit()) return 7;
    init_circle(0);

    while(1){
      if (f->cn->p = f->cn->getkey())
        if (f->cn->p->EventType==KEY_EVENT&&f->cn->p->Event.KeyEvent.bKeyDown){
          
          switch(f->cn->p->Event.KeyEvent.uChar.AsciiChar){
            case 'a': case 'A': if (mst==0||mst==3) answer_node();break;
            case 'c': case 'C': if (mst==0) call_node();break;
            case 'r': case 'R': TestDialogItem();break;
            case 'x': 
              if (mst==0&&(f->cn->p->Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED))) return 0;
              break;

          }

          switch(f->cn->p->Event.KeyEvent.wVirtualKeyCode){
            case VK_F1: ShowHelp();break;
            case VK_F2: MakeConfig();break;
            case VK_SPACE: case VK_ESCAPE:
                switch(mst){
                  case 0: time(&yo);if (v.circle>end_time-yo) init_circle(1);break;
                  case 1: stop_call();break;
                  case 2: stop_answer();break;
                  case 3: f->conresult(15,"NO MORE RINGS",0);init_circle(0);break;
                }
                break;
          }
        }
      Sleep(10);
      if (mst!=-1){
        time(&yo);
        if (current!=yo){
          current=yo;
          if (yo>=end_time){
            switch(mst){
              case 0: init_circle(1);break;
              case 1: stop_call();Sleep(400);call_node();break;
              case 2: stop_answer();break;
              case 3: f->conresult(15,"NO MORE RINGS");init_circle(0);break;
            }
            continue;
          }
          int i = end_time - yo;
          sprintf(s,"%02i:%02i",i/60,i%60);
          f->conresult(15,s);
        }
      }
      if (int q=bmodemgetchar()){
        if (q==13||q==10){
          r[last]=0;
          if (last){
            if (checkstring(v.ncarrier+"|"+v.no_dial+"|"+v.busy,r,'|')){
              f->conresult(14,r);
              if (mst==1) Sleep(400),call_node();
                else init_circle(0);
            } else if (v.ring==r){
              if (mst!=3) ringno=0;
              next_ring();
            } else if (!strncmp(r,v.connect,v.connect.GetLength())){
              f->conresult(14,v.connect);
              if (mst==1)
                emsi_connect_out(r,default_queue);
              else 
                emsi_connect_in(r);
              last=0;
              break;
            }
            last=0;
          }
        } else {
          if (last>198) last=0;
          r[last++]=q;
        }
      }
    }
  }
}