Premier commit
[powerfractal.git] / CD / Src / Spider - Graphic Library / Exemple / test.ada
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --  Nom du fichier    : Test.ads                                            --
4 --                                                                          --
5 --  Auteur(s)         : Livio Righetti                                      --
6 --                                                                          --
7 --  Date de creation  : 26-MARS-97                                          --
8 --                                                                          --
9 --  But               : Mettre a disposition des fonctions graphiques       --
10 --                      minimales.                                          --
11 --                                                                          --
12 --  Date de modif.    : 18-SEPT-97 (G.corbaz)                               --
13 --  Raison            : Utilisation du paquetage Adagraph                   --
14 --                                                                          --
15 --  Date de modif.    : 7-AVRIL-99 (P.Girardet)                             --
16 --  Raison            : Pour creer une librairie                            --
17 --                                                                          --
18 --  Date de modif.    : 28 avril 2000 (SALAMIN Michel)                      --
19 --  Raison            : Suppression de AdaGraph et utilisation d'une DLL    --
20 --                      faisant des appels directs aux API de Windows.      --
21 --                                                                          --
22 --  Modules appeles   :                                                     --
23 --  Mat. particulier  : Graphmin.dll                                        --
24 --                                                                          --
25 --  Compilateur       :                                                     --
26 --                                                                          --
27 ------------------------------------------------------------------------------
28
29 with Ada.Text_Io;
30 use Ada.Text_IO;
31
32 with Spider;
33 with Spider.Draw;
34 with Spider.User;
35      
36 procedure Test is
37   car_Temp : Character;
38   car : Character := ' ';
39   tailleX : Natural;
40   color : Spider.Draw.tColor;
41   X : Integer := 0;
42   Y : Integer := 0;
43   AX : Integer := 0;
44   AY : Integer := 0;
45   Clic : Boolean := false;
46 begin
47     
48   Spider.Init_Window("Programme de test");
49
50   Spider.move_To(700,700);
51   Spider.move_To( 50, 50); Spider.Draw.display_Text("0");
52   Spider.move_To(100,100); Spider.Draw.display_Text("1");
53   Spider.move_To(150, 50); Spider.Draw.display_Text("2");
54   Spider.move_To(200,100); Spider.Draw.display_Text("3");
55   Spider.move_To(250, 50); Spider.Draw.display_Text("4");
56   Spider.move_To(300,100); Spider.Draw.display_Text("5");
57   Spider.move_To(350, 50); Spider.Draw.display_Text("6");
58   Spider.move_To(400,100); Spider.Draw.display_Text("7");
59   Spider.move_To(450, 50); Spider.Draw.display_Text("8");
60   Spider.move_To(500,100); Spider.Draw.display_Text("9");
61
62
63
64   color.r := 0;
65   color.g := 0;
66   color.b := 0;
67   for I in 0..255 loop
68     color.r := I;
69     Spider.Draw.set_Color_Pen(color);
70     Spider.line_To(50+I,250,
71                    50+I,300);
72   end loop;
73
74   color.r := 0;
75   color.g := 0;
76   color.b := 0;
77   for I in 0..255 loop
78     color.g := I;
79     Spider.Draw.set_Color_Pen(color);
80     Spider.line_To(50+I,300,
81                    50+I,350);
82   end loop;
83
84   color.r := 0;
85   color.g := 0;
86   color.b := 0;
87   for I in 0..255 loop
88     color.b := I;
89     Spider.Draw.set_Color_Pen(color);
90     Spider.line_To(50+I,350,
91                    50+I,400);
92   end loop;
93
94
95   color.r := 255;
96   color.g := 255;
97   color.b :=   0;
98   Spider.Draw.set_Color_Pen(color);
99   
100   Spider.move_To(260,300); Spider.Draw.circle(10,Spider.Draw.noFill);
101   Spider.move_To(260,350); Spider.Draw.circle(10,Spider.Draw.fill);
102
103   color.r :=   0;
104   color.g := 255;
105   color.b := 255;
106   Spider.Draw.set_Color_Pen(color);
107
108
109   while true loop
110       Spider.User.key_Pressed(car_Temp,Clic);
111       if Clic then
112         Car := Car_Temp;
113       end if;
114       
115       Spider.User.left_Clic(x,y,Clic);
116    
117     if Clic then
118       Spider.line_To(ax,ay,x,y);
119       Spider.Draw.Display_Text((1=>Car));
120       
121       Put("Ajout du point (");
122       Put(Integer'image(X));
123       Put(",");
124       Put(Integer'image(Y));
125       Put_Line(").");
126       
127       ax := x;
128       ay := y;
129     else
130       Spider.User.Sleep(50);
131     end if;
132   end loop;
133   
134   Spider.close_Window;
135       
136 end Test;