News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Fun with feedback.

Started by XDumbnBassX, January 13, 2009, 10:15:46 AM

Previous topic - Next topic

XDumbnBassX

Found a fun little demo posted by Kevin last night using pbfx 1.7 engine for a feedback effect (which I've always been obsessed with). I couldn't help myself, and had to mess with it all night.

; PROJECT : feedback
; AUTHOR  : jeff
; CREATED : 1/12/2009
; EDITED  : 1/13/2009
LoadFont  "Arial",1,130,1

Surf1=New3DImage(GetScreenWidth(),GetScreenHeight())

CurrentCol =RndRgb()
NextCol =RndRgb()
angleAdjust#=RndRange#((0.2)*-1,(0.2))
scale#=RndRange#((0.3),(2))
actualScale# = 0
changeWait = 100
blendAmt# = 0.9
actualBlend# = 0.1

theX#=GetScreenWidth()/2
theY#=GetScreenHeight()/2
newX#=RndRange#(100,GetScreenWidth()-200)
newY#=RndRange#(50,GetScreenHeight()-100)

Setfps 60
sw=GetScreenWidth()/2
sh=GetScreenHeight()/2

Do
angle#=wrapangle(angle#,angleAdjust#)

if actualScale# <> scale# then actualScale# = actualScale# + ((scale#-actualScale#)/changeWait)
if actualBlend# <> blendAmt# then actualBlend# = actualBlend# + ((blendAmt#-actualBlend#)/changeWait)

   DrawRotatedImage Surf1, sw, sh, angle#, actualScale#, actualScale#, sw*-1, sh*-1, 1
DrawAlphaImage Surf1,0,0,actualBlend#,0

Ink rgbalphablend(CurrentCol,NextCol,Blend)

   If theX#<>newX# Then theX# = theX# + ((newX#-theX#)/changeWait)
   If theY#<>newY# Then theY# = theY# + ((newY#-theY#)/changeWait)
   
CenterText theX#+5, theY#-65, "+"
CenterText GetScreenWidth()-theX#+5, GetScreenHeight()-theY#-65, "+"
//CenterText mouseX()+5, mouseY()-65, "+"

Inc blend
If blend>changeWait
blend=0
changeWait=RndRange(50,400)
CurrentCol=NextCol
NextCol=RndRgb()
      angleAdjust#=RndRange#((0.2)*-1,(0.2))
scale#=RndRange#((0.3),(2))
      newX#=RndRange#(100,GetScreenWidth()-200)
newY#=RndRange#(50,GetScreenHeight()-100)
blendAmt#=RndRange#(0.1,0.9)
EndIf

   CopyRect 0,0,0,GetScreenWidth(),GetScreenHeight(),Surf1,0,0

Sync
Loop


Now if I had the patience to turn this into a screensaver, that would rule.

p.s. set the app settings to 800 x 600 @ fullscreen for best results.

kevin


That's an excellent effect !

XDumbnBassX

Even better.

; PROJECT : feedback
; AUTHOR  : jeff
; CREATED : 1/12/2009
; EDITED  : 1/13/2009
LoadFont  "Arial",1,130,1

Surf1=New3DImage(GetScreenWidth(),GetScreenHeight())

CurrentCol =RndRgb()
NextCol =RndRgb()
angleAdjust#=RndRange#((0.2)*-1,(0.2))
scale#=RndRange#((0.3),(2))
actualScale# = 0
changeWait = 100
blendAmt# = 0.9
actualBlend# = 0.1

theX#=GetScreenWidth()/2
theY#=GetScreenHeight()/2
newX#=RndRange#(100,GetScreenWidth()-200)
newY#=RndRange#(50,GetScreenHeight()-100)

Setfps 60
sw=GetScreenWidth()/2
sh=GetScreenHeight()/2

Do
angle#=wrapangle(angle#,angleAdjust#)

if actualScale# <> scale# then actualScale# = actualScale# + ((scale#-actualScale#)/changeWait)
if actualBlend# <> blendAmt# then actualBlend# = actualBlend# + ((blendAmt#-actualBlend#)/changeWait)

   DrawRotatedImage Surf1, sw, sh, angle#, actualScale#, actualScale#, sw*-1, sh*-1, 1
DrawAlphaImage Surf1,0,0,actualBlend#,0

Ink rgbalphablend(CurrentCol,NextCol,Blend)

   If theX#<>newX# Then theX# = theX# + ((newX#-theX#)/changeWait)
   If theY#<>newY# Then theY# = theY# + ((newY#-theY#)/changeWait)
   
CenterText theX#+5, theY#-65, "+"
CenterText GetScreenWidth()-theX#+5, GetScreenHeight()-theY#-65, "+"
//CenterText mouseX()+5, mouseY()-65, "+"

Inc blend
If blend>changeWait
blend=0
changeWait=RndRange(50,400)
CurrentCol=NextCol
NextCol=RndRgb()
      angleAdjust#=RndRange#((0.2)*-1,(0.2))
scale#=RndRange#((0.3),(2))
      newX#=RndRange#(100,GetScreenWidth()-200)
newY#=RndRange#(50,GetScreenHeight()-100)
blendAmt#=RndRange#(0.1,0.9)
EndIf

   CopyRect 0,0,0,GetScreenWidth(),GetScreenHeight(),Surf1,0,0

Sync
Loop


Such an awesome little language you got here.

ATLUS


reno

It's very nice ! I like demos !
More games ? Go to my website :)
http://www.thereeteam.com/

Adaz

Very nice, waiting for the customizable screensaver:) !

Ádáz

Hungary

XDumbnBassX

another update

; PROJECT : feedback
; AUTHOR  : jeff
; CREATED : 1/12/2009
; EDITED  : 1/27/2009

Setfps 60
//ScreenVsync On

LoadFont  "Arial",1,130,1

Surf1=New3DImage(GetScreenWidth(),GetScreenHeight())

CurrentCol =RndRgb()
NextCol =RndRgb()
angleAdjust#=RndRange#((0.2)*-1,(0.2))
scale#=RndRange#((0.3),(2))
actualScale# = 0
changeWait = 100
blendAmt# = 0.9
actualBlend# = 0.1
showString$ = "+"

theX#=GetScreenWidth()/2
theY#=GetScreenHeight()/2
newX#=RndRange#(100,GetScreenWidth()-200)
newY#=RndRange#(50,GetScreenHeight()-100)

platformX# = 0
platformY# = 0
newPlatformX# = 0
newPlatformY# = 0

sw=GetScreenWidth()/2
sh=GetScreenHeight()/2

SettingFile$="FBSettings.ini"

If FileExist(SettingFile$) = True
// if settings file exists, read settings in.
   ReadFile SettingFile$,1
showString$ = ReadString$(1)
CloseFile 1
Else
// write a new settings file with default values.
   WriteFile SettingFile$,1
WriteString 1,showString$
CloseFile 1
EndIf

If Commandline$() = "/p"
// preview

end
endif

If Commandline$() = "/c"
// settings

end
endif

If Commandline$() = "/s" or Commandline$() = ""
// screensaver
Do
angle#=wrapangle(angle#,angleAdjust#)

if actualScale# <> scale# then actualScale# = actualScale# + ((scale#-actualScale#)/changeWait)
if actualBlend# <> blendAmt# then actualBlend# = actualBlend# + ((blendAmt#-actualBlend#)/changeWait)

    DrawRotatedImage Surf1, sw, sh, angle#, actualScale#, actualScale#, sw*-1, sh*-1, 1
DrawAlphaImage Surf1,0,0,actualBlend#,0

Ink rgbalphablend(CurrentCol,NextCol,Blend)

    If theX#<>newX# Then theX# = theX# + ((newX#-theX#)/changeWait)
    If theY#<>newY# Then theY# = theY# + ((newY#-theY#)/changeWait)
   
CenterText theX#+5, theY#-65, showString$
CenterText GetScreenWidth()-theX#+5, GetScreenHeight()-theY#-65, showString$
//CenterText mouseX()+5, mouseY()-65, "+"

Inc blend
If blend>changeWait
blend=0
changeWait=RndRange(50,300)
CurrentCol=NextCol
NextCol=RndRgb()
      angleAdjust#=RndRange#((1)*-1,(1))
scale#=RndRange#((0.1),(2))
      newX#=RndRange#((GetScreenWidth()/4),GetScreenWidth()-(GetScreenWidth()/2))
newY#=RndRange#((GetScreenHeight()/4),GetScreenHeight()-(GetScreenHeight()/2))
blendAmt#=RndRange#(0.5,1)
newPlatformX# = RndRange#(-8,8)
newPlatformY# = RndRange#(-8,8)
EndIf

If platformX#<>newPlatformX# Then platformX# = platformX# + ((newPlatformX#-platformX#)/changeWait)
    If platformY#<>newPlatformY# Then platformY# = platformY# + ((newPlatformY#-platformY#)/changeWait)

    CopyRect 0,platformX#,platformY#,GetScreenWidth()-platformX#,GetScreenHeight()-platformY#,Surf1,0,0

Sync
Loop
endif


i started integrating the code needed to make this a screensaver, and loading some (just 1 at the moment) settings from a file.

i have been looking for a small & clean way to get some use input though (a popup input box would be fantastic) and ive yet to find any simple solutions.