home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 February / PCWK0297.iso / envelop / envelop.6 / Tools / Bootcamp / basic / gametop / gametop.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  5.1 KB  |  197 lines

  1. Type GameTopMasterForm From SampleMasterForm
  2.   Dim GameTopOptionMenu As New PopupMenu
  3.   Dim GameTopMenuBar As New MenuBar
  4.   Dim imgTop As New Image
  5.   Dim TimerToggle As Integer
  6.   Dim SpinCounter As Integer
  7.   Dim bmpTop As New Bitmap
  8.  
  9.   ' METHODS for object: GameTopMasterForm
  10.   Sub DisplayImage(row As Integer, column As Integer)
  11.     Dim x As Integer
  12.     Dim y As Integer
  13.   
  14.     ' Compensate for the array coordinates
  15.     x = (column - 1)
  16.     y = (row - 1)
  17.   
  18.     ' Take the size of the crop rect times the row and column values
  19.     imgTop.CropXOffset = (imgTop.CropXSize * x)
  20.     imgTop.CropYOffset = (imgTop.CropYSize * y)
  21.   
  22.   End Sub
  23.  
  24.   Sub ExitApplication_Click
  25.     Dim F Strictly As SampleMasterForm
  26.     F = Me
  27.   
  28.     ' Turn off the spin properties
  29.     TimerToggle = 0
  30.     TimerSpinTop.Enabled = "False"
  31.   
  32.     ' Forward to parent
  33.     F.ExitApplication_Click
  34.   End Sub
  35.  
  36.   Sub ResetApplication_Click ()
  37.   
  38.     ' Load in the top bitmap
  39.     GameTopMasterForm.bmpTop.FileName = SampleDir & "top.bmp"
  40.   
  41.     ' Initialize the start/stop button
  42.     ' Add a checkmark to the Stop entry
  43.     GameTopOptionMenu.CheckItem("StopTop", 1)
  44.   
  45.     imgTop.Picture = bmpTop
  46.     ' These width and height values with scale factor of 1 will produce a cropXSize of 66 and
  47.     ' a cropYsize of 61.  These values coincide with dividing the overall size of the bitmap
  48.     ' which height = 183 and width = 396 into a 3x6 bitmap array with (3) rows and (6) columns
  49.     imgTop.Width = 990
  50.     imgTop.Height = 920
  51.   
  52.     imgTop.CropXSize = 66
  53.     imgTop.CropYSize = 61
  54.     imgTop.CropXOffset = 0
  55.     imgTop.CropYOffset = 0
  56.   
  57.     ' Initialize the SpinCounter
  58.     SpinCounter = 1
  59.   
  60.   End Sub
  61.  
  62.   Sub SpinTop()
  63.     SpinCounter = SpinCounter + 1
  64.     If SpinCounter > 18 Then 
  65.       SpinCounter = 1
  66.     End If
  67.   
  68.     ' DisplayImage takes a row and column parameter
  69.     Select Case SpinCounter
  70.       Case 1
  71.         DisplayImage(1, 1)
  72.       Case 2
  73.         DisplayImage(1, 2)
  74.       Case 3
  75.         DisplayImage(1, 3)
  76.       Case 4
  77.         DisplayImage(1, 4)
  78.       Case 5
  79.         DisplayImage(1, 5)
  80.       Case 6
  81.         DisplayImage(1, 6)
  82.       Case 7
  83.         DisplayImage(2, 1)
  84.       Case 8
  85.         DisplayImage(2, 2)
  86.       Case 9
  87.         DisplayImage(2, 3)
  88.       Case 10
  89.         DisplayImage(2, 4)
  90.       Case 11
  91.         DisplayImage(2, 5)
  92.       Case 12
  93.         DisplayImage(2, 6)
  94.       Case 13
  95.         DisplayImage(3, 1)
  96.       Case 14
  97.         DisplayImage(3, 2)
  98.       Case 15
  99.         DisplayImage(3, 3)
  100.       Case 16
  101.         DisplayImage(3, 4)
  102.       Case 17
  103.         DisplayImage(3, 5)
  104.       Case 18
  105.         DisplayImage(3, 6)
  106.     End Select
  107.   
  108.     imgTop.Refresh
  109.   
  110.   End Sub
  111.  
  112.   Sub StartTop_Click()
  113.     ' Add a checkmark to the Stop entry
  114.     GameTopOptionMenu.CheckItem("StopTop", 0)
  115.     GameTopOptionMenu.CheckItem("StartTop", 1)
  116.   
  117.     TimerToggle = 1
  118.     TimerSpinTop.Enabled = "True"
  119.   End Sub
  120.  
  121.   Sub StopTop_Click()
  122.     ' Add a checkmark to the Stop entry
  123.     GameTopOptionMenu.CheckItem("StopTop", 1)
  124.     GameTopOptionMenu.CheckItem("StartTop", 0)
  125.   
  126.     TimerToggle = 0
  127.     TimerSpinTop.Enabled = "False"
  128.   End Sub
  129.  
  130.   Sub TimerSpinTop_Timeout()
  131.     ' If the spin button is on then spin the top
  132.     If TimerToggle = 1 Then SpinTop
  133.   End Sub
  134.  
  135. End Type
  136.  
  137. Type TimerSpinTop From Timer
  138.  
  139.   ' METHODS for object: TimerSpinTop
  140.   Sub Timeout()
  141.     App.AutoBusySignal = False
  142.     ' Call the method on the top form to increment the top display
  143.     GameTopMasterForm.TimerSpinTop_Timeout
  144.     App.AutoBusySignal = True
  145.   End Sub
  146.  
  147. End Type
  148.  
  149. Begin Code
  150. ' Reconstruction commands for object: GameTopMasterForm
  151. '
  152.   With GameTopMasterForm
  153.     .Caption := "Animation Demo"
  154.     .Move(6795, 1965, 3255, 2790)
  155.     .MenuBar := GameTopMasterForm.GameTopMenuBar
  156.     .SampleDir := "C:\ENVELOP\bootcamp\basic\gametop\"
  157.     .SampleName := "gametop"
  158.     .TimerToggle := 0
  159.     .SpinCounter := 1
  160.     With .GameTopOptionMenu
  161.  
  162.       .InsertItem("StartTop", "&Start", -1)
  163.       .InsertItem("StopTop", "St&op", -1)
  164.     End With  'GameTopMasterForm.GameTopOptionMenu
  165.     With .GameTopMenuBar
  166.  
  167.       .InsertPopup(SampleMasterFormFileMenu, "&File", -1)
  168.       .InsertPopup(GameTopMasterForm.GameTopOptionMenu, "&Options", -1)
  169.       .InsertPopup(SampleMasterFormHelpMenu, "&Help", -1)
  170.     End With  'GameTopMasterForm.GameTopMenuBar
  171.     With .imgTop
  172.       .Caption := "imgTop"
  173.       .ZOrder := 1
  174.       .Move(1050, 600, 990, 920)
  175.       .AutoInitCropRect := False
  176.       .Picture := GameTopMasterForm.bmpTop
  177.       .ScrollBars := "Never"
  178.       .CropXSize := 66
  179.       .CropYSize := 61
  180.     End With  'GameTopMasterForm.imgTop
  181.     With .bmpTop
  182.       .LoadType := "MemoryBased"
  183.       .FileName := "gametop.ero"
  184.       .ResId := 0
  185.     End With  'GameTopMasterForm.bmpTop
  186.     With .helpfile
  187.       .FileName := "C:\ENVELOP\bootcamp\basic\gametop\gametop.hlp"
  188.       .IsShowing := -1
  189.     End With  'GameTopMasterForm.helpfile
  190.   End With  'GameTopMasterForm
  191. ' Reconstruction commands for object: TimerSpinTop
  192. '
  193.   With TimerSpinTop
  194.     .Interval := 1
  195.   End With  'TimerSpinTop
  196. End Code
  197.