Beispiel #1
0
def getEventSignal(ename, val):
        if g.eventSignals.has_key(ename):
            return tag(val, g.eventSignals[ename])
        e = EventMonitor(ename)
        g.eventSignals[ename] = e
        g.directObj.accept(ename, lambda: postEvent(ename))
        return tag(val, e)
Beispiel #2
0
def getEventSignal(ename, val):
    if g.eventSignals.has_key(ename):
        return tag(val, g.eventSignals[ename])
    e = EventMonitor(ename)
    g.eventSignals[ename] = e
    g.directObj.accept(ename, lambda: postEvent(ename))
    return tag(val, e)
Beispiel #3
0
def initializeGlobals():
     base.disableMouse()  # this takes the mouse away from Panda3D
     g.panda3dCamera = camera
     g.directObj = DirectObject()
     g.eventSignals = {}
     g.newEvents = {}
     g.events = {}
     g.reactEvents = []
     g.newModels = []
     g.tracking = False
     g.nextNE2dY = .95         # Positioning for 2-D controls
     g.nextNW2dY = .95
     g.tccontext = None
     # Set up the events / behaviors that deal with the mouse
     g.lbp = getEventSignal("mouse1", True)
     g.rbp = getEventSignal("mouse3", True)
     g.lbr = getEventSignal("mouse1-up", True)
     g.rbr = getEventSignal("mouse3-up", True)
     g.mouse = typedVar(SP2(0,0), P2Type)
     g.lbutton = hold(False, tag(True, g.lbp) + tag(False, g.lbr))
     g.rbutton = hold(False, tag(True, g.rbp) + tag(False, g.rbr))
     g.initMousePos = True
     g.mousePos = SP2(0,0)
     g.lbuttonPull = typedVar(SP2(0,0), P2Type)
     g.rbuttonPull = typedVar(SP2(0,0), P2Type)
     g.world = world
Beispiel #4
0
def initializeGlobals():
    base.disableMouse()  # this takes the mouse away from Panda3D
    g.panda3dCamera = camera
    g.directObj = DirectObject()
    g.eventSignals = {}
    g.newEvents = {}
    g.events = {}
    g.reactEvents = []
    g.newModels = []
    g.tracking = False
    g.nextNE2dY = .95  # Positioning for 2-D controls
    g.nextNW2dY = .95
    g.tccontext = None
    # Set up the events / behaviors that deal with the mouse
    g.lbp = getEventSignal("mouse1", True)
    g.rbp = getEventSignal("mouse3", True)
    g.lbr = getEventSignal("mouse1-up", True)
    g.rbr = getEventSignal("mouse3-up", True)
    g.mouse = typedVar(SP2(0, 0), P2Type)
    g.lbutton = hold(False, tag(True, g.lbp) + tag(False, g.lbr))
    g.rbutton = hold(False, tag(True, g.rbp) + tag(False, g.rbr))
    g.initMousePos = True
    g.mousePos = SP2(0, 0)
    g.lbuttonPull = typedVar(SP2(0, 0), P2Type)
    g.rbuttonPull = typedVar(SP2(0, 0), P2Type)
    g.world = world