Changeset 359 for trunk


Ignore:
Timestamp:
11/01/09 17:26:09 (10 years ago)
Author:
eliedebrauwer
Message:

Ticket #132: Patch by eliedebrauwer. Added logic to automatically learn the correct viewport (this is the current resolution) and apply this on a camera whenever the map gets loaded. fixes[s:trac, t:132]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/map.py

    r356 r359  
    6868    def makeActive(self): 
    6969        """Makes this map the active one. 
    70         """ 
     70           @return: None""" 
    7171        self.cameras[self.my_cam_id].setEnabled(True) 
    72  
    7372         
    7473    def load(self, filename): 
     
    120119        Note that if we have more than one camera in a map file 
    121120        we will have to rework how self.my_cam_id works. To make sure 
    122         the proper camera is set as the 'main' camera.""" 
     121        the proper camera is set as the 'main' camera. 
     122        At this point we also set the viewport to the current resolution.""" 
    123123        for cam in self.view.getCameras(): 
     124            width = int(TDS.readSetting(name="ScreenWidth")) 
     125            height = int(TDS.readSetting(name="ScreenHeight")) 
     126            viewport = fife.Rect(0,0,width,height) 
     127            cam.setViewPort(viewport) 
    124128            self.my_cam_id = cam.getId() 
    125129            self.cameras[self.my_cam_id] = cam 
Note: See TracChangeset for help on using the changeset viewer.