$TYPECHECK ON
$RESOURCE ys0 AS "ysub0.bmp"
$RESOURCE ys1 AS "ysub1.bmp"
DECLARE SUB Resize
DECLARE SUB ShowSub
DECLARE SUB MoveSub
DECLARE SUB CheckMouse
DECLARE SUB EndProg
DIM Ysub0 AS QBITMAP
Ysub0.BmpHandle = ys0
DIM Ysub1 AS QBITMAP
Ysub1.BmpHandle = ys1
DIM x AS INTEGER, y AS INTEGER
DIM oldX AS INTEGER, oldY AS INTEGER
DIM xdir AS BYTE, ydir AS BYTE, Help AS BYTE
RANDOMIZE
x = RND(Screen.Width) : y = RND(Screen.Height)
CREATE Form AS QFORM
Width = Screen.Width
Height = Screen.Height
COLOR = 0 : BorderStyle = 0
onResize = Resize
onKeyPress = EndProg
CREATE Canvas AS QCANVAS
Cursor = -1
onMouseMove = CheckMouse
END CREATE
END CREATE
CREATE MyTimer AS QTIMER
Interval = 1
onTimer = MoveSub
END CREATE
Form.SHOWMODAL
SUB Resize
Canvas.Height = Form.ClientHeight
Canvas.Width = Form.ClientWidth
END SUB
SUB ShowSub
IF xdir THEN Canvas.Draw x, y, Ysub1.bmp
IF xdir = 0 THEN Canvas.Draw x, y, Ysub0.bmp
END SUB
SUB MoveSub
IF x > Screen.Width THEN xdir = 1
IF x < -160 THEN xdir = 0
IF y > Screen.Height THEN ydir = 1
IF y < -100 THEN ydir = 0
IF xdir THEN DEC x, 3 ELSE INC x, 3
IF ydir THEN DEC y ELSE INC y
ShowSub
END SUB
SUB CheckMouse
IF Help THEN IF MOUSEX <> oldX OR MOUSEY <> oldY THEN END
oldX = MOUSEX : oldY = MOUSEY
Help = 1
END SUB
SUB EndProg
END
END SUB
|