home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / sourcecode / general / 3d_box.amos / 3d_box.amosSourceCode
Encoding:
AMOS Source Code  |  1993-01-06  |  1.8 KB  |  90 lines

  1. '
  2. ' SETUP SCREEN 
  3. '
  4. Screen Open 0,640,200,8,Hires
  5. Flash Off 
  6. Curs Off 
  7. Cls 0
  8. Palette $AA,$FFF,$DDD,$333,$888,$F00,$FF0,$4A4
  9. '
  10. ' *** Example Buttons.   
  11. '
  12. B[10,10,210,100,"STICKING OUT",1,7,1]
  13. '
  14. B[429,10,629,100,"STICKING IN",0,5,6]
  15. '
  16. B[210,110,429,190,"",0,0,0]
  17. B[211,111,428,189,"FANCY",1,4,5]
  18. '
  19. Direct 
  20. '
  21. Procedure B[X1,Y1,X2,Y2,A$,IN,_BUTTON_COLOUR,_TEXT_COLOUR]
  22.    '
  23.    '
  24.    ' *** X1, Y1 To X2, Y2  :  These are the button coordinates. 
  25.    '
  26.    ' ***               A$  :  This is the text inside the button (If any).
  27.    '
  28.    ' ***               IN  :  Position of button, 1 if sticking out, 0 if in. 
  29.    '
  30.    ' ***   _BUTTON_COLOUR  :  Colour of button. 
  31.    '  
  32.    ' ***     _TEXT_COLOUR  :  Colour of writing inside button.
  33.    '
  34.    '
  35.    ' *** Check if button is sticking in or out. 
  36.    '
  37.    If IN=1
  38.       C1=2
  39.       C2=3
  40.    Else 
  41.       C1=3
  42.       C2=2
  43.    End If 
  44.    '
  45.    ' *** Draw button. 
  46.    '
  47.    Ink _BUTTON_COLOUR
  48.    '
  49.    Bar X1,Y1 To X2,Y2
  50.    Ink C1
  51.    Box X1,Y1 To X2,Y2
  52.    Ink C2
  53.    Polyline X1,Y2 To X2,Y2 To X2,Y1
  54.    '
  55.    ' *** If button sticking out, put light in corner. 
  56.    '
  57.    If IN=1
  58.       Plot X1+1,Y1+1,1
  59.    End If 
  60.    '
  61.    ' *** If text has been entered, draw it inside button.     
  62.    '
  63.    If A$<>""
  64.       '
  65.       ' *** Centre text inside button. 
  66.       '  
  67.       WID=Text Length(A$)
  68.       X7=(((X2-X1)/2)+X1)-(WID/2)
  69.       '
  70.       Gr Writing 0
  71.       '  
  72.       ' *** Draw outline text. 
  73.       '
  74.       Ink 3,_BUTTON_COLOUR
  75.       '
  76.       Text X7+1,((Y2-Y1)/2)+Y1+3,A$
  77.       Text X7-1,((Y2-Y1)/2)+Y1+3,A$
  78.       Text X7,((Y2-Y1)/2)+Y1+4,A$
  79.       Text X7,((Y2-Y1)/2)+Y1+2,A$
  80.       '
  81.       ' *** Draw normal text on top of outlined. 
  82.       '
  83.       Ink _TEXT_COLOUR,_BUTTON_COLOUR
  84.       '
  85.       Text X7,((Y2-Y1)/2)+Y1+3,A$
  86.       '
  87.       Gr Writing 1
  88.       '
  89.    End If 
  90. End Proc