Main Menu

PBFX camera

Started by reno, January 20, 2009, 08:25:19 AM

Previous topic - Next topic

reno

Hi,

Is there another way to use camera in PBFX ? For the moment I use it like in the demo plateformer :


;////////
;!!!camera

;Dim PB Camera type
Dim Camera As PBCamera Pointer
Camera=New PBCamera

;Camera Position
Camera.pos.X=(GetScreenWidth()/2.0)
Camera.pos.y=(GetScreenWidth()/2.0)
Camera.pos.z=-1000.0

;RotationMode 0=2d With Perspective down Z axis (z rotation supported Camera.Angle.Z), 1=3D ZYX rotation
Camera.RotationMode=0

;Set Camera Projection t
Camera.Projection.x=1000.0
Camera.Projection.y=1000.0

;Middle of Camera
Camera.ViewPoint.X=(GetScreenWidth()/2.0)
Camera.ViewPoint.y=(GetScreenWidth()/2.0)


I would use simple array (Dim). I will be better for me and I'll be able to use it inside functions.

Someone for help ? Thanks.
More games ? Go to my website :)
http://www.thereeteam.com/

kevin

#1
 The PBFX camera is simply a structure, you can store it anywhere.

  If you declare a typed variable this will be globally accessible.   
  Dim Camera As PBCamera

  // stuff etc etc

//
DrawPerspectiveSprites GetListPtr(Camera())




reno

I read the doc and see that I have to use variables parameters in the function to use it.

But I don't understand your method to use "simply" the camera as a global parameter :


;Dim PB Camera type
Dim Camera As PBCamera
Camera=New PBCamera

;Camera Position
Camera.pos.X=(GetScreenWidth()/2.0)
Camera.pos.y=(GetScreenWidth()/2.0)
Camera.pos.z=-1000.0

;RotationMode 0=2d With Perspective down Z axis (z rotation supported Camera.Angle.Z), 1=3D ZYX rotation
Camera.RotationMode=0

;Set Camera Projection t
Camera.Projection.x=1000.0
Camera.Projection.y=1000.0

;Middle of Camera
Camera.ViewPoint.X=(GetScreenWidth()/2.0)
Camera.ViewPoint.y=(GetScreenWidth()/2.0)


DrawPerspectiveSprites GetTypePtr(Camera())


= error
More games ? Go to my website :)
http://www.thereeteam.com/

kevin

  It should be GetListPtr(),  this willl return the pointer



;Dim PB Camera type
Dim Camera As PBCamera
Camera=New PBCamera

;Camera Position
Camera.pos.X=(GetScreenWidth()/2.0)
Camera.pos.y=(GetScreenWidth()/2.0)
Camera.pos.z=-1000.0

;RotationMode 0=2d With Perspective down Z axis (z rotation supported Camera.Angle.Z), 1=3D ZYX rotation
Camera.RotationMode=0

;Set Camera Projection t
Camera.Projection.x=1000.0
Camera.Projection.y=1000.0

;Middle of Camera
Camera.ViewPoint.X=(GetScreenWidth()/2.0)
Camera.ViewPoint.y=(GetScreenWidth()/2.0)


DrawPerspectiveSprites GetListPtr(Camera())


reno

It was what I need ! Thank you 8)
More games ? Go to my website :)
http://www.thereeteam.com/