[EXAMPLES]

* NEW: Show frames per seconds in BeastScroll


git-svn-id: svn://localhost/gambas/trunk@3207 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Laurent Carlier 2010-09-12 18:32:35 +00:00
parent 210a396888
commit 14faff737a

View file

@ -1,39 +1,39 @@
' Gambas module file
PUBLIC Screen AS NEW Window AS "Screen"
PUBLIC ciel AS Image
PUBLIC montagnes AS image
PUBLIC barriere AS image
PUBLIC sol1 AS image
PUBLIC sol2 AS image
PUBLIC sol3 AS image
PUBLIC nuage1 AS Image
PUBLIC nuage2 AS image
PUBLIC nuage3 AS image
PUBLIC nuage4 AS image
PUBLIC arbre AS image
PUBLIC fireworks AS image
PUBLIC scrolltext AS image
Public Screen As New Window As "Screen"
Public ciel As Image
Public montagnes As Image
Public barriere As Image
Public sol1 As Image
Public sol2 As Image
Public sol3 As Image
Public nuage1 As Image
Public nuage2 As Image
Public nuage3 As Image
Public nuage4 As Image
Public arbre As Image
Public fireworks As Image
Public scrolltext As Image
PUBLIC scroll AS Integer
PUBLIC scrollb AS Integer
PUBLIC scroll1 AS Integer
PUBLIC scroll2 AS Integer
PUBLIC scroll3 AS Integer
PUBLIC scroll4 AS Integer
PUBLIC scroll5 AS Integer
PUBLIC scroll5b AS Integer
PUBLIC scroll6 AS Integer
PUBLIC speed AS Integer
Public scroll As Integer
Public scrollb As Integer
Public scroll1 As Integer
Public scroll2 As Integer
Public scroll3 As Integer
Public scroll4 As Integer
Public scroll5 As Integer
Public scroll5b As Integer
Public scroll6 As Integer
Public speed As Integer
PUBLIC SUB Main()
Public Sub Main()
WITH Screen
With Screen
.Width = 640
.Height = 480
.Framerate = 100
.Show()
END WITH
End With
music.Load("b-title.mod")
@ -65,14 +65,14 @@ PUBLIC SUB Main()
music.Play(-1, 1)
END
End
PUBLIC SUB Screen_Draw()
Public Sub Screen_Draw()
Screen.Clear
scroll = scroll + speed
DEC (scroll1)
Dec (scroll1)
scroll2 = scroll2 - 2
scroll3 = scroll3 - 3
scroll4 = scroll4 - 4
@ -80,18 +80,18 @@ PUBLIC SUB Screen_Draw()
scroll5b = scroll5b - 2
scroll6 = scroll6 - 5
IF (scroll = 320) THEN speed = -2
IF (scroll = -960) THEN speed = 2
If (scroll = 320) Then speed = -2
If (scroll = -960) Then speed = 2
scrollb = scroll
IF (scrollb < - 640) THEN scrollb = - 640
IF (scrollb > 0) THEN scrollb = 0
IF (scroll1 = - 640) THEN scroll1 = 0
IF (scroll2 = - 640) THEN scroll2 = 0
IF (scroll3 < - 640) THEN scroll3 = scroll3 + 640
IF (scroll4 < - 640) THEN scroll4 = scroll4 + 640
IF (scroll5 < - 640) THEN scroll5 = scroll5 + 1280
IF (scroll5b < - 640) THEN scroll5b = scroll5b + 1280
IF (scroll6 < - 640) THEN scroll6 = scroll6 + 640
If (scrollb < - 640) Then scrollb = - 640
If (scrollb > 0) Then scrollb = 0
If (scroll1 = - 640) Then scroll1 = 0
If (scroll2 = - 640) Then scroll2 = 0
If (scroll3 < - 640) Then scroll3 = scroll3 + 640
If (scroll4 < - 640) Then scroll4 = scroll4 + 640
If (scroll5 < - 640) Then scroll5 = scroll5 + 1280
If (scroll5b < - 640) Then scroll5b = scroll5b + 1280
If (scroll6 < - 640) Then scroll6 = scroll6 + 640
Draw.Image(ciel, 0, 0)
Draw.Image(montagnes, scroll1, 200)
@ -114,18 +114,20 @@ PUBLIC SUB Screen_Draw()
Draw.Image(arbre, scroll5b, 140)
Draw.Image(fireworks, scrollb, 0)
Draw.Image(scrolltext, scrollb + 640, 0)
END
Draw.ForeColor = &hFFFF00&
Draw.Text(Screen.Framerate & " FPS", 5, 450)
PUBLIC SUB Screen_Close()
End
Public Sub Screen_Close()
Music.Stop()
END
End
PUBLIC SUB Screen_KeyPress()
Public Sub Screen_KeyPress()
IF (key.Code = key.F1) THEN Screen.FullScreen = NOT Screen.FullScreen
IF (key.Code = key.Esc) THEN Screen.Close()
If (key.Code = key.F1) Then Screen.FullScreen = Not Screen.FullScreen
If (key.Code = key.Esc) Then Screen.Close()
END
End