Guidance
指路人
g.yi.org
software / rapidq / Examples / Graphics & Animation / Screen Saver / YELLSUB / YELLSUB.BAS

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'---------------------------------------------------------
'YELLSUB.BAS for RapidQ - Written by Dieter Folger
'Simple screensaver example
'The Yellow Submarine from the Beatles film
'is moved around the screen. The program ends
'when mouse is moved or a key is pressed.
'It can be used when renamed to *.SCR and put it
'in the \WINDOWS\SYSTEM directory.
'---------------------------------------------------------
     $TYPECHECK ON

     $RESOURCE ys0 AS "ysub0.bmp" ' 2 bitmaps
     $RESOURCE ys1 AS "ysub1.bmp" ' 150x90 pixels

     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
掌柜推荐
 
 
¥287.00 ·
 
 
¥2,600.00 ·
 
 
¥289.00 ·
 
 
¥1,370.00 ·
 
 
¥289.00 ·
 
 
¥1,480.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-06-01 00:00:00