UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: geecee on April 18, 2009, 04:12:36 AM

Title: Screen Havoc
Post by: geecee on April 18, 2009, 04:12:36 AM
Hi there!

Here's a little programme that plays havoc with your screen.

[pbcode]
; PROJECT : Screen Havoc
; AUTHOR  : geecee
; CREATED : 18/04/2009
; EDITED  : 18/04/2009
; ---------------------------------------------------------------------
rem Open an 800x by 600y screen in 16bit mode (windowed)
OpenScreen 800,600,16,1

rem This command will hide the mouse pointer
mouse off

rem Programme main loop
do
 c=rnd(255)
 ink rgb(c,c,c)
 y=rnd(600)
 line 0,y,800,y
   for i=1 to 500
     dot rnd(800),rnd(600)
   next i
   ink rgb(rnd(255),rnd(255),rnd(255))
   for i=1 to 50
     dot rnd(800),rnd(600)
   next i
 x=rnd(800)
 y=rnd(600)
 ink rgb(0,0,0)
 box x,y,x+20,y+1,1
 sync
 loop

end
[/pbcode]

:D
Enjoy
geecee
Title: Re: Screen Havoc
Post by: kevin on April 18, 2009, 04:25:06 PM
  A little tip,  if you're going to plot lots dots to video memory (ie the screen)  then don't forget to enable Manual buffer locking

 see -> Locking / Unlocking Buffers - Where and When (http://www.underwaredesign.com/forums/index.php?topic=1810.0)

[pbcode]
rem This command will hide the mouse pointer
mouse off

rem Programme main loop
do
 c=rnd(255)
 ink rgb(c,c,c)
 y=rnd(600)

      lockbuffer
        line 0,y,800,y
       for i=1 to 500
            dot rnd(800),rnd(600)
         next i

         ink RndRGB()
          for i=1 to 50
            dot rnd(800),rnd(600)
          next i
      unlockbuffer

       x=rnd(800)
        y=rnd(600)
        boxc x,y,x+20,y+1,1,rgb(0,0,0)

     sync
 loop
[/pbcode]

Title: Re: Screen Havoc
Post by: geecee on April 18, 2009, 05:54:24 PM
Thanks for your reply kevin.

I was unaware of that ...... There's such a lot in the documentation to read and try to understand and remember.

:)
geecee