Graphics 640,480,16,0
; Установка режима со вторыи буфером
SetBuffer BackBuffer() ; Глобальные переменные для графических
файлов
Global fon, kursor, ekran, mx, my, StartX,StartY, MouseX, MouseY
fon=LoadImage("images\fon.jpg")
kursor=LoadAnimImage("images\kursor.png",20,20,0,3)
MaskImage kursor,255,255,255
; переменные
StartX=0
StartY=0
ekran=0 ;0 - левая часть экрана, 1 - правая
While Not KeyHit(1)
Cls ; clear the screen
fon ()
Mouse ()
Flip ; flip the image into view and clear the back buffer
MouseGet ()
If ekran=0 And mx>620 Then fonL () :ekran=1 ;Если нажать кнопку
мыши правей 620 пикселей экран сдвинется вправо
;End If
If ekran=1 And mx<20 Then fonR () :ekran=0 ;Если нажать кнопку
мыши левей 20 пикселей экран сдвинется влево
;End If
Wend
Function MouseGet () ; функция опроса мыши
button=GetMouse() ; Опрос мыши
If button <> 0 Then
mx=MouseX()
my=MouseY()
End If
End Function
Function Mouse () ; функция опроса координат мыши и прорисовка
формы курсора
If ekran=0 And MouseX()>620 Then DrawImage kursor,MouseX()-10,MouseY()-10,1
; Draw the image!
If ekran=1 And MouseX()<20 Then DrawImage kursor,MouseX()-10,MouseY()-10,2
; Draw the image!
If ekran=0 And MouseX()<620 Then DrawImage kursor,MouseX()-10,MouseY()-10,0
; Draw the image!
If ekran=1 And MouseX()>20 Then DrawImage kursor,MouseX()-10,MouseY()-10,0
; Draw the image!
End Function
Function fon () ; отрисовка фона
DrawImage fon,StartX,StartY
End Function
Function fonL () ; отрисовка движения фона влево
For deltaX=0 To -360 Step -1
Cls ; clear the screen
DrawImage fon,StartX+deltaX,StartY
DrawImage kursor,MouseX()-10,MouseY()-10,0 ; Draw the image!
Flip ; flip the image into view and clear the back buffer
Next
StartX=StartX+deltaX
End Function
Function fonR () ; отрисовка движения фона вправо
For deltaX=0 To 360 Step 1
Cls ; clear the screen
DrawImage fon,StartX+deltaX,StartY
DrawImage kursor,MouseX()-10,MouseY()-10,0 ; Draw the image!
Flip ; flip the image into view and clear the back buffer
Next
StartX=StartX+deltaX
End Function |