home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / 2d / exam08.dba < prev   
Encoding:
Text File  |  2000-04-09  |  1.3 KB  |  63 lines

  1. Rem * Title  : Using RGB values
  2. Rem * Author : DBS-MB
  3. Rem * Date   : 1st August 99
  4. rem ==========================================
  5. rem DARK BASIC EXAMPLE PROGRAM 8
  6. rem ==========================================
  7. rem This program will use a rgb command
  8. rem ------------------------------------------
  9.  
  10. rem Set the ink to white and paper color to black 
  11. ink rgb(244,214,210),0
  12.  
  13. rem The rgb command allows you to make any color you whant
  14. rem the maximum value you casn use is 255
  15. rem the color is split up into red green blue parts
  16. for t=0 to 100
  17.  
  18.     rem Get a random ink color
  19.  
  20.     rem the red part of the color
  21.     myred=rnd(255)
  22.  
  23.     rem the green part of the color
  24.     mygreen=rnd(255)
  25.  
  26.     rem the blue part of the color
  27.     myblue=rnd(255)
  28.  
  29.     ink rgb(myred,mygreen,myblue),1
  30.     
  31.     rem where on screen to draw a box
  32.  
  33.     rem Start of box
  34.     left=rnd(640)
  35.     top=rnd(480)
  36.  
  37.     rem End of box 
  38.     right=left+50
  39.     bottom=top+50
  40.  
  41.     rem Draw a box
  42.     box left,top,right,bottom
  43.  
  44. next t
  45.  
  46. rem Determine color of top/left pixel
  47. colorvalue=point(0,0)
  48. red=rgbr(colorvalue)
  49. green=rgbg(colorvalue)
  50. blue=rgbb(colorvalue)
  51.  
  52. rem Set the ink to white and paper color to black 
  53. ink rgb(244,214,210),rgb(red,green,blue)
  54.  
  55. rem Print a message on screen
  56. text 200,240,"press the spacebar to quit"
  57.  
  58. rem Will wait for you to press any key
  59. suspend for key
  60.  
  61. rem End the program
  62. end
  63.