Pascal/Turbo Pascal - Ayuda con Moviento de paleta en pascal

 
Vista:
sin imagen de perfil

Ayuda con Moviento de paleta en pascal

Publicado por Manuel (12 intervenciones) el 02/11/2013 16:18:55
HOLA, NOCE COMO CONFIGURAR LAS TECLAS DERECHA Y IZQUIERDA EN LA LIBRERIA GRAPH!.. ES PARA PONER UNA PALETA ..... LO HICE CON LA LIBRERIA CRT; PERO CON GRAPH NO ME SALE AYUDA! URGENTE
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Ayuda con Moviento de paleta en pascal

Publicado por ramon (2158 intervenciones) el 02/11/2013 22:20:34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{Con la graph deves de usar las mismas formas que con crt.
mira esto pero cambia la dirección de bgi a la tuya}
  program paletas;
  uses
     crt, graph;
  const
      paleta : array[1..8] of string[8] = (
      '00111000',
      '11111110',
      '11111110',
      '11111110',
      '01111100',
      '00111000',
      '00111000',
      '00111000');
 
 
 
 
 
  var
    drive, modo : integer;
    x, y : integer;
    tecla : char;
 
  procedure inigra;
  begin
      drive := detect;
      initgraph(drive,modo,'c:\tp\bgi');
      if graphresult <> 0 then
      halt(1);
  end;
 
  procedure dibuja(x1, y1 : integer);
  var
    j, u : integer;
   begin
      for j := 1 to 8 do
       for u := 1 to 8 do
       if paleta[j,u] = '1' then
       putpixel(x1 + u,y1 + j,15);
   end;
 
  procedure borra(x1, y1 : integer);
  var
    j, u : integer;
   begin
      for j := 1 to 8 do
       for u := 1 to 8 do
       if paleta[j,u] = '1' then
       putpixel(x1 + u,y1 + j,0);
   end;
 
  begin
      inigra;
      x := 100;
      y := 100;
      dibuja(x,y);
   repeat
      tecla := readkey;
      borra(x,y);
     if tecla = #72 then
     y := y - 1;
     if tecla = #80 then
     y := y + 1;
     if tecla = #75 then
     x := x - 1;
     if tecla = #77 then
     x := x + 1;
     dibuja(x,y);
   until tecla = #13;
 
      closegraph;
  end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar

Ayuda con Moviento de paleta en pascal

Publicado por ESTEBAN (12 intervenciones) el 04/11/2013 03:01:56
YO LO QUE HICE FUE ESTO PERO CUANDO LO PONGO CON MI OTRO TROZO DE PROGRAMA NO ANDA. SE QUEDA LA PALETA QUIETA.. que son unos bloques hechos con la bibloteca Graph

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
program prueba;
uses crt;
var
mov:char;
x,y:word;
 
begin
x:=40;
y:=20;
 
repeat
 
gotoxy(x,y);
write('______');
mov:=readkey;
if (x>5) and (x<50)
then
if (mov='M')
	then
		x:=x+1;
		gotoxy(x,y);
		write('______');
		clrscr;
if (mov='K')
	then
		x:=x-1;
		gotoxy(x,y);
		write('______');
		clrscr;
until (mov='S');
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Ayuda con Moviento de paleta en pascal

Publicado por ramon (2158 intervenciones) el 04/11/2013 12:58:51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{Mira el sistema gotoxy no funciona en modo gráfico tienes que emplear esta forma o otra eso a tu
 gusto pero no el gotoxy.}
 
 program linea;
 uses
    crt, graph;
  var
    drive, modo : integer;
    move : char;
    x, y : integer;
 
  begin
      drive := detect;
      initgraph(drive, modo,'c:\tp\bgi'); {ponlo a tu direccion}
      if graphresult <> 0 then
      halt(1)
   else
      begin
         x := 10;  {posicion de la linea en x}
         y := getmaxy - 20; {posicion de la linea en y}
         setcolor(15);
         line(x,y,x + 10,y); {dibujamos linea}
     repeat
        move := readkey;
        setcolor(0);       {borramos linea}
        line(x,y,x + 10,y);
      if move = #75 then
      begin
          x := x - 10; {para mas rapido incrementa y decrementa x en o mas: 10}
          if x < 10 then
          x := 10;
      end;
      if move = #77 then
      begin
          x := x + 10;
          if x > getmaxx - 15 then
          x := getmaxx - 15;
      end;
         setcolor(15);    {dibujamos en nueva posicion}
         line(x,y,x + 10,y);
     until move = #27;  {tecla [esc] termina}
     closegraph;
    end;
  end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil

Ayuda con Moviento de paleta en pascal

Publicado por Manuel (12 intervenciones) el 04/11/2013 15:39:59
NO ANDA... ESA FUNCION line(x,y,x + 10,y); !!!!!!!!!

COMPROVALO... ESOS VALORES TIENEN QUE SER DISTINTOS? ME PIDE IDENTIFICARLO!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Ayuda con Moviento de paleta en pascal

Publicado por ramon (2158 intervenciones) el 04/11/2013 19:09:53
Perdona que pascal empleas yo uso pascal 7 y va perfecto line pertenece a un procedimiento
de la unidad graph,
Examina si tienes correcto el camino en inutgraph.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Ayuda con Moviento de paleta en pascal

Publicado por ramon (2158 intervenciones) el 05/11/2013 13:42:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{Si empleas free pascal  este es el cambio que tienes que realizar}
 
program linea;
 uses
    wincrt, graph;
  var
    drive, modo : integer;
    move : char;
    x, y : integer;
 
  begin
      drive := detect;
      initgraph(drive, modo,'c:\tp\bgi'); {ponlo a tu direccion}
      if graphresult <> 0 then
      halt(1)
   else
      begin
         x := 10;  {posicion de la linea en x}
         y := getmaxy - 20; {posicion de la linea en y}
         setcolor(15);
         line(x,y,x + 10,y); {dibujamos linea}
     repeat
        move := readkey;
        setcolor(0);       {borramos linea}
        line(x,y,x + 10,y);
      if move = #75 then
      begin
          x := x - 10; {para mas rapido incrementa y decrementa x en o mas: 10}
          if x < 10 then
          x := 10;
      end;
      if move = #77 then
      begin
          x := x + 10;
          if x > getmaxx - 15 then
          x := getmaxx - 15;
      end;
         setcolor(15);    {dibujamos en nueva posicion}
         line(x,y,x + 10,y);
     until move = #27;  {tecla [esc] termina}
     closegraph;
    end;
  end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar