sinus display

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by spider.


i just have this question how do i display an image in a sinus way..

tried every thing dosent work.. example like this..

startdrawing(screenoutput())
useimage(1)
for i=1 to imageheight()
drawimage(useimage(1),200,Sin( t * 3 + i) *30,200,i)
next
stopdrawing()
t=t+1

i guess it should be something like this.. but it doesent.. work that good

would be glad if someone helped me out.. (iam a newbie to purebasic :) )
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by WolfgangS.

Hi !
try this ...

MFG
WolfgangS

Code: Select all

#Id_Image1  = 1
  If InitSprite()=0 Or InitKeyboard()=0
    MessageRequester("","Error InitSprite/InitKeyBoard",0):End
  EndIf
    
  If OpenScreen(800,600,16,"bla")=0
    MessageRequester("","Error open Screen",0):End
  EndIf

  hnd_Image1=LoadImage(#ID_Image1,"E:\titlepic.bmp")    ; get your own picture
  If hnd_Image1=0
    MessageRequester("","Error open Image",0):End
  EndIf

  UseImage(#Id_Image1)

x.f =0  :y.f =50    ; Floats !!!! Very important !!!
xh.f=0  :yh.f=0
Repeat
    FlipBuffers()
    ClearScreen(0,0,0)

    xh=80*Sin(x)+210
    yh=50*Cos(y+x)+200
    
    StartDrawing(ScreenOutput())
      DrawImage(hnd_Image1,xh,yh)
    StopDrawing()
    
    x+0.05
    y+0.1
    If x>=360 : x=0 : EndIf
    If y>=360 : y=0 : EndIf

    ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End
Post Reply