Ooops
January 24, 2021, 12:22:09 PM

Author Topic: [bb] SinusPlayer by kRUZe [ 1+ years ago ]  (Read 415 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] SinusPlayer by kRUZe [ 1+ years ago ]
« on: June 29, 2017, 12:28:39 AM »
Title : SinusPlayer
Author : kRUZe
Posted : 1+ years ago

Description : A twisted (literally) movie playing routine :-)  NJOi

Code :
Code: BlitzBasic
  1. ;---------------------------------------------------------
  2. ;      
  3. ;       (c)2003 Zerosynapse
  4. ;      
  5. ;
  6. ;       Dunno why I wrote this but you may like it? :)
  7. ;
  8. ;
  9. ;       Use F1/F2 Increase/Decrease the pixel zoom size
  10. ;       Use F3/F4 Increase/Decrease the sinus values
  11. ;---------------------------------------------------------
  12.  
  13.  
  14. width=800
  15. height=600
  16.        
  17. filename$="yourmovie.avi"       ; point to your movie file here :)
  18.  
  19. Graphics width,height,0,1
  20.  
  21. Global fnt_verdana=LoadFont("verdana",12,1,0,0)
  22. SetFont fnt_verdana
  23.  
  24. movie=OpenMovie(filename$)
  25. If movie=0 Then RuntimeError "Error - Movie not loaded!"
  26. If Not(MoviePlaying(movie)) Then RuntimeError "Error - Movie not playing!"
  27.  
  28. steps=12        ; Starting Zoom/Pixel Size
  29. w=64            ; width of the movie displayed multiplied by the steps
  30. h=48            ; height of the movie displayed multiplied by the steps
  31. x=0             ; x position of the movie on screen
  32. y=0             ; y position of the movie on screen
  33.  
  34. SetBuffer BackBuffer()
  35.  
  36. Dim pixcol(w,h)
  37. movie_tmp=CreateImage(w,h)
  38.  
  39. freq=2          ;
  40. amp=128         ; Sin Variables
  41. count=1         ;
  42.  
  43. Repeat
  44.  
  45.         SetBuffer ImageBuffer(movie_tmp)
  46.         DrawMovie movie,x,y,w,h ; draw the movie
  47.        
  48.         LockBuffer ImageBuffer(movie_tmp)
  49.         For x_=1 To w
  50.                 For y_=1 To h
  51.                         col=ReadPixelFast(x_,y_, ImageBuffer(movie_tmp)) And $ffffff   
  52.                         r = (col Shr 16) And $FF
  53.                         ;g = (col Shr 8) And $FF        ; Twisted things with Xvid using G ?
  54.                         b = (col And $FF)
  55.                         value=(r+b)/2
  56.                         pixcol(x_,y_) = value
  57.                 Next
  58.         Next
  59.         UnlockBuffer ImageBuffer(movie_tmp)
  60.        
  61.         offx=(width-(w*steps))/2 ; the x position of the movie on screen
  62.         offy=(height-(h*steps))/2 ; the y position of the movie on screen
  63.  
  64.         SetBuffer BackBuffer() 
  65.         Cls
  66.         For x_=0 To w-1
  67.                 For y_=0 To h-1
  68.                         Color 0,pixcol(x_,y_),pixcol(x_,y_)
  69.                         sinx=Sin((count*freq)+(y_))*amp
  70.                         Rect ((x_*steps)+sinx)+offx,((y_*steps)-siny)+offy,steps+4,steps+4,1
  71.                 Next
  72.                 siny=Sin((count*freq)+(x_))*amp
  73.         Next
  74.  
  75.         Color 255,255,255
  76.         Text 0,0,"Steps = "+steps
  77.         Text 0,12,"Amp = "+amp
  78.  
  79.         If KeyDown(59) steps=steps-1
  80.         If steps<1 steps=1
  81.         If KeyDown(60) steps=steps+1
  82.         If steps>64 steps=64
  83.        
  84.         If KeyDown(61) amp=amp-1
  85.         If amp<1 amp=1
  86.         If KeyDown(62) amp=amp+1
  87.         If amp>256 amp=256
  88.  
  89.         count=count+1
  90.         If count>359 count=1   
  91. Flip
  92. Until KeyHit(1)
  93.  
  94. CloseMovie(movie)
  95.  
  96. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal