• Viernes 3 de Mayo de 2024, 23:48

Autor Tema:  Duda Con Código  (Leído 772 veces)

RazoMann

  • Nuevo Miembro
  • *
  • Mensajes: 3
    • Ver Perfil
Duda Con Código
« en: Viernes 13 de Junio de 2008, 08:31 »
0
Buenas Noches. (aqui en Tijuana)

Bien, ya pude encontrar la manera de hacer polígonos irregulares, pero las figuras salen deformes, ya di varias revisiones e hice cambios a algunos parametros pero salio peor.

Quisiera saber cual fue el error que cometí aparte de escribir demasiados parámetros (lo siento, apenas se lo básico de Programación), ya que quisiera saber como puedo ahorrar codigo y evitar escribir demasiado.

Aqui les dejo el código de lo que he hecho hasta el momento (ya son las 3 partes que me faltan)

(en la imagen adjunta se muestra el diseño que se quiere lograr)

Citar
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <graphics.h>
#include <math.h>

 void inicializa()
 { int gd=DETECT, gm ;
  initgraph(&gd,&gm, "C:\\TC\\BGI");
 }


  void cab (int x1,int y1, int x2,int y2, int x3,int y3, int x4,int y4, int x5,int y5, int x6,int y6, int x7,int y7, int x8,int y8, int x9,int y9, int x10,int y10, int x11,int y11, int x12,int y12, int x13,int y13, int x14,int y14, int x15,int y15, int x16,int y16, int x17,int y17, int x18,int y18, int SOLID_FILL, int color)
 {
  int poly [36];
  poly[0]=x1;
  poly[1]=y1;
  poly[2]=x2;
  poly[3]=y2;
  poly[4]=x3;
  poly[5]=y3;
  poly[6]=x4;
  poly[7]=y4;
  poly[8]=x5;
  poly[9]=y5;
  poly[10]=x6;
  poly[11]=y6;
  poly[12]=x7;
  poly[13]=y7;
  poly[14]=x8;
  poly[15]=y8;
  poly[16]=x9;
  poly[17]=y9;
  poly[18]=x10;
  poly[19]=y10;
  poly[20]=x11;
  poly[21]=y11;
  poly[22]=x12;
  poly[23]=y12;
  poly[24]=x13;
  poly[25]=y13;
  poly[26]=x14;
  poly[27]=y14;
  poly[28]=x15;
  poly[29]=y15;
  poly[30]=x16;
  poly[31]=y16;
  poly[32]=x17;
  poly[33]=y17;
  poly[34]=x18;
  poly[35]=y18;

  setfillstyle (SOLID_FILL, color);
  fillpoly (36,poly );
 }



  void rein (int x1,int y1, int x2,int y2, int x3,int y3, int x4,int y4, int SOLID_FILL, int color)
 {
  int poly [8];
  poly[0]=x1;
  poly[1]=y1;
  poly[2]=x2;
  poly[3]=y2;
  poly[4]=x3;
  poly[5]=y3;
  poly[6]=x4;
  poly[7]=y4;

  setfillstyle (SOLID_FILL, color);
  fillpoly (8,poly );
 }


  void re (int x1, int y1, int x2, int y2, int x3,int y3, int x4,int y4, int x5,int y5, int x6,int y6, int x7,int y7, int SOLID_FILL, int color)
 {
  int poly [14];
  poly[0]=x1;
  poly[1]=y1;
  poly[2]=x2;
  poly[3]=y2;
  poly[4]=x3;
  poly[5]=y3;
  poly[6]=x4;
  poly[7]=y4;
  poly[8]=x5;
  poly[9]=y5;
  poly[10]=x6;
  poly[11]=y6;
  poly[12]=x7;
  poly[13]=y7;
  setfillstyle (SOLID_FILL, color);
  fillpoly (14,poly );
 }




  void caballo()
 {
  cab(20,13,23,8,27,7,28,5,30,7,33,8,35,21,38,24,33,25,35,28,31,35,19,35,18,32,21,27,22,22,14,24,12,22,12,18,1,WHITE);
  getch();

 }

 void reina ()

{ rein (82,6,79,17,71,17,68,6,1, WHITE);
  getch ();
}

void rey ()

{ re(125,5,119,8,118,12,120,18,130,18,132,12,131,8,2,WHITE);
  getch();
}




 void main ()
{
 inicializa();
 caballo();
 reina();
 rey();
 getch();
}


De antemano, Gracias
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.