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
75
76
77
| ' Gambas module file
PUBLIC screen AS NEW window AS "screen"
' structure pour stocker les coordonnées d'une étoile ' ainsi que sa vitesse PUBLIC STRUCT Star x AS INTEGER y AS INTEGER speed AS INTEGER END STRUCT
' notre champ étoilé PRIVATE Starfield AS NEW Star[]
' le logo PRIVATE img AS Image PRIVATE rotation AS INTEGER = 0
PUBLIC SUB Main()
DIM i AS INTEGER DIM stars AS Star RANDOMIZE ' Ouverture de notre fenêtre, on limite ' a 60 images par secondes maximum WITH screen .framerate = 60 .show() END WITH img = Image.Load("gambaslogo.png") ' Remplissons notre champ étoilé FOR i = 0 TO 100 Stars = NEW star Stars.x = Int(Rnd(Screen.Width)) Stars.y = Int(Rnd(screen.Height)) Stars.speed = Int(Rnd(1, 4)) Starfield.Push(stars) NEXT
END
PUBLIC SUB screen_draw() DIM Stars AS Star
screen.Clear() FOR EACH Stars IN Starfield ' Plus une étoile est rapide (proche), plus elle est lumineuse Draw.ForeColor = &h444444& * Stars.speed ' Plus elle est proche plus sa trace est longue Draw.Line(Stars.x, Stars.y, Stars.x + (Stars.speed * 2), stars.y) Stars.x = Stars.x + Stars.speed
' Notre étoile est hors de l'écran IF Stars.x > screen.Width THEN Stars.x = 0 Stars.y = Int(Rnd(screen.Height)) Stars.speed = Int(Rnd(1, 4)) ENDIF NEXT ' Attention la couleur affecte aussi les images ! Draw.ForeColor = &hFFFFFF& ' on applique la rotation et on affiche le logo Draw.Rotate(rotation) Draw.Image(img, 570, 405) ' rotation de 0 a 360 :-) rotation = (rotation + 1) MOD 360 END
|