home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbboid / boittest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-15  |  41.4 KB  |  1,259 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "vbBoid : Example of emergent behaviour  
  4.  RL 1999"
  5.    ClientHeight    =   8130
  6.    ClientLeft      =   60
  7.    ClientTop       =   630
  8.    ClientWidth     =   11880
  9.    ForeColor       =   &H8000000F&
  10.    LinkTopic       =   "Form1"
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   8130
  13.    ScaleWidth      =   11880
  14.    StartUpPosition =   2  'CenterScreen
  15.    WindowState     =   2  'Maximized
  16.    Begin VB.Frame Frame4 
  17.       Height          =   8055
  18.       Left            =   0
  19.       TabIndex        =   69
  20.       Top             =   0
  21.       Width           =   1875
  22.       Begin VB.HScrollBar HScroll1 
  23.          Height          =   255
  24.          Index           =   3
  25.          Left            =   120
  26.          Max             =   50
  27.          TabIndex        =   96
  28.          Top             =   360
  29.          Value           =   30
  30.          Width           =   1575
  31.       End
  32.       Begin VB.CommandButton Command1 
  33.          Caption         =   "Clear"
  34.          Height          =   375
  35.          Left            =   960
  36.          TabIndex        =   95
  37.          Top             =   7080
  38.          Width           =   855
  39.       End
  40.       Begin VB.CheckBox chkEnclosed 
  41.          Caption         =   "Enclosed"
  42.          Height          =   375
  43.          Left            =   180
  44.          TabIndex        =   94
  45.          Top             =   6660
  46.          Width           =   1335
  47.       End
  48.       Begin VB.CommandButton cmdExit 
  49.          Caption         =   "Exit"
  50.          Height          =   375
  51.          Left            =   120
  52.          TabIndex        =   87
  53.          Top             =   7560
  54.          Width           =   795
  55.       End
  56.       Begin VB.CheckBox chkShowCentre 
  57.          Caption         =   "Show"
  58.          Height          =   255
  59.          Left            =   840
  60.          TabIndex        =   86
  61.          Top             =   720
  62.          Width           =   735
  63.       End
  64.       Begin VB.HScrollBar HScroll1 
  65.          Height          =   255
  66.          Index           =   0
  67.          Left            =   120
  68.          Max             =   10
  69.          TabIndex        =   85
  70.          Top             =   960
  71.          Value           =   3
  72.          Width           =   1575
  73.       End
  74.       Begin VB.HScrollBar HScroll1 
  75.          Height          =   255
  76.          Index           =   1
  77.          Left            =   120
  78.          Max             =   10
  79.          TabIndex        =   84
  80.          Top             =   1560
  81.          Value           =   4
  82.          Width           =   1575
  83.       End
  84.       Begin VB.HScrollBar HScroll1 
  85.          Height          =   255
  86.          Index           =   2
  87.          Left            =   120
  88.          Max             =   10
  89.          TabIndex        =   83
  90.          Top             =   2160
  91.          Value           =   6
  92.          Width           =   1575
  93.       End
  94.       Begin VB.TextBox Text6 
  95.          Height          =   285
  96.          Left            =   1200
  97.          TabIndex        =   82
  98.          Text            =   ".5"
  99.          Top             =   3060
  100.          Width           =   495
  101.       End
  102.       Begin VB.CommandButton cmdExecute 
  103.          Caption         =   "Execute"
  104.          Height          =   375
  105.          Left            =   60
  106.          TabIndex        =   81
  107.          Top             =   7080
  108.          Width           =   855
  109.       End
  110.       Begin VB.TextBox Text5 
  111.          Height          =   285
  112.          Left            =   1200
  113.          TabIndex        =   80
  114.          Text            =   "80"
  115.          Top             =   2580
  116.          Width           =   495
  117.       End
  118.       Begin VB.CheckBox chkGrid 
  119.          Caption         =   "Show Grid"
  120.          Height          =   255
  121.          Left            =   180
  122.          TabIndex        =   79
  123.          Top             =   5160
  124.          Width           =   1335
  125.       End
  126.       Begin VB.CheckBox chkTrails 
  127.          Caption         =   "Show Trails"
  128.          Height          =   255
  129.          Left            =   180
  130.          TabIndex        =   78
  131.          Top             =   4800
  132.          Width           =   1335
  133.       End
  134.       Begin VB.TextBox Text7 
  135.          Height          =   285
  136.          Left            =   1200
  137.          TabIndex        =   77
  138.          Text            =   "4"
  139.          Top             =   3540
  140.          Width           =   495
  141.       End
  142.       Begin VB.CheckBox chkShowSep 
  143.          Caption         =   "Show "
  144.          Height          =   255
  145.          Left            =   840
  146.          TabIndex        =   76
  147.          Top             =   1320
  148.          Width           =   735
  149.       End
  150.       Begin VB.CheckBox chkShowAlign 
  151.          Caption         =   "Show "
  152.          Height          =   255
  153.          Left            =   840
  154.          TabIndex        =   75
  155.          Top             =   1920
  156.          Width           =   855
  157.       End
  158.       Begin VB.CheckBox chkShowSensor 
  159.          Caption         =   "Show Vision"
  160.          Height          =   255
  161.          Left            =   180
  162.          TabIndex        =   74
  163.          Top             =   4440
  164.          Width           =   1335
  165.       End
  166.       Begin VB.CheckBox chkShowBox 
  167.          Caption         =   "Show Obstacle Box"
  168.          Height          =   375
  169.          Left            =   180
  170.          TabIndex        =   73
  171.          Top             =   5520
  172.          Width           =   1335
  173.       End
  174.       Begin VB.CheckBox chkShowColours 
  175.          Caption         =   "Show Colours"
  176.          Height          =   255
  177.          Left            =   180
  178.          TabIndex        =   72
  179.          Top             =   4080
  180.          Width           =   1335
  181.       End
  182.       Begin VB.CheckBox chkShowArrow 
  183.          Caption         =   "Show Arrow"
  184.          Height          =   375
  185.          Left            =   180
  186.          TabIndex        =   71
  187.          Top             =   5940
  188.          Width           =   1335
  189.       End
  190.       Begin VB.CheckBox chkShowCircle 
  191.          Caption         =   "Show Circle"
  192.          Height          =   375
  193.          Left            =   180
  194.          TabIndex        =   70
  195.          Top             =   6300
  196.          Width           =   1335
  197.       End
  198.       Begin VB.Label Label3 
  199.          Caption         =   "Boid Count"
  200.          Height          =   255
  201.          Index           =   6
  202.          Left            =   120
  203.          TabIndex        =   97
  204.          Top             =   120
  205.          Width           =   1695
  206.       End
  207.       Begin VB.Label Label3 
  208.          Caption         =   "Centre"
  209.          Height          =   255
  210.          Index           =   0
  211.          Left            =   120
  212.          TabIndex        =   93
  213.          Top             =   720
  214.          Width           =   735
  215.       End
  216.       Begin VB.Label Label3 
  217.          Caption         =   "Separate"
  218.          Height          =   255
  219.          Index           =   1
  220.          Left            =   120
  221.          TabIndex        =   92
  222.          Top             =   1320
  223.          Width           =   735
  224.       End
  225.       Begin VB.Label Label3 
  226.          Caption         =   "Align"
  227.          Height          =   255
  228.          Index           =   2
  229.          Left            =   120
  230.          TabIndex        =   91
  231.          Top             =   1920
  232.          Width           =   735
  233.       End
  234.       Begin VB.Label Label3 
  235.          Caption         =   "Sensor Range (Pix)"
  236.          Height          =   495
  237.          Index           =   3
  238.          Left            =   120
  239.          TabIndex        =   90
  240.          Top             =   2580
  241.          Width           =   975
  242.       End
  243.       Begin VB.Label Label3 
  244.          Caption         =   "Max Turn (Rad)"
  245.          Height          =   495
  246.          Index           =   4
  247.          Left            =   120
  248.          TabIndex        =   89
  249.          Top             =   3060
  250.          Width           =   735
  251.       End
  252.       Begin VB.Label Label3 
  253.          Caption         =   "Field of View (Rad)"
  254.          Height          =   495
  255.          Index           =   5
  256.          Left            =   120
  257.          TabIndex        =   88
  258.          Top             =   3540
  259.          Width           =   855
  260.       End
  261.    End
  262.    Begin VB.Frame Frame3 
  263.       Height          =   7215
  264.       Left            =   3840
  265.       TabIndex        =   1
  266.       Top             =   120
  267.       Visible         =   0   'False
  268.       Width           =   3375
  269.       Begin VB.CommandButton cmdSet 
  270.          Caption         =   "Set Boids"
  271.          Height          =   375
  272.          Left            =   1080
  273.          TabIndex        =   68
  274.          Top             =   6120
  275.          Width           =   1095
  276.       End
  277.       Begin VB.CommandButton cmdClear 
  278.          Caption         =   "Clear"
  279.          Height          =   375
  280.          Left            =   2160
  281.          TabIndex        =   67
  282.          Top             =   6120
  283.          Width           =   1095
  284.       End
  285.       Begin VB.CommandButton cmdCalcForces 
  286.          Caption         =   "Calc Forces"
  287.          Height          =   375
  288.          Left            =   0
  289.          TabIndex        =   66
  290.          Top             =   6480
  291.          Width           =   1095
  292.       End
  293.       Begin VB.CommandButton cmdDraw 
  294.          Caption         =   "Draw"
  295.          Height          =   375
  296.          Left            =   1080
  297.          TabIndex        =   65
  298.          Top             =   6480
  299.          Width           =   1095
  300.       End
  301.       Begin VB.CommandButton cmdMove 
  302.          Caption         =   "Move"
  303.          Height          =   375
  304.          Left            =   2160
  305.          TabIndex        =   64
  306.          Top             =   6480
  307.          Width           =   1095
  308.       End
  309.       Begin VB.CommandButton cmdRun 
  310.          Caption         =   "Run"
  311.          Height          =   375
  312.          Left            =   0
  313.          TabIndex        =   63
  314.          Top             =   6840
  315.          Width           =   1095
  316.       End
  317.       Begin VB.CommandButton cmdReset 
  318.          Caption         =   "Reset Boids"
  319.          Height          =   375
  320.          Left            =   0
  321.          TabIndex        =   62
  322.          Top             =   6120
  323.          Width           =   1095
  324.       End
  325.       Begin VB.Frame Frame1 
  326.          Height          =   6135
  327.          Index           =   3
  328.          Left            =   2520
  329.          TabIndex        =   49
  330.          Top             =   0
  331.          Width           =   675
  332.          Begin VB.TextBox Text4 
  333.             Height          =   375
  334.             Index           =   3
  335.             Left            =   120
  336.             TabIndex        =   61
  337.             Text            =   "10"
  338.             Top             =   1680
  339.             Width           =   500
  340.          End
  341.          Begin VB.TextBox Text4 
  342.             Height          =   375
  343.             Index           =   2
  344.             Left            =   120
  345.             TabIndex        =   60
  346.             Text            =   "2"
  347.             Top             =   1200
  348.             Width           =   500
  349.          End
  350.          Begin VB.TextBox Text4 
  351.             Height          =   375
  352.             Index           =   1
  353.             Left            =   120
  354.             TabIndex        =   59
  355.             Text            =   "132"
  356.             Top             =   720
  357.             Width           =   500
  358.          End
  359.          Begin VB.TextBox Text4 
  360.             Height          =   375
  361.             Index           =   0
  362.             Left            =   120
  363.             TabIndex        =   58
  364.             Text            =   "143"
  365.             Top             =   240
  366.             Width           =   500
  367.          End
  368.          Begin VB.TextBox Text4 
  369.             Height          =   375
  370.             Index           =   4
  371.             Left            =   120
  372.             TabIndex        =   57
  373.             Text            =   "10"
  374.             Top             =   2160
  375.             Width           =   500
  376.          End
  377.          Begin VB.TextBox Text4 
  378.             Height          =   375
  379.             Index           =   5
  380.             Left            =   120
  381.             TabIndex        =   56
  382.             Text            =   "10"
  383.             Top             =   2640
  384.             Width           =   500
  385.          End
  386.          Begin VB.TextBox Text4 
  387.             Height          =   375
  388.             Index           =   6
  389.             Left            =   120
  390.             TabIndex        =   55
  391.             Text            =   "10"
  392.             Top             =   3120
  393.             Width           =   500
  394.          End
  395.          Begin VB.TextBox Text4 
  396.             Height          =   375
  397.             Index           =   7
  398.             Left            =   120
  399.             TabIndex        =   54
  400.             Text            =   "10"
  401.             Top             =   3600
  402.             Width           =   500
  403.          End
  404.          Begin VB.TextBox Text4 
  405.             Height          =   375
  406.             Index           =   8
  407.             Left            =   120
  408.             TabIndex        =   53
  409.             Text            =   "10"
  410.             Top             =   4080
  411.             Width           =   500
  412.          End
  413.          Begin VB.TextBox Text4 
  414.             Height          =   375
  415.             Index           =   9
  416.             Left            =   120
  417.             TabIndex        =   52
  418.             Text            =   "10"
  419.             Top             =   4560
  420.             Width           =   500
  421.          End
  422.          Begin VB.TextBox Text4 
  423.             Height          =   375
  424.             Index           =   10
  425.             Left            =   120
  426.             TabIndex        =   51
  427.             Text            =   "10"
  428.             Top             =   5040
  429.             Width           =   500
  430.          End
  431.          Begin VB.TextBox Text4 
  432.             Height          =   375
  433.             Index           =   11
  434.             Left            =   120
  435.             TabIndex        =   50
  436.             Text            =   "10"
  437.             Top             =   5520
  438.             Width           =   500
  439.          End
  440.       End
  441.       Begin VB.Frame Frame1 
  442.          Height          =   6135
  443.          Index           =   2
  444.          Left            =   1920
  445.          TabIndex        =   36
  446.          Top             =   120
  447.          Width           =   675
  448.          Begin VB.TextBox Text3 
  449.             Height          =   375
  450.             Index           =   3
  451.             Left            =   120
  452.             TabIndex        =   48
  453.             Text            =   "10"
  454.             Top             =   1680
  455.             Width           =   500
  456.          End
  457.          Begin VB.TextBox Text3 
  458.             Height          =   375
  459.             Index           =   2
  460.             Left            =   120
  461.             TabIndex        =   47
  462.             Text            =   "3"
  463.             Top             =   1200
  464.             Width           =   500
  465.          End
  466.          Begin VB.TextBox Text3 
  467.             Height          =   375
  468.             Index           =   1
  469.             Left            =   120
  470.             TabIndex        =   46
  471.             Text            =   "110"
  472.             Top             =   720
  473.             Width           =   500
  474.          End
  475.          Begin VB.TextBox Text3 
  476.             Height          =   375
  477.             Index           =   0
  478.             Left            =   120
  479.             TabIndex        =   45
  480.             Text            =   "118"
  481.             Top             =   240
  482.             Width           =   500
  483.          End
  484.          Begin VB.TextBox Text3 
  485.             Height          =   375
  486.             Index           =   4
  487.             Left            =   120
  488.             TabIndex        =   44
  489.             Text            =   "10"
  490.             Top             =   2160
  491.             Width           =   500
  492.          End
  493.          Begin VB.TextBox Text3 
  494.             Height          =   375
  495.             Index           =   5
  496.             Left            =   120
  497.             TabIndex        =   43
  498.             Text            =   "10"
  499.             Top             =   2640
  500.             Width           =   500
  501.          End
  502.          Begin VB.TextBox Text3 
  503.             Height          =   375
  504.             Index           =   6
  505.             Left            =   120
  506.             TabIndex        =   42
  507.             Text            =   "10"
  508.             Top             =   3120
  509.             Width           =   500
  510.          End
  511.          Begin VB.TextBox Text3 
  512.             Height          =   375
  513.             Index           =   7
  514.             Left            =   120
  515.             TabIndex        =   41
  516.             Text            =   "10"
  517.             Top             =   3600
  518.             Width           =   500
  519.          End
  520.          Begin VB.TextBox Text3 
  521.             Height          =   375
  522.             Index           =   8
  523.             Left            =   120
  524.             TabIndex        =   40
  525.             Text            =   "10"
  526.             Top             =   4080
  527.             Width           =   500
  528.          End
  529.          Begin VB.TextBox Text3 
  530.             Height          =   375
  531.             Index           =   9
  532.             Left            =   120
  533.             TabIndex        =   39
  534.             Text            =   "10"
  535.             Top             =   4560
  536.             Width           =   500
  537.          End
  538.          Begin VB.TextBox Text3 
  539.             Height          =   375
  540.             Index           =   10
  541.             Left            =   120
  542.             TabIndex        =   38
  543.             Text            =   "10"
  544.             Top             =   5040
  545.             Width           =   500
  546.          End
  547.          Begin VB.TextBox Text3 
  548.             Height          =   375
  549.             Index           =   11
  550.             Left            =   120
  551.             TabIndex        =   37
  552.             Text            =   "10"
  553.             Top             =   5520
  554.             Width           =   500
  555.          End
  556.       End
  557.       Begin VB.Frame Frame1 
  558.          Height          =   6135
  559.          Index           =   1
  560.          Left            =   1320
  561.          TabIndex        =   23
  562.          Top             =   120
  563.          Width           =   675
  564.          Begin VB.TextBox Text2 
  565.             Height          =   375
  566.             Index           =   3
  567.             Left            =   120
  568.             TabIndex        =   35
  569.             Text            =   "10"
  570.             Top             =   1680
  571.             Width           =   500
  572.          End
  573.          Begin VB.TextBox Text2 
  574.             Height          =   375
  575.             Index           =   2
  576.             Left            =   120
  577.             TabIndex        =   34
  578.             Text            =   "1"
  579.             Top             =   1200
  580.             Width           =   500
  581.          End
  582.          Begin VB.TextBox Text2 
  583.             Height          =   375
  584.             Index           =   1
  585.             Left            =   120
  586.             TabIndex        =   33
  587.             Text            =   "102"
  588.             Top             =   720
  589.             Width           =   500
  590.          End
  591.          Begin VB.TextBox Text2 
  592.             Height          =   375
  593.             Index           =   0
  594.             Left            =   120
  595.             TabIndex        =   32
  596.             Text            =   "153"
  597.             Top             =   240
  598.             Width           =   500
  599.          End
  600.          Begin VB.TextBox Text2 
  601.             Height          =   375
  602.             Index           =   4
  603.             Left            =   120
  604.             TabIndex        =   31
  605.             Text            =   "10"
  606.             Top             =   2160
  607.             Width           =   500
  608.          End
  609.          Begin VB.TextBox Text2 
  610.             Height          =   375
  611.             Index           =   5
  612.             Left            =   120
  613.             TabIndex        =   30
  614.             Text            =   "10"
  615.             Top             =   2640
  616.             Width           =   500
  617.          End
  618.          Begin VB.TextBox Text2 
  619.             Height          =   375
  620.             Index           =   6
  621.             Left            =   120
  622.             TabIndex        =   29
  623.             Text            =   "10"
  624.             Top             =   3120
  625.             Width           =   500
  626.          End
  627.          Begin VB.TextBox Text2 
  628.             Height          =   375
  629.             Index           =   7
  630.             Left            =   120
  631.             TabIndex        =   28
  632.             Text            =   "10"
  633.             Top             =   3600
  634.             Width           =   500
  635.          End
  636.          Begin VB.TextBox Text2 
  637.             Height          =   375
  638.             Index           =   8
  639.             Left            =   120
  640.             TabIndex        =   27
  641.             Text            =   "10"
  642.             Top             =   4080
  643.             Width           =   500
  644.          End
  645.          Begin VB.TextBox Text2 
  646.             Height          =   375
  647.             Index           =   9
  648.             Left            =   120
  649.             TabIndex        =   26
  650.             Text            =   "10"
  651.             Top             =   4560
  652.             Width           =   500
  653.          End
  654.          Begin VB.TextBox Text2 
  655.             Height          =   375
  656.             Index           =   10
  657.             Left            =   120
  658.             TabIndex        =   25
  659.             Text            =   "10"
  660.             Top             =   5040
  661.             Width           =   500
  662.          End
  663.          Begin VB.TextBox Text2 
  664.             Height          =   375
  665.             Index           =   11
  666.             Left            =   120
  667.             TabIndex        =   24
  668.             Text            =   "10"
  669.             Top             =   5520
  670.             Width           =   500
  671.          End
  672.       End
  673.       Begin VB.Frame Frame1 
  674.          Height          =   6135
  675.          Index           =   0
  676.          Left            =   720
  677.          TabIndex        =   10
  678.          Top             =   0
  679.          Width           =   675
  680.          Begin VB.TextBox Text1 
  681.             Height          =   375
  682.             Index           =   0
  683.             Left            =   120
  684.             TabIndex        =   22
  685.             Text            =   "120"
  686.             Top             =   240
  687.             Width           =   500
  688.          End
  689.          Begin VB.TextBox Text1 
  690.             Height          =   375
  691.             Index           =   1
  692.             Left            =   120
  693.             TabIndex        =   21
  694.             Text            =   "160"
  695.             Top             =   720
  696.             Width           =   500
  697.          End
  698.          Begin VB.TextBox Text1 
  699.             Height          =   375
  700.             Index           =   2
  701.             Left            =   120
  702.             TabIndex        =   20
  703.             Text            =   "0"
  704.             Top             =   1200
  705.             Width           =   500
  706.          End
  707.          Begin VB.TextBox Text1 
  708.             Height          =   375
  709.             Index           =   3
  710.             Left            =   120
  711.             TabIndex        =   19
  712.             Text            =   "10"
  713.             Top             =   1680
  714.             Width           =   500
  715.          End
  716.          Begin VB.TextBox Text1 
  717.             Height          =   375
  718.             Index           =   4
  719.             Left            =   120
  720.             TabIndex        =   18
  721.             Text            =   "10"
  722.             Top             =   2160
  723.             Width           =   500
  724.          End
  725.          Begin VB.TextBox Text1 
  726.             Height          =   375
  727.             Index           =   5
  728.             Left            =   120
  729.             TabIndex        =   17
  730.             Text            =   "10"
  731.             Top             =   2640
  732.             Width           =   500
  733.          End
  734.          Begin VB.TextBox Text1 
  735.             Height          =   375
  736.             Index           =   6
  737.             Left            =   120
  738.             TabIndex        =   16
  739.             Text            =   "10"
  740.             Top             =   3120
  741.             Width           =   500
  742.          End
  743.          Begin VB.TextBox Text1 
  744.             Height          =   375
  745.             Index           =   7
  746.             Left            =   120
  747.             TabIndex        =   15
  748.             Text            =   "10"
  749.             Top             =   3600
  750.             Width           =   500
  751.          End
  752.          Begin VB.TextBox Text1 
  753.             Height          =   375
  754.             Index           =   8
  755.             Left            =   120
  756.             TabIndex        =   14
  757.             Text            =   "10"
  758.             Top             =   4080
  759.             Width           =   500
  760.          End
  761.          Begin VB.TextBox Text1 
  762.             Height          =   375
  763.             Index           =   9
  764.             Left            =   120
  765.             TabIndex        =   13
  766.             Text            =   "10"
  767.             Top             =   4560
  768.             Width           =   500
  769.          End
  770.          Begin VB.TextBox Text1 
  771.             Height          =   375
  772.             Index           =   10
  773.             Left            =   120
  774.             TabIndex        =   12
  775.             Text            =   "10"
  776.             Top             =   5040
  777.             Width           =   500
  778.          End
  779.          Begin VB.TextBox Text1 
  780.             Height          =   375
  781.             Index           =   11
  782.             Left            =   120
  783.             TabIndex        =   11
  784.             Text            =   "10"
  785.             Top             =   5520
  786.             Width           =   500
  787.          End
  788.       End
  789.       Begin VB.Frame Frame2 
  790.          Height          =   6135
  791.          Left            =   0
  792.          TabIndex        =   2
  793.          Top             =   0
  794.          Visible         =   0   'False
  795.          Width           =   735
  796.          Begin VB.Label Label1 
  797.             Alignment       =   1  'Right Justify
  798.             Caption         =   "X"
  799.             Height          =   195
  800.             Index           =   0
  801.             Left            =   120
  802.             TabIndex        =   9
  803.             Top             =   360
  804.             Width           =   600
  805.          End
  806.          Begin VB.Label Label1 
  807.             Alignment       =   1  'Right Justify
  808.             Caption         =   "Y"
  809.             Height          =   195
  810.             Index           =   1
  811.             Left            =   100
  812.             TabIndex        =   8
  813.             Top             =   840
  814.             Width           =   600
  815.          End
  816.          Begin VB.Label Label1 
  817.             Alignment       =   1  'Right Justify
  818.             Caption         =   "DIR"
  819.             Height          =   195
  820.             Index           =   2
  821.             Left            =   100
  822.             TabIndex        =   7
  823.             Top             =   1320
  824.             Width           =   600
  825.          End
  826.          Begin VB.Label Label1 
  827.             Alignment       =   1  'Right Justify
  828.             Caption         =   "Len"
  829.             Height          =   195
  830.             Index           =   3
  831.             Left            =   100
  832.             TabIndex        =   6
  833.             Top             =   1800
  834.             Width           =   600
  835.          End
  836.          Begin VB.Label label2 
  837.             Alignment       =   1  'Right Justify
  838.             Caption         =   "Align"
  839.             ForeColor       =   &H00FF00FF&
  840.             Height          =   195
  841.             Index           =   1
  842.             Left            =   100
  843.             TabIndex        =   5
  844.             Top             =   2400
  845.             Width           =   600
  846.          End
  847.          Begin VB.Label label2 
  848.             Alignment       =   1  'Right Justify
  849.             Caption         =   "Centre"
  850.             ForeColor       =   &H0000FF00&
  851.             Height          =   195
  852.             Index           =   0
  853.             Left            =   100
  854.             TabIndex        =   4
  855.             Top             =   3360
  856.             Width           =   600
  857.          End
  858.          Begin VB.Label label2 
  859.             Alignment       =   1  'Right Justify
  860.             Caption         =   "Sep"
  861.             ForeColor       =   &H0000FFFF&
  862.             Height          =   195
  863.             Index           =   2
  864.             Left            =   100
  865.             TabIndex        =   3
  866.             Top             =   4440
  867.             Width           =   600
  868.          End
  869.       End
  870.    End
  871.    Begin VB.PictureBox Picture1 
  872.       AutoRedraw      =   -1  'True
  873.       AutoSize        =   -1  'True
  874.       BackColor       =   &H8000000E&
  875.       Height          =   7575
  876.       Left            =   1860
  877.       ScaleHeight     =   501
  878.       ScaleMode       =   3  'Pixel
  879.       ScaleWidth      =   593
  880.       TabIndex        =   0
  881.       Top             =   120
  882.       Width           =   8955
  883.    End
  884.    Begin VB.Menu mnuFile 
  885.       Caption         =   "&File"
  886.       Begin VB.Menu mnuExit 
  887.          Caption         =   "E&xit"
  888.       End
  889.    End
  890.    Begin VB.Menu mnuHelp 
  891.       Caption         =   "&Help"
  892.       Begin VB.Menu mnuInfo 
  893.          Caption         =   "&Infro"
  894.       End
  895.       Begin VB.Menu mnuAbout 
  896.          Caption         =   "&About"
  897.       End
  898.    End
  899. Attribute VB_Name = "Form1"
  900. Attribute VB_GlobalNameSpace = False
  901. Attribute VB_Creatable = False
  902. Attribute VB_PredeclaredId = True
  903. Attribute VB_Exposed = False
  904. Option Explicit
  905. Private Declare Function VarPtrArray Lib "msvbvm50.dll" Alias "VarPtr" (Ptr() As Any) As Long
  906. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
  907. Private Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
  908. Private Declare Function GetTickCount Lib "kernel32" () As Long
  909. Private Type SAFEARRAYBOUND
  910.     cElements As Long
  911.     lLbound As Long
  912. End Type
  913. Private Type SAFEARRAY1D
  914.     cDims As Integer
  915.     fFeatures As Integer
  916.     cbElements As Long
  917.     cLocks As Long
  918.     pvData As Long
  919.     Bounds(0 To 0) As SAFEARRAYBOUND
  920. End Type
  921. Private Type SAFEARRAY2D
  922.     cDims As Integer
  923.     fFeatures As Integer
  924.     cbElements As Long
  925.     cLocks As Long
  926.     pvData As Long
  927.     Bounds(0 To 1) As SAFEARRAYBOUND
  928. End Type
  929. Private Type BITMAP
  930.     bmType As Long
  931.     bmWidth As Long
  932.     bmHeight As Long
  933.     bmWidthBytes As Long
  934.     bmPlanes As Integer
  935.     bmBitsPixel As Integer
  936.     bmBits As Long
  937. End Type
  938. Private Type point
  939.     r As Byte
  940.     c As Byte
  941. End Type
  942. Dim dwn%
  943. Dim bkg(255, 255) As Byte
  944. Dim blnRun As Boolean
  945. Dim iXval As Integer
  946. Dim iYval As Integer
  947. Private Sub cmdCalcForces_Click()
  948. Dim boid As BoidClass
  949.     CalcForces flock, HScroll1(0), HScroll1(1), HScroll1(2), Val(Text5), Val(Text7)
  950.     For Each boid In flock
  951.         Select Case boid.id
  952.         Case 0
  953.             Text1(4) = boid.DesireAlignTurn
  954.             Text1(5) = boid.DesireAlignWeight
  955.             Text1(6) = boid.DesireCentreTurn
  956.             Text1(7) = boid.DesireCentreWeight
  957.             Text1(8) = boid.DesireSeparateTurn
  958.             Text1(9) = boid.DesireSeparateWeight
  959.             Text1(10) = boid.AveX
  960.             Text1(11) = boid.AveY
  961.         Case 1
  962.             Text2(4) = boid.DesireAlignTurn
  963.             Text2(5) = boid.DesireAlignWeight
  964.             Text2(6) = boid.DesireCentreTurn
  965.             Text2(7) = boid.DesireCentreWeight
  966.             Text2(8) = boid.DesireSeparateTurn
  967.             Text2(9) = boid.DesireSeparateWeight
  968.             Text2(10) = boid.AveX
  969.             Text2(11) = boid.AveY
  970.         Case 2
  971.             Text3(4) = boid.DesireAlignTurn
  972.             Text3(5) = boid.DesireAlignWeight
  973.             Text3(6) = boid.DesireCentreTurn
  974.             Text3(7) = boid.DesireCentreWeight
  975.             Text3(8) = boid.DesireSeparateTurn
  976.             Text3(9) = boid.DesireSeparateWeight
  977.             Text3(10) = boid.AveX
  978.             Text3(11) = boid.AveY
  979.         Case 3
  980.             Text4(4) = boid.DesireAlignTurn
  981.             Text4(5) = boid.DesireAlignWeight
  982.             Text4(6) = boid.DesireCentreTurn
  983.             Text4(7) = boid.DesireCentreWeight
  984.             Text4(8) = boid.DesireSeparateTurn
  985.             Text4(9) = boid.DesireSeparateWeight
  986.             Text4(10) = boid.AveX
  987.             Text4(11) = boid.AveY
  988.         End Select
  989.         
  990.     Next
  991.     Set boid = Nothing
  992. End Sub
  993. Private Sub cmdClear_Click()
  994.     Picture1.Cls
  995. End Sub
  996. Private Sub cmdDraw_Click()
  997. Dim i%, j%
  998.     For i% = 0 To Picture1.ScaleWidth Step 10
  999.         Picture1.Line (i%, 0)-(i%, Picture1.ScaleHeight), vbButtonFace
  1000.     Next
  1001.     For i% = 0 To Picture1.ScaleHeight Step 10
  1002.         Picture1.Line (0, i%)-(Picture1.ScaleWidth, i%), vbButtonFace
  1003.     Next
  1004.     DrawBoid flock, Form1.Picture1, Me.chkShowColours, Me.chkShowArrow, Me.chkShowCircle
  1005.     DrawObjects objects, Form1.Picture1
  1006.     DrawForces flock, Form1.Picture1, Val(Text5), Val(Text7), Me.chkShowCentre, Me.chkShowSep, Me.chkShowAlign, Me.chkShowSensor, Me.chkShowBox
  1007. End Sub
  1008. Private Sub cmdExecute_Click()
  1009. Dim i%, j%
  1010. Dim boid As BoidClass
  1011. Select Case cmdExecute.Caption
  1012. Case "Execute"
  1013.     cmdExecute.Caption = "Stop"
  1014.     blnRun = True
  1015.     Do
  1016.         CalcForces flock, HScroll1(0), HScroll1(1), HScroll1(2), Val(Text5), Val(Text7)
  1017.         If Me.chkTrails = False Then
  1018.             Picture1.Cls
  1019.         End If
  1020.         
  1021.         If Me.chkGrid <> False Then
  1022.             For i% = 0 To Picture1.ScaleWidth Step 10
  1023.                 Picture1.Line (i%, 0)-(i%, Picture1.ScaleHeight), vbButtonFace
  1024.             Next
  1025.             For i% = 0 To Picture1.ScaleHeight Step 10
  1026.                 Picture1.Line (0, i%)-(Picture1.ScaleWidth, i%), vbButtonFace
  1027.             Next
  1028.         End If
  1029.         
  1030.         DrawBoid flock, Form1.Picture1, Me.chkShowColours, Me.chkShowArrow, Me.chkShowCircle
  1031.         DrawObjects objects, Form1.Picture1
  1032.         
  1033.         DrawForces flock, Form1.Picture1, Val(Text5), Val(Text7), Me.chkShowCentre, Me.chkShowSep, Me.chkShowAlign, Me.chkShowSensor, Me.chkShowBox
  1034.         DoEvents
  1035.         
  1036.         MoveBoid flock, Val(Text6), Picture1.ScaleHeight, Picture1.ScaleWidth, Val(Text5), Me.chkEnclosed
  1037.         
  1038.     Loop While blnRun = True
  1039. Case "Stop"
  1040.     cmdExecute.Caption = "Execute"
  1041.     blnRun = False
  1042. End Select
  1043.  End Sub
  1044. Private Sub cmdExit_Click()
  1045.     Unload Me
  1046. End Sub
  1047. Private Sub cmdMove_Click()
  1048.     MoveBoid flock, Val(Text6), Picture1.ScaleHeight, Picture1.ScaleWidth, Val(Text5), Me.chkEnclosed
  1049. End Sub
  1050. Private Sub cmdReset_Click()
  1051. Dim boid As BoidClass
  1052.     For Each boid In flock
  1053.         Select Case boid.id
  1054.         Case 0
  1055.             Text1(0) = 100
  1056.             Text1(1) = 150
  1057.             Text1(2) = 0
  1058.         Case 1
  1059.             Text2(0) = 100
  1060.             Text2(1) = 160
  1061.             Text2(2) = 0
  1062.         Case 2
  1063.             Text3(0) = 400
  1064.             Text3(1) = 430
  1065.             Text3(2) = 2
  1066.         Case 3
  1067.             Text4(0) = 400
  1068.             Text4(1) = 440
  1069.             Text4(2) = 2
  1070.         End Select
  1071.         
  1072.     Next
  1073.     Set boid = Nothing
  1074. End Sub
  1075. Private Sub cmdRun_Click()
  1076.     Picture1.Cls
  1077. Dim boid As BoidClass
  1078.     CalcForces flock, HScroll1(0), HScroll1(1), HScroll1(2), Val(Text5), Val(Text7)
  1079.     For Each boid In flock
  1080.         Select Case boid.id
  1081.             Case 0
  1082.                 Text1(0) = boid.X
  1083.                 Text1(1) = boid.Y
  1084.                 Text1(2) = boid.direction
  1085.                 Text1(3) = boid.ClosestDist
  1086.                 
  1087.                 Text1(4) = boid.DesireAlignTurn
  1088.                 Text1(5) = boid.DesireAlignWeight
  1089.                 Text1(6) = boid.DesireCentreTurn
  1090.                 Text1(7) = boid.DesireCentreWeight
  1091.                 Text1(8) = boid.DesireSeparateTurn
  1092.                 Text1(9) = boid.DesireSeparateWeight
  1093.                 Text1(10) = boid.AveX
  1094.                 Text1(11) = boid.AveY
  1095.             Case 1
  1096.                 Text2(0) = boid.X
  1097.                 Text2(1) = boid.Y
  1098.                 Text2(2) = boid.direction
  1099.                 Text2(3) = boid.ClosestDist
  1100.                 
  1101.                 Text2(4) = boid.DesireAlignTurn
  1102.                 Text2(5) = boid.DesireAlignWeight
  1103.                 Text2(6) = boid.DesireCentreTurn
  1104.                 Text2(7) = boid.DesireCentreWeight
  1105.                 Text2(8) = boid.DesireSeparateTurn
  1106.                 Text2(9) = boid.DesireSeparateWeight
  1107.                 Text2(10) = boid.AveX
  1108.                 Text2(11) = boid.AveY
  1109.             Case 2
  1110.                 Text3(0) = boid.X
  1111.                 Text3(1) = boid.Y
  1112.                 Text3(2) = boid.direction
  1113.                 Text3(3) = boid.ClosestDist
  1114.                 Text3(3) = boid.AveSpeed
  1115.                 Text3(4) = boid.DesireAlignTurn
  1116.                 Text3(5) = boid.DesireAlignWeight
  1117.                 Text3(6) = boid.DesireCentreTurn
  1118.                 Text3(7) = boid.DesireCentreWeight
  1119.                 Text3(8) = boid.DesireSeparateTurn
  1120.                 Text3(9) = boid.DesireSeparateWeight
  1121.                 Text3(10) = boid.AveX
  1122.                 Text3(11) = boid.AveY
  1123.             Case 3
  1124.                 Text4(0) = boid.X
  1125.                 Text4(1) = boid.Y
  1126.                 Text4(2) = boid.direction
  1127.                 Text4(3) = boid.ClosestDist
  1128.                 Text4(3) = boid.AveSpeed
  1129.                 Text4(4) = boid.DesireAlignTurn
  1130.                 Text4(5) = boid.DesireAlignWeight
  1131.                 Text4(6) = boid.DesireCentreTurn
  1132.                 Text4(7) = boid.DesireCentreWeight
  1133.                 Text4(8) = boid.DesireSeparateTurn
  1134.                 Text4(9) = boid.DesireSeparateWeight
  1135.                 Text4(10) = boid.AveX
  1136.                 Text4(11) = boid.AveY
  1137.         End Select
  1138.         
  1139.     Next
  1140.     Set boid = Nothing
  1141. Dim i%, j%
  1142.     For i% = 0 To Picture1.ScaleWidth Step 10
  1143.         Picture1.Line (i%, 0)-(i%, Picture1.ScaleHeight), vbButtonFace
  1144.     Next
  1145.     For i% = 0 To Picture1.ScaleHeight Step 10
  1146.         Picture1.Line (0, i%)-(Picture1.ScaleWidth, i%), vbButtonFace
  1147.     Next
  1148.     DrawBoid flock, Form1.Picture1, Me.chkShowColours, Me.chkShowArrow, Me.chkShowCircle
  1149.     DrawObjects objects, Form1.Picture1
  1150.     DrawForces flock, Form1.Picture1, Val(Text5), Val(Text7), Me.chkShowCentre, Me.chkShowSep, Me.chkShowAlign, Me.chkShowSensor, Me.chkShowBox
  1151.     MoveBoid flock, Val(Text6), Picture1.ScaleHeight, Picture1.ScaleWidth, Val(Text5), Me.chkEnclosed
  1152. End Sub
  1153. Private Sub cmdSet_Click()
  1154. Dim i%
  1155. Dim H As Integer
  1156. Dim Theta As Double
  1157. Dim X As Integer
  1158. Dim Y As Integer
  1159. Dim NewX As Integer
  1160. Dim NewY As Integer
  1161.     Do While flock.Count > 0
  1162.         flock.Remove 1
  1163.     Loop
  1164. 'Boid0
  1165.     X = Val(Text1(0))
  1166.     Y = Val(Text1(1))
  1167.     Theta = Val(Text1(2))
  1168.     H = Val(Text1(3))
  1169.     AddBoid flock, X, Y, Theta, vbBlue
  1170.     Sin (1)
  1171. 'Boid1
  1172.     X = Val(Text2(0))
  1173.     Y = Val(Text2(1))
  1174.     Theta = Val(Text2(2))
  1175.     H = Val(Text2(3))
  1176.     AddBoid flock, X, Y, Theta, vbBlack
  1177. 'Boid2
  1178.     X = Val(Text3(0))
  1179.     Y = Val(Text3(1))
  1180.     Theta = Val(Text3(2))
  1181.     H = Val(Text3(3))
  1182.     AddBoid flock, X, Y, Theta, vbBlack
  1183. 'Boid2
  1184.     X = Val(Text4(0))
  1185.     Y = Val(Text4(1))
  1186.     Theta = Val(Text4(2))
  1187.     H = Val(Text4(3))
  1188.     AddBoid flock, X, Y, Theta, vbBlack
  1189.         
  1190. End Sub
  1191. Private Sub Command1_Click()
  1192.     Do While objects.Count > 0
  1193.         objects.Remove 1
  1194.     Loop
  1195. End Sub
  1196. Private Sub Form_Load()
  1197. Dim i%
  1198.     Randomize
  1199.     Label3(6) = "Boid Connt : " & HScroll1(3).Value
  1200.     For i% = 0 To Val(Mid$(Label3(6), 13))
  1201.         AddBoid flock, Int(Rnd(1) * 500), Int(Rnd(1) * 500), Rnd(1) * 6, vbBlack
  1202.     Next
  1203. '    For i% = 0 To 4
  1204. '        AddObstacle objects, Int(Rnd(1) * 300) + 100, Int(Rnd(1) * 300) + 100, 25
  1205. '    Next
  1206.     AddStartupObs
  1207. End Sub
  1208. Sub AddStartupObs()
  1209.         
  1210.     Do While objects.Count > 0
  1211.         objects.Remove 1
  1212.     Loop
  1213.         
  1214.         Picture1.Cls
  1215.         AddObstacle objects, Picture1.ScaleWidth / 2, Picture1.ScaleHeight / 2, 20
  1216.         AddObstacle objects, (Picture1.ScaleWidth / 2) + 100, Picture1.ScaleHeight / 2, 20
  1217.         AddObstacle objects, Picture1.ScaleWidth / 2, (Picture1.ScaleHeight / 2) + 100, 20
  1218.         AddObstacle objects, (Picture1.ScaleWidth / 2) - 100, Picture1.ScaleHeight / 2, 20
  1219.         AddObstacle objects, Picture1.ScaleWidth / 2, (Picture1.ScaleHeight / 2) - 100, 20
  1220.         
  1221.         AddObstacle objects, 0, 0, 50
  1222.         AddObstacle objects, Picture1.ScaleWidth, 0, 50
  1223.         AddObstacle objects, 0, Picture1.ScaleHeight, 50
  1224.         AddObstacle objects, Picture1.ScaleWidth, Picture1.ScaleHeight, 50
  1225. End Sub
  1226. Private Sub Form_Resize()
  1227.     Picture1.Width = Me.Width - Frame4.Width - 200
  1228.     Picture1.Height = Me.Height - 900
  1229.     AddStartupObs
  1230. End Sub
  1231. Private Sub Form_Unload(Cancel As Integer)
  1232.     If cmdExecute.Caption = "Stop" Then
  1233.         cmdExecute.Value = True
  1234.     End If
  1235.     End
  1236. End Sub
  1237. Private Sub HScroll1_Change(Index As Integer)
  1238.     Select Case Index
  1239.     Case 3
  1240.         Label3(6) = "Boid Connt : " & HScroll1(3).Value
  1241.         Do While flock.Count > Val(Mid$(Label3(6), 13))
  1242.             flock.Remove 1
  1243.         Loop
  1244.         Do While flock.Count < Val(Mid$(Label3(6), 13))
  1245.             AddBoid flock, Int(Rnd(1) * 500), Int(Rnd(1) * 500), Rnd(1) * 6, vbBlack
  1246.         Loop
  1247.        
  1248.     End Select
  1249. End Sub
  1250. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1251. '    iXval = X
  1252. '    iYval = Y
  1253. End Sub
  1254. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1255.     iXval = X
  1256.     iYval = Y
  1257.     AddObstacle objects, iXval, iYval, 25
  1258. End Sub
  1259.