Class cocos.camera.Camera

object --+
         |
        Camera

Camera used in every CocosNode. Useful to look at the object from different views. The OpenGL gluLookAt() function is used to locate the camera.

If the object is transformed by any of the scale, rotation or position attributes, then they will override the camera.

Methods

  __init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  get_z_eye(cls)
Returns the best distance for the camera for the current window size
  restore(self)
Restore the camera to the initial position and sets it's dirty attribute in False and once in true.
  locate(self, force=False)
Sets the camera using gluLookAt using its eye, center and up_vector
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Instance Variables

  dirty
whether or not the camera is 'dirty' It is dirty if it is not in the original position
  once
optimization.

Class Variables

  eye = property(_get_eye, _set_eye, doc= '''Eye of the camera i...
  center = property(_get_center, _set_center, doc= '''Center of ...
  up_vector = property(_get_up_vector, _set_up_vector, doc= '''U...

Method Details

__init__

(Constructor) __init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides:
object.__init__

get_z_eye

Class Method get_z_eye(cls)

Returns the best distance for the camera for the current window size

cocos2d uses a Filed Of View (fov) of 60

restore

restore(self)

Restore the camera to the initial position and sets it's dirty attribute in False and once in true.

If you use the camera, for a while and you want to stop using it call this method.

locate

locate(self, force=False)
Sets the camera using gluLookAt using its eye, center and up_vector
Parameters:
force : bool
whether or not the camera will be located even if it is not dirty

Instance Variable Details

once

optimization. Only renders the camera once

Class Variable Details

eye

Value:
property(_get_eye, _set_eye, doc= '''Eye of the camera in x,y,z coordi\
nates
    
    :type: flaat,float,float
    ''')

center

Value:
property(_get_center, _set_center, doc= '''Center of the camera in x,y\
,z coordinates
    
    :type: flaat,float,float
    ''')

up_vector

Value:
property(_get_up_vector, _set_up_vector, doc= '''Up vector of the came\
ra in x,y,z coordinates
    
    :type: flaat,float,float
    ''')