コード例 #1
0
ファイル: console.py プロジェクト: puresandwich/parole
 def toggleActive(self):
     """
     Toggles whether the console is visible and accepting input.
     """
     if not self.active:
         display.scene.add(self)
         parole.pushUIEventHandler((self.cmdMap, self.readLine))
         self.active = True
         parole.info('Console activated.')
     else:
         display.scene.remove(self)
         parole.popUIEventHandler()
         self.active = False
         parole.info('Console deactivated.')
コード例 #2
0
ファイル: console.py プロジェクト: gdos/parole
 def toggleActive(self):
     """
     Toggles whether the console is visible and accepting input.
     """
     if not self.active:
         display.scene.add(self)
         parole.pushUIEventHandler((self.cmdMap, self.readLine))
         self.active = True
         parole.info('Console activated.')
     else:
         display.scene.remove(self)
         parole.popUIEventHandler()
         self.active = False
         parole.info('Console deactivated.')
コード例 #3
0
def updateFunc():
    init()

    walkCommands = parole.input.CommandMap(parole.conf.commands.walkcommands,
                                           handleWalk, peek=True)
    testCommands = parole.input.CommandMap(parole.conf.commands.testcommandset,
                                           handleTest, peek=False)
    parole.pushUIEventHandler((walkCommands, testCommands))
    
    scrsize = parole.display.getSurface().get_size()
    txtfont = parole.resource.getFont('fonts/monaco.ttf', 16)
    textsize = (scrsize[0], txtfont.get_linesize()*3)
    msg1Shader = parole.shader.TextBlockPass(txtfont,
            (200,200,200), text="Use numpad (or vi keys) "\
                    "to move, arrows to scroll map,") 
    msg2Shader = parole.shader.TextBlockPass(txtfont, (200,200,200),
            text="'?' for more help.") 
    data['msg3Shader'] = parole.shader.TextBlockPass(txtfont,
            (200,200,200))
    parole.display.scene.add(msg1Shader, pos=(3, 0))
    parole.display.scene.add(msg2Shader, pos=(3, txtfont.get_linesize()))
    parole.display.scene.add(data['msg3Shader'], 
        pos=(3, txtfont.get_linesize()*2))

    # Map frame setup
    # Create MapFrame and add to scene
    mapsize = (scrsize[0], scrsize[1] - txtfont.get_linesize()*3)
    mappos = (0, txtfont.get_linesize()*3)
    tileSize = parole.map.AsciiTile.characterSize()
    data['mapframe'] = parole.map.MapFrame(mapsize, tileSize=tileSize)
    parole.display.scene.add(data['mapframe'], pos=mappos)

    resetGame()

    while 1:
        yield