2014-12-12 20:58:52 +01:00
|
|
|
' Gambas module file
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
'Public Screen As New Window As "Screen"
|
2014-12-12 20:58:52 +01:00
|
|
|
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
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
Private $hWindow As Window
|
|
|
|
Private $nFrame As Integer
|
|
|
|
|
2014-12-12 20:58:52 +01:00
|
|
|
Public Sub Main()
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
$hWindow = New Window As "Window"
|
|
|
|
|
|
|
|
With $hWindow
|
|
|
|
.Resize(640, 480)
|
2015-01-02 04:44:30 +01:00
|
|
|
.Framerate = 00
|
2014-12-12 20:58:52 +01:00
|
|
|
.Resizable = False
|
|
|
|
.Show()
|
|
|
|
End With
|
|
|
|
|
|
|
|
Music.Load("b-title.mod")
|
|
|
|
|
|
|
|
ciel = image.Load("bgd1_ciel.png")
|
|
|
|
nuage1 = image.Load("sprite_nuages1.png")
|
|
|
|
montagnes = image.Load("bgd2_montagnes.png")
|
|
|
|
sol1 = image.Load("bgd3_sol1.png")
|
|
|
|
sol2 = image.Load("bgd4_sol2.png")
|
|
|
|
sol3 = image.Load("bgd5_sol3.png")
|
|
|
|
nuage1 = image.Load("sprite_nuages1.png")
|
|
|
|
nuage2 = image.Load("sprite_nuages2.png")
|
|
|
|
nuage3 = image.Load("sprite_nuages3.png")
|
|
|
|
nuage4 = image.Load("sprite_nuages4.png")
|
|
|
|
barriere = image.Load("sprite_barriere.png")
|
|
|
|
arbre = image.Load("sprite_arbre.png")
|
|
|
|
fireworks = image.Load("fireworks.png")
|
|
|
|
scrolltext = image.Load("scrolltext.png")
|
|
|
|
|
|
|
|
speed = 2
|
|
|
|
scroll = 0
|
|
|
|
scrollb = 0
|
|
|
|
scroll1 = 0
|
|
|
|
scroll2 = 0
|
|
|
|
scroll3 = 0
|
|
|
|
scroll4 = 0
|
|
|
|
scroll5 = Rnd(0, 640)
|
|
|
|
scroll5b = Rnd(0, 640)
|
|
|
|
scroll6 = 0
|
|
|
|
|
|
|
|
Music.Play(-1, 1)
|
|
|
|
|
|
|
|
End
|
|
|
|
|
|
|
|
Private Sub DrawText(sText As String, X As Integer, Y As Integer) As Integer
|
|
|
|
|
|
|
|
Dim I As Integer
|
|
|
|
Dim J As Integer
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
Draw.Background = Color.Black
|
2014-12-12 20:58:52 +01:00
|
|
|
For I = -1 To 1
|
|
|
|
For J = -1 To 1
|
|
|
|
Draw.Text(sText, X + I, Y + J)
|
|
|
|
Next
|
|
|
|
Next
|
2015-01-01 10:01:16 +01:00
|
|
|
Draw.Background = Color.White
|
2014-12-12 20:58:52 +01:00
|
|
|
Draw.Text(sText, X, Y)
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
Return Y + Draw.Font.TextHeight(" ") + 4
|
2014-12-12 20:58:52 +01:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
Public Sub Window_Draw()
|
2014-12-12 20:58:52 +01:00
|
|
|
|
|
|
|
'Dim hImage As Image
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
'$hWindow.Clear
|
2014-12-12 20:58:52 +01:00
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
'$hWindow.Clear
|
2014-12-12 20:58:52 +01:00
|
|
|
'Goto PRINT_TEXT
|
|
|
|
|
|
|
|
Dim Y As Integer
|
|
|
|
|
|
|
|
scroll = scroll + speed
|
|
|
|
Dec (scroll1)
|
|
|
|
scroll2 = scroll2 - 2
|
|
|
|
scroll3 = scroll3 - 3
|
|
|
|
scroll4 = scroll4 - 4
|
|
|
|
scroll5 = scroll5 - 5
|
|
|
|
scroll5b = scroll5b - 2
|
|
|
|
scroll6 = scroll6 - 5
|
|
|
|
|
|
|
|
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 False
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
hImage = New Image($hWindow.Width, $hWindow.Height)
|
2014-12-12 20:58:52 +01:00
|
|
|
|
|
|
|
hImage.DrawImage(ciel, 0, 0)
|
|
|
|
hImage.DrawImage(montagnes, scroll1, 200)
|
|
|
|
hImage.DrawImage(montagnes, scroll1 + 640, 200)
|
|
|
|
hImage.DrawImage(sol1, scroll2, 420)
|
|
|
|
hImage.DrawImage(sol1, scroll2 + 640, 420)
|
|
|
|
hImage.DrawImage(sol2, scroll3, 430)
|
|
|
|
hImage.DrawImage(sol2, scroll3 + 640, 430)
|
|
|
|
hImage.DrawImage(sol3, scroll4, 450)
|
|
|
|
hImage.DrawImage(sol3, scroll4 + 640, 450)
|
|
|
|
|
|
|
|
hImage.PaintImage(nuage1, scroll6, 0)
|
|
|
|
hImage.PaintImage(nuage1, scroll6 + 640, 0)
|
|
|
|
hImage.PaintImage(nuage2, scroll4, 82)
|
|
|
|
hImage.PaintImage(nuage2, scroll4 + 640, 82)
|
|
|
|
hImage.PaintImage(nuage3, scroll3, 120)
|
|
|
|
hImage.PaintImage(nuage3, scroll3 + 640, 120)
|
|
|
|
hImage.PaintImage(nuage4, scroll2, 138)
|
|
|
|
hImage.PaintImage(nuage4, scroll2 + 640, 138)
|
|
|
|
hImage.PaintImage(barriere, scroll5, 440)
|
|
|
|
hImage.PaintImage(arbre, scroll5b, 140)
|
|
|
|
hImage.PaintImage(fireworks, scrollb, 0)
|
|
|
|
hImage.PaintImage(scrolltext, scrollb + 640, 0)
|
|
|
|
|
|
|
|
Draw.Image(hImage, 0, 0)
|
|
|
|
|
|
|
|
#Else
|
|
|
|
|
|
|
|
Draw.Image(ciel, 0, 0)
|
|
|
|
Draw.Image(montagnes, scroll1, 200)
|
|
|
|
Draw.Image(montagnes, scroll1 + 640, 200)
|
|
|
|
Draw.Image(sol1, scroll2, 420)
|
|
|
|
Draw.Image(sol1, scroll2 + 640, 420)
|
|
|
|
Draw.Image(sol2, scroll3, 430)
|
|
|
|
Draw.Image(sol2, scroll3 + 640, 430)
|
|
|
|
Draw.Image(sol3, scroll4, 450)
|
|
|
|
Draw.Image(sol3, scroll4 + 640, 450)
|
|
|
|
Draw.Image(nuage1, scroll6, 0)
|
|
|
|
Draw.Image(nuage1, scroll6 + 640, 0)
|
|
|
|
Draw.Image(nuage2, scroll4, 82)
|
|
|
|
Draw.Image(nuage2, scroll4 + 640, 82)
|
|
|
|
Draw.Image(nuage3, scroll3, 120)
|
|
|
|
Draw.Image(nuage3, scroll3 + 640, 120)
|
|
|
|
Draw.Image(nuage4, scroll2, 138)
|
|
|
|
Draw.Image(nuage4, scroll2 + 640, 138)
|
|
|
|
Draw.Image(barriere, scroll5, 440)
|
|
|
|
Draw.Image(arbre, scroll5b, 140)
|
|
|
|
Draw.Image(fireworks, scrollb, 0)
|
|
|
|
Draw.Image(scrolltext, scrollb + 640, 0)
|
|
|
|
|
|
|
|
#Endif
|
|
|
|
|
|
|
|
PRINT_TEXT:
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
Inc $nFrame
|
|
|
|
'If $nFrame = 1000 Then $hWindow.Close
|
|
|
|
|
|
|
|
'Print $hWindow.Framerate; " FPS\r";
|
2014-12-12 20:58:52 +01:00
|
|
|
|
|
|
|
Y = 10
|
2015-01-01 10:01:16 +01:00
|
|
|
Draw.Font.Size = Font.DefaultHeight * 2
|
|
|
|
Y = DrawText($hWindow.Framerate & " FPS", 10, Y)
|
|
|
|
Draw.Font.Size = Font.DefaultHeight
|
2014-12-12 20:58:52 +01:00
|
|
|
Y = DrawText("[F1] Toggle fullscreen", 10, Y)
|
|
|
|
Y = DrawText("[F5] Take screenshot to ~/BeastScroll.png", 10, Y)
|
|
|
|
Y = DrawText("[ESC] Quit", 10, Y)
|
|
|
|
|
|
|
|
End
|
|
|
|
|
2015-01-01 10:01:16 +01:00
|
|
|
Public Sub Window_Close()
|
2014-12-12 20:58:52 +01:00
|
|
|
|
|
|
|
Music.Stop()
|
|
|
|
|
|
|
|
End
|
2015-01-01 10:01:16 +01:00
|
|
|
|
|
|
|
Public Sub Window_KeyPress()
|
2014-12-12 20:58:52 +01:00
|
|
|
|
|
|
|
Select Case Key.Code
|
|
|
|
Case Key.F1
|
2015-01-01 10:01:16 +01:00
|
|
|
$hWindow.FullScreen = Not $hWindow.FullScreen
|
2014-12-12 20:58:52 +01:00
|
|
|
Case Key.Esc
|
2015-01-01 10:01:16 +01:00
|
|
|
$hWindow.Close
|
2014-12-12 20:58:52 +01:00
|
|
|
Case Key.F5
|
2015-01-01 10:01:16 +01:00
|
|
|
$hWindow.Screenshot().Save("~/BeastScroll.png")
|
2014-12-12 20:58:52 +01:00
|
|
|
End Select
|
|
|
|
|
|
|
|
End
|