pygamekit / scene.pxi

from scene cimport *
from gameobject cimport *
    
cdef enum:
        OBJ_CAMERA  = 1 << 0
        OBJ_LIGHT   = 1 << 1
        OBJ_ENTITY  = 1 << 2
        OBJ_OBJECT  = 1 << 3
        OBJ_SKELETON = 1 << 4

cdef extern from "gkSceneManager.h":
    
    cdef gkScene* createEmptyScene "gkSceneManager::getSingleton().createEmptyScene"(
                                    const_std_string& sceneName, const_std_string& cameraName = "", const_std_string& group="")
    cdef gkScene* copyObjects "gkSceneManager::getSingleton().copyObjects"(gkScene* fromScene, gkScene* toScene, int exceptObjectTypes)
    
    

cdef class Scene(pywrap):
    
    def setGravity(self,g):
        (<gkScene *>self._p).setGravity(Vector(g).v[0])
    
    def getMainCamera(self):
        
        return Camera().P((<gkScene *>self._p).getMainCamera())
    
    #TODO: make sure you pass one of the correct types
    
    def setMainCamera(self, GameObject cam):
        (<gkScene *>self._p).setMainCamera(<gkCamera *>cam._p)
        
    def addObject(self, GameObject ob):
        (<gkScene *>self._p).addObject(<gkGameObject *>ob._p)
        
    def removeObject(self, GameObject ob):
        (<gkScene *>self._p).removeObject(<gkGameObject *>ob._p)
        
    def destroyObject(self, GameObject ob):
        (<gkScene *>self._p).destroyObject(<gkGameObject *>ob._p)
        
    def cloneObject(self, GameObject ob, lifeSpan=0, instantiate=False):
        cdef gkGameObject* o = <gkGameObject *>ob._p
        o = (<gkScene *>self._p).cloneObject(o, lifeSpan, instantiate)
        return GameObject().P(o)

    @property
    def objects(self):
        return GameObjectList().P(self._p)
        
    def suspendDynamics(Scene self):
        (<gkScene *>self._p).setUpdateFlags((<gkScene *>self._p).getUpdateFlags()&~UF_PHYSICS)
        
    def resumeDynamics(Scene self):
        (<gkScene *>self._p).setUpdateFlags((<gkScene *>self._p).getUpdateFlags()|UF_PHYSICS)
        
    def setShadowTextureSelfShadow(self,b):
        (<gkScene *>self._p).getManager().setShadowTextureSelfShadow(b)
        
    def setShadowCasterRenderBackFaces(self,b):
        (<gkScene *>self._p).getManager().setShadowCasterRenderBackFaces(b)
        
    def setShadowTextureSize(self,size):
        (<gkScene *>self._p).getManager().setShadowTextureSize(size)
        
    def setShadowFarDistance(self,d):
        (<gkScene *>self._p).getManager().setShadowFarDistance(d)
        
    
    #def __init__(self, sceneName = "", cameraName = "", group = ""):
        
        #self.scn = create(to_stdstring(sceneName), to_stdstring(cameraName), to_stdstring(group))
        #self.scn.setHorizonColor(gkColor(0.2,0.2,0.2))
        #self.scn.setAmbientColor(gkColor(0.5,0.5,0.5))
        
    #cdef __init__(self, gkScene* scn):
        #self.scn = scn
        #self.objects = GameObjectList()
        #self.objects.scn = scn
        #self.objects.hashmap = scn.getObjects()
        
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.