Changeset 621


Ignore:
Timestamp:
08/04/10 17:43:08 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.
GameSceneController?

  • Moved code from mouseMoved to updateMouse. updateMouse takes X and Y parameters instead of an event.
  • Scrolling at the bottom now activates when the mouse is at the bottom of the panel. (This didn't work before cause the hud consumed the event)

HUD:

Location:
trunk/game/scripts
Files:
2 edited

Legend:

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

    r620 r621  
    221221           @param evt: The event that fife caught 
    222222           @return: None""" 
    223         self.last_mousecoords = fife.ScreenPoint(evt.getX(), evt.getY()) 
     223        self.updateMouse(evt.getX(), evt.getY()) 
     224     
     225    def updateMouse(self, mouseX, mouseY): 
     226        """Updates the mouse values 
     227        @param mouseX: X-Position of mouse 
     228        @type mouseX: int 
     229        @param mouseY: Y-Position of mouse 
     230        @type mouseY: int""" 
     231         
     232        self.last_mousecoords = fife.ScreenPoint(mouseX, mouseY)         
    224233        self.view.highlightFrontObject(self.last_mousecoords)        
    225234         
     
    244253            direction[1] += 1 
    245254        #down 
    246         if mouse_y >= screen_height - 60 - pixle_edge: 
     255        if mouse_y >= screen_height - pixle_edge: 
    247256            direction[0] -= 1 
    248257            direction[1] += 1 
  • trunk/game/scripts/gui/hud.py

    r610 r621  
    1818from fife.extensions import pychan 
    1919from fife.extensions.pychan.tools import callbackWithArguments as cbwa 
     20from fife.fife import MouseEvent 
    2021 
    2122from scripts.gui.filebrowser import FileBrowser 
     
    6364        self.menu_events = None 
    6465        self.quit_window = None 
     66        self.bottom_panel = self.hud.findChild(name="mainHudWindow") 
     67        self.bottom_panel.capture(self.mouseMoved, event_name="mouseMoved") 
    6568         
    6669        self.actions_box = self.hud.findChild(name="actionsBox") 
     
    111114        # now it should be OK to display it all 
    112115        self.hud.show() 
     116         
     117    def mouseMoved(self, event): 
     118        self.controller.updateMouse(event.getX(),  
     119                                    self.engine.getSettings().getScreenHeight() - \ 
     120                                    (self.bottom_panel.height - event.getY())) 
     121         
    113122 
    114123    def refreshActionsBox(self): 
Note: See TracChangeset for help on using the changeset viewer.