Premier commit
[powerfractal.git] / CD / Src / Spider - Graphic Library / Exemple / Test.cpp
1 // Librairie a utiliser:
2 //
3 // D:\Michel\MesAppl\Spider_DLL\Spider\Debug\Spider.lib
4
5 #include <windows.h>
6 #include <iostream.h>
7 #include "Spider.h"
8 #include "SpiderDraw.h"
9 #include "SpiderUser.h"
10
11
12 int main(int argc,char *argv[],char *envp[])
13 {
14 cout << "Hello" << endl << endl;
15
16
17 cout << "Ouverture fenetre..." << endl;
18
19 Spider::initWindow("Programme de test");
20
21 Spider::moveTo(700,700);
22 Spider::Draw::Color color = Spider::Draw::getPixel();
23 Spider::moveTo( 50, 50); Spider::Draw::displayText("0");
24 Spider::moveTo(100,100); Spider::Draw::displayText("1");
25 Spider::moveTo(150, 50); Spider::Draw::displayText("2");
26 Spider::moveTo(200,100); Spider::Draw::displayText("3");
27 Spider::moveTo(250, 50); Spider::Draw::displayText("4");
28 Spider::moveTo(300,100); Spider::Draw::displayText("5");
29 Spider::moveTo(350, 50); Spider::Draw::displayText("6");
30 Spider::moveTo(400,100); Spider::Draw::displayText("7");
31 Spider::moveTo(450, 50); Spider::Draw::displayText("8");
32 Spider::moveTo(500,100); Spider::Draw::displayText("9");
33
34
35 // Spider::Draw::Color color;
36
37 color.r = 0;
38 color.g = 0;
39 color.b = 0;
40 for(color.r=0;(color.r<256);(color.r)++)
41 {
42 Spider::Draw::setColorPen(color);
43 Spider::lineTo(50+color.r,250,
44 50+color.r,300);
45 }
46
47 color.r = 0;
48 color.g = 0;
49 color.b = 0;
50 for(color.g=0;(color.g<256);(color.g)++)
51 {
52 Spider::Draw::setColorPen(color);
53 Spider::lineTo(50+color.g,300,
54 50+color.g,350);
55 }
56
57 color.r = 0;
58 color.g = 0;
59 color.b = 0;
60 for(color.b=0;(color.b)<256;(color.b)++)
61 {
62 Spider::Draw::setColorPen(color);
63 Spider::lineTo(50+color.b,350,
64 50+color.b,400);
65 }
66
67
68 color.r = 255; color.g = 255; color.b = 0; Spider::Draw::setColorPen(color);
69 Spider::moveTo(260,300); Spider::Draw::circle(10,Spider::Draw::noFill);
70 Spider::moveTo(260,350); Spider::Draw::circle(10,Spider::Draw::fill);
71
72 color.r = 0; color.g = 255; color.b = 255; Spider::Draw::setColorPen(color);
73
74
75 int x=0, y=0;
76 int ax=0,ay=0;
77 char car_temp;
78 char car[2]; car[1] = 0x00;
79 while(1)
80 {
81 if(Spider::User::keyPressed(&car_temp))
82 car[0] = car_temp;
83
84 if(Spider::User::leftClic(x,y))
85 {
86 Spider::lineTo(ax,ay,x,y);
87 cout << "Ajout du point (" << x << "," << y << ")." << endl;
88
89 Spider::Draw::displayText(car);
90
91 ax = x;
92 ay = y;
93 }
94 else
95 {
96 Spider::User::delay(50);
97 }
98 }
99
100 Spider::User::delay(50000);
101
102 Spider::closeWindow();
103
104
105 while(1)
106 ;
107
108 return 0;
109 }