' 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 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 Private $hWindow As Window Private $nFrame As Integer Public Sub Main() $hWindow = New Window As "Window" With $hWindow .Resize(640, 480) .Framerate = 100 .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 Draw.Background = Color.Black For I = -1 To 1 For J = -1 To 1 Draw.Text(sText, X + I, Y + J) Next Next Draw.Background = Color.White Draw.Text(sText, X, Y) Return Y + Draw.Font.TextHeight(" ") + 4 End Public Sub Window_Draw() 'Dim hImage As Image '$hWindow.Clear '$hWindow.Clear '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 hImage = New Image($hWindow.Width, $hWindow.Height) 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: Inc $nFrame 'If $nFrame = 1000 Then $hWindow.Close 'Print $hWindow.Framerate; " FPS\r"; Y = 10 Draw.Font.Size = Font.DefaultHeight * 2 Y = DrawText($hWindow.Framerate & " " & "FPS", 10, Y) Draw.Font.Size = Font.DefaultHeight Y = DrawText("[F1] " & ("Toggle fullscreen"), 10, Y) Y = DrawText("[F5] " & ("Take screenshot to ~/BeastScroll.png"), 10, Y) Y = DrawText("[ESC] " & ("Quit"), 10, Y) End Public Sub Window_Close() Music.Stop() End Public Sub Window_KeyPress() Select Case Key.Code Case Key.F1 $hWindow.FullScreen = Not $hWindow.FullScreen Case Key.Esc $hWindow.Close Case Key.F5 $hWindow.Screenshot().Save("~/BeastScroll.png") End Select End