[EXAMPLES]

* NEW: New StarField example made by Laurent Carlier.


git-svn-id: svn://localhost/gambas/trunk@4071 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-09-01 00:59:00 +00:00
parent 52552bd548
commit a21a408a78
9 changed files with 114 additions and 7 deletions

View File

@ -371,7 +371,7 @@ msgstr ""
#: FGotoLine.form:23 FHelpBrowser.form:60 FIconEditor.class:1413
#: FList.form:121 FMain.class:200 FMakeInstall.class:327 FMenu.form:369
#: FNewConnection.form:244 FNewTable.form:86 FNewTranslation.form:21
#: FOpenProject.form:167 FOption.class:618 FPasteSpecial.form:77
#: FOpenProject.form:168 FOption.class:618 FPasteSpecial.form:77
#: FPasteTable.form:107 FPropertyComponent.form:230 FPropertyProject.form:124
#: FReportBorderChooser.form:45 FReportBrushChooser.form:34
#: FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28
@ -410,7 +410,7 @@ msgstr ""
#: FConnectionEditor.class:441 FCreateFile.form:430 FFieldChooser.form:132
#: FFontChooser.form:34 FGotoLine.form:17 FList.form:115 FMain.form:1313
#: FMenu.form:364 FNewConnection.form:238 FNewTable.form:80
#: FNewTranslation.form:15 FOpenProject.form:161 FPasteSpecial.form:71
#: FNewTranslation.form:15 FOpenProject.form:162 FPasteSpecial.form:71
#: FPropertyComponent.form:224 FPropertyProject.form:118
#: FReportBorderChooser.form:51 FReportBrushChooser.form:40
#: FReportCoordChooser.form:32 FReportPaddingChooser.form:69
@ -1093,7 +1093,7 @@ msgstr ""
msgid "Title"
msgstr ""
#: FCreateProject.form:391 FOpenProject.form:156
#: FCreateProject.form:391 FOpenProject.form:157
msgid "Open in another window"
msgstr ""
@ -2532,15 +2532,15 @@ msgstr ""
msgid "Sort history"
msgstr ""
#: FMain.class:560 FOpenProject.form:109 FWelcome.form:35
#: FMain.class:560 FOpenProject.form:110 FWelcome.form:35
msgid "Sort by date"
msgstr ""
#: FMain.class:560 FOpenProject.form:118 FWelcome.form:42
#: FMain.class:560 FOpenProject.form:119 FWelcome.form:42
msgid "Sort by name"
msgstr ""
#: FMain.class:560 FOpenProject.form:126 FWelcome.form:48
#: FMain.class:560 FOpenProject.form:127 FWelcome.form:48
msgid "Sort by path"
msgstr ""
@ -3061,7 +3061,7 @@ msgstr ""
msgid "Recent"
msgstr ""
#: FOpenProject.form:136 FWelcome.class:52
#: FOpenProject.form:137 FWelcome.class:52
msgid "Examples"
msgstr ""

View File

@ -63,6 +63,7 @@
Spacing = True
{ txtFilter ButtonBox
MoveScaled(1,0,24,4)
Foreground = Color.LightForeground
Expand = True
Picture = Picture["icon:/small/clear"]
}

View File

@ -0,0 +1,2 @@
[Desktop Entry]
Icon=./.icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -0,0 +1,12 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.3
Title=Star Field
Startup=MMain
Icon=enterprise.png
Version=0.0.3
Component=gb.image
Component=gb.image.io
Component=gb.sdl
Component=gb.sdl.sound
Authors="Laurent Carlier\nBenoît Minisini"
TabSize=2

View File

@ -0,0 +1,81 @@
' 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
.Resizable = False
.Show()
End With
img = Image.Load("logo.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.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&
Draw.Text(Screen.Framerate, 10, Screen.Height - 40)
' on applique la rotation et on affiche le logo
Draw.Rotate(rotation)
Draw.Image(img, Screen.Width - 128, Screen.Height - 128)
' rotation de 0 a 360 :-)
rotation = (rotation + 1) Mod 360
End

View File

@ -0,0 +1,11 @@
MMain
Star Field
0
0
0.0.3
gb.image
gb.image.io
gb.sdl
gb.sdl.sound

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB