1 include {
2 "lib//Graphics.g"
3 "lib//GraphicsTypes.g"
4 "lib//GraphicsUtils.g"
5 "lib//InputDevice.g"
6 }
7
8 define {
9 SCREEN_WIDTH = 640
10 SCREEN_HEIGHT = 480
11 POINT_COUNT = 255
12 }
13
14 func Main <entry> {
15 arr PointArray[$POINT_COUNT+1] of TPoint
16 int mb_left = 0
17 int mb_right = 0
18 float oldtime = 0F
19 float angle = 0F
20 Sprite2D sprite
21 Sprite3D s3d
22 int count = 0
23 int currentzoom = 0
24 int currentpoint = 0
25 int offset = 0
26 int f x y Trans
27
28 InputDevice.UseMouse()
29 InputDevice.UseKeyboard()
30
31 Screen.Create($SCREEN_WIDTH,$SCREEN_HEIGHT,32)
32
33 sprite.Create(16,16,$SPRITE2D_TEXTURE)
34 Graphics.StartDraw(sprite)
35 Graphics.Box(0,0,16,16,RGB(128,128,128))
36 Graphics.Box(1,1,14,14,RGB(255,255,255))
37 Graphics.Box(2,2,12,12,RGB(128,128,128))
38 Graphics.Box(3,3,10,10,RGB(0,0,0))
39 Graphics.StopDraw()
40
41 s3d.Create(sprite)
42
43
44
45 while (!Keyboard.isPushed($BTN_ESCAPE)){
46 Screen.FlipBuffers()
47
48 Screen.Clear(0x000000)
49
50 Mouse.Examine()
51 PointArray[count].x = Mouse.X
52 PointArray[count].y = Mouse.Y
53
54 Screen.Start3D()
55 for f=0, f<=$POINT_COUNT, f++ {
56 currentzoom=(($POINT_COUNT-f) >> 2)+1
57 offset=currentzoom >> 1
58 currentpoint = ((f + count) & $POINT_COUNT)
59 x = PointArray[currentpoint].x
60 y = PointArray[currentpoint].y
61 Trans= f / 2
62
63 s3d.Rotate(0,0)
64 s3d.Zoom(currentzoom, currentzoom)
65 s3d.Rotate(int(angle),1)
66 s3d.Show(x-offset,y-offset,Trans)
67 s3d.Show(($SCREEN_WIDTH-x)-offset,($SCREEN_HEIGHT-y)-offset,Trans)
68 s3d.Rotate(0,0)
69 s3d.Zoom(currentzoom, currentzoom)
70 s3d.Rotate(int(-angle),1)
71 s3d.Show(($SCREEN_WIDTH-x)-offset,y-offset,Trans)
72 s3d.Show(x-offset,($SCREEN_HEIGHT-y)-offset,Trans)
73
74 angle = angle + 0.1F
75 if (angle >= 360F) {
76 angle = 0F
77 }
78 }
79 Screen.Stop3D()
80
81 Graphics.StartDraw(Screen)
82 Graphics.Text(5,5,"Двигай мышью!")
83 Graphics.StopDraw()
84
85 count = (count+1) & $POINT_COUNT
86
87 Keyboard.Examine()
88 }
89 }
90
91