1 include {
2 "lib//Graphics.g"
3 "lib//GraphicsUtils.g"
4 "lib//InputDevice.g"
5 }
6
7 define {
8 SCREEN_WIDTH = 1024
9 SCREEN_HEIGHT = 768
10 }
11
12 func double abs(double Num) {
13 return ?(Num > 0D, Num, -Num)
14 }
15
16 func double Super(double m n1 n2 n3 a b phi) {
17 return pow((abs(cos(m*phi/4D)/a)),n2)+pow((abs(pow((sin(m*phi/4D)/b),n3))),(1D / -n1))
18 }
19
20 func Main <entry> {
21 double var1 = 3.11D
22 double var2 = 9.9D
23 double var3 = 1.4D
24 double var4 = 3.5D
25 double var5 = 0.2D
26 double var6 = 1.0D
27 double phi
28 float r PunktA PunktB
29
30 InputDevice.UseKeyboard()
31 Screen.Create($SCREEN_WIDTH, $SCREEN_HEIGHT, 32)
32
33 while(!Keyboard.isReleased($BTN_ESCAPE)) {
34 Screen.FlipBuffers()
35 Screen.Clear(0x000000)
36
37 Graphics.StartDraw(Screen)
38 Graphics.Text(5, 5, "выбор фигуры (Q/A): " + str(var1))
39 Graphics.Text(5, 25, "параметры (W/S): " + str(var2))
40 Graphics.Text(5, 45, " (E/D): " + str(var3))
41 Graphics.Text(5, 65, " (R/F): " + str(var4))
42 Graphics.Text(5, 85, " (T/G): " + str(var5))
43 Graphics.Text(5, 105, " (X/C): " + str(var6))
44 Graphics.Text(5, 145, "Клавиши изменяют формулу!")
45
46 phi = 0D
47 while (phi < 360D) {
48 r = float(Super(var1,var2,var3,var4,var5,var6,phi))
49 PunktA = r*float(cos(phi))*10F + float($SCREEN_WIDTH / 2)
50 PunktB = -r*float(sin(phi))*10F + float($SCREEN_HEIGHT / 2)
51 if (((PunktA > 0F) && (PunktA < float($SCREEN_WIDTH))) && ((PunktB > 0F) && (PunktB < float($SCREEN_HEIGHT)))) {
52 Graphics.Plot(int(PunktA),int(PunktB), 0x00FF00)
53 }
54 phi+= 0.01D
55 }
56 Graphics.StopDraw()
57
58 Keyboard.Examine()
59
60 if (Keyboard.isReleased($BTN_Q)) : var1+=0.01D
61 if (Keyboard.isReleased($BTN_A)) : var1-=0.01D
62 if (Keyboard.isReleased($BTN_W)) : var2+=0.1D
63 if (Keyboard.isReleased($BTN_S)) : var2-=0.1D
64 if (Keyboard.isReleased($BTN_E)) : var3+=0.1D
65 if (Keyboard.isReleased($BTN_D)) : var3-=0.1D
66 if (Keyboard.isReleased($BTN_R)) : var4+=0.1D
67 if (Keyboard.isReleased($BTN_F)) : var4-=0.1D
68 if (Keyboard.isReleased($BTN_T)) : var5+=0.1D
69 if (Keyboard.isReleased($BTN_G)) : var5-=0.1D
70 if (Keyboard.isReleased($BTN_C)) : var6+=0.1D
71 if (Keyboard.isReleased($BTN_X)) : var6-=0.1D
72
73 }
74 }
75
Редактировать