コード例 #1
0
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-1, 1, -1, 1),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.waitbar = DirectWaitBar(
            barColor=(0.0, 0.0, 1.0, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            state='normal',
            text='0%',
            value=50.0,
            text_align=TextNode.A_center,
            text_scale=(0.1, 0.1),
            text_pos=(0, -0.025),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.waitbar.setTransparency(0)
コード例 #2
0
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 0.5),
            frameSize=(-1, 1, -1, 1),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.lblVictory = DirectLabel(
            frameColor=(0.0, 0.0, 0.0, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.2, 0.2, 0.2),
            text='Won Fight',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblVictory.setTransparency(0)
コード例 #3
0
ファイル: Turn.py プロジェクト: fireclawthefox/AnkandoraLight
    def __init__(self, rootParent=None):

        self.btnEndTurn = DirectButton(
            borderWidth=(0.0, 0.0),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-3.0, 3.0, -1.0, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            image='./assets/Turn/EndTurn.png',
            pos=LPoint3f(0, 0, 0.1),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='End Turn',
            image_scale=LVecBase3f(3, 0, 1),
            image_pos=LPoint3f(0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(1.0, 1.0),
            text_pos=(0.0, -0.3),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["endTurn"],
            pressEffect=0,
        )
        self.btnEndTurn.setTransparency(1)
コード例 #4
0
ファイル: dockit.py プロジェクト: AspirinCode/dockit
 def apply_color(self, a3d, atom, color_map):
     ''' Apply a color map to the element '''
     if isinstance(color_map, BFactor):
         color = color_map.get_color_by_bfactor(atom.get_b_factor())
     else:
         color = color_map.get_color_by_element(atom.get_element())
     red, green, blue, alpha = color.get_rgba() 
     a3d.setColor(LVecBase4f(red, green, blue, alpha))
     a3d.setColorScale(LVecBase4f(1, 1, 1, 1))
コード例 #5
0
ファイル: dockit.py プロジェクト: AspirinCode/dockit
 def load_protein_residue(self, protein, node):
     ''' Display a given protein using spheres models for each atom '''
     residues = protein.get_residues()
     self.residues_objects = []
     for residue in residues:
         r = loader.loadModel("models/atom_sphere")
         x,y,z = residue.get_center_coordinates()
         r.setPos(x, y, z)
         r.setScale(4.0 / Dockit.radius_scale)
         r.setColor(LVecBase4f(1.0, 0.59, 0.0, 1.0))
         r.setColorScale(LVecBase4f(1, 1, 1, 1))
         r.reparentTo(node)
     node.flattenStrong()
コード例 #6
0
    def setupDoor(doorNodePath, parentNode, doorOrigin, dnaStore, block,
                  color):
        doorNodePath.setPosHprScale(doorOrigin, LVecBase3f(0), LVecBase3f(0),
                                    LVecBase3f(1))
        doorNodePath.setColor(color)
        leftHole = doorNodePath.find("door_*_hole_left")
        leftHole.setName("doorFrameHoleLeft")
        leftHoleGeom = leftHole.find("**/+GeomNode")
        leftHoleGeom.setName("doorFrameHoleLeftGeom")
        rightHole = doorNodePath.find("door_*_hole_right")
        rightHole.setName("doorFrameHoleRight")
        rightHoleGeom = rightHole.find("**/+GeomNode")
        rightHoleGeom.setName("doorFrameHoleRightGeom")
        leftDoor = doorNodePath.find("door_*_left")
        leftDoor.setName("leftDoor")
        rightDoor = doorNodePath.find("door_*_right")
        rightDoor.setName("rightDoor")
        doorFlat = doorNodePath.find("door_*_flat")
        doorFlat.setEffect(DecalEffect.make())
        leftHole.wrtReparentTo(doorFlat, 0)
        rightHole.wrtReparentTo(doorFlat, 0)

        if not leftHoleGeom.getNode(0).isGeomNode():
            leftHoleGeom = leftHoleGeom.find("**/+GeomNode")

        if not rightHoleGeom.getNode(0).isGeomNode():
            rightHoleGeom = rightHoleGeom.find("**/+GeomNode")

        leftHoleGeom.setEffect(DecalEffect.make())
        rightHoleGeom.setEffect(DecalEffect.make())
        rightDoor.wrtReparentTo(parentNode, 0)
        leftDoor.wrtReparentTo(parentNode, 0)
        rightDoor.setColor(color, 0)
        leftDoor.setColor(color, 0)
        rightDoor.hide()
        leftDoor.hide()
        rightHole.hide()
        leftHole.hide()
        leftHole.setColor(LVecBase4f(0, 0, 0, 1), 0)
        rightHole.setColor(LVecBase4f(0, 0, 0, 1), 0)

        doorTrigger = doorNodePath.find("door_*_trigger")
        doorTrigger.setScale(2, 2, 2)
        doorTrigger.wrtReparentTo(parentNode, 0)
        doorTrigger.setName("door_trigger_" + str(block))

        storeNp = NodePath("door_trigger_" + str(block))
        storeNp.setPosHprScale(doorTrigger, LVecBase3f(0), LVecBase3f(0),
                               LVecBase3f(1))
        dnaStore.storeBlockDoor(block, storeNp)
コード例 #7
0
    def __init(self, pdb_file, mode='CPK'):
        ShowBase.__init__(self)
        if mode not in modes.keys():
            raise Exception('No se reconoce el modo de visualizacion %s' %
                            mode)
        self.mode = mode

        #Desglosamos archivo PDB
        parser = PDBParser(QUIET=True, PERMISSIVE=True)
        structure = parser.get_structure('Structure', pdb_file)

        #Creamos el modelo
        self.pnode = render.attachNewNode("Model")
        if mode == 'CPK':
            self.load_CPK(structure, self.pnode)
        elif mode == 'backbone':
            self.load_bbone(structure, self.pnode)
        #elif mode == 'elquesea':

        #Colocamos la proteina en el centro

        self.pnode.setPos(0, 0, 0)

        #Colocamos la camara en el centro

        p_radius = self.pnode.getBounds().getRadius()
        p_center = self.pnode.getBounds().getCenter()
        xc, yc, zc = p_center

        base.cam.setPos(xc, -150 - yc - 2 * p_radius, zc)
        base.cam.lookAt(xc, yc, zc)

        #Luz ambiental

        self.ambiente = AmbientLight('aluz')
        self.ambiente.setColor(LVecBase4f(0.16, 0.16, 0.17, 1.0))
        self.luza = render.attachNewNode(ambiente)
        render.setLight(self.luza)

        #Luz direccional

        self.direccional = DirectionalLight('dluz')
        self.direccional.setColor(LVecBase4f(0.8, 0.7, 0.75, 1.0))
        self.direccional.setShadowCaster(True, 512, 512)
        render.setShaderAuto()
        self.luzd = render.attachNewNode(direccional)
        self.luzd.setPos(0, -50, 0)
        render.setLight(self.luzd)
        self.luzd.lookAt(xc, yc, zc)
コード例 #8
0
def addLink():
    """add a link's (off mesh connection) point pair"""

    global linkPointPair, linkRefs, navMesh
    if navMesh == None:
        return

    entry0 = getCollisionEntryFromCamera()
    if entry0:
        point = entry0.get_surface_point(NodePath())
        if linkPointPair.get_num_values() == 0:
            RNNavMeshManager.get_global_ptr().debug_draw_reset()
            # add start point to list
            linkPointPair.add_value(point)
            RNNavMeshManager.get_global_ptr().debug_draw_primitive(
                RNNavMeshManager.POINTS, linkPointPair,
                LVecBase4f(0.0, 0.0, 1.0, 1.0), 4.0)
            print(point)
        else:
            RNNavMeshManager.get_global_ptr().debug_draw_reset()
            # add end point to list
            linkPointPair.add_value(point)
            print(point)
            # add off mesh connection (link)
            ref = navMesh.add_off_mesh_connection(linkPointPair, True)
            print("Added (temporary) bidirectional link with ref: " + str(ref))
            linkRefs.append(ref)
            # reset list
            linkPointPair.clear()
コード例 #9
0
def addArea(data):
    """add area's (convex volume) points"""

    global areaPointList, areaRefs, navMesh
    if navMesh == None:
        return

    entry0 = getCollisionEntryFromCamera()
    if entry0:
        addPoint = data
        point = entry0.get_surface_point(NodePath())
        if addPoint:
            RNNavMeshManager.get_global_ptr().debug_draw_reset()
            # add to list
            areaPointList.add_value(point)
            RNNavMeshManager.get_global_ptr().debug_draw_primitive(
                RNNavMeshManager.POINTS, areaPointList,
                LVecBase4f(1.0, 0.0, 0.0, 1.0), 4.0)
            print(point)
        else:
            RNNavMeshManager.get_global_ptr().debug_draw_reset()
            # add last point to list
            areaPointList.add_value(point)
            print(point)
            # add convex volume (area)
            ref = navMesh.add_convex_volume(areaPointList,
                                            RNNavMesh.POLYAREA_DOOR)
            print("Added (temporary) area with ref: " + str(ref))
            areaRefs.append(ref)
            # reset list
            areaPointList.clear()
コード例 #10
0
 def __init__(self):
     self.cm = CardMaker("fadeout")
     self.cm.setFrame(-2,2,-2,2)
     self.cmnode = NodePath(self.cm.generate())
     self.cmnode.setTransparency(TransparencyAttrib.MAlpha)
     self.cmnode.setY(-1)
     self.cmnode.setColorScale(LVecBase4f(0.0,0.0,0.0,0.0))
     self.cmnode.reparentTo(aspect2d)
コード例 #11
0
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 0.75),
            frameSize=(-1, 1, -1, 1),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(1)

        self.btnQuit = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.75),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Quit',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["quitRoom"],
            pressEffect=1,
        )
        self.btnQuit.setTransparency(0)

        self.lblMessage = DirectLabel(
            frameColor=(0.0, 0.0, 0.0, 0.0),
            frameSize=(-2.981, 3.106, -0.325, 0.725),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.2, 0.2, 0.2),
            text='Player A Won',
            text_align=TextNode.A_center,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblMessage.setTransparency(0)
コード例 #12
0
    def load(self, di):
        PiecewiseCurve.load(self, di)
        self.order = di.get_int8()
        num_cvs = di.get_uint32()
        self.points = []
        self.knots = []

        for i in range(num_cvs):
            point = LVecBase4f()
            point.read_datagram(di)
            self.points.append(point)
            self.knots.append(di.get_float64())
コード例 #13
0
    def __init__(self, rootParent=None):
        
        self.frmMain = DirectFrame(
            frameColor=(0.25, 0.25, 0.25, 1.0),
            frameSize=(0.0, 2.0, -0.1, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.btnLeave = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pad=(0.1, 0.1),
            pos=LPoint3f(0.115, 0, -0.075),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Leave',
            text_align=TextNode.A_center,
            text_scale=(0.75, 0.75),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["leaveRoom"],
        )
        self.btnLeave.setTransparency(0)

        self.lblPlayerName = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.55, 0, -0.075),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Label',
            text_align=TextNode.A_left,
            text_scale=(0.75, 0.75),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.8, 0.8, 0.8, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblPlayerName.setTransparency(0)

        self.pg1983 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.42, 0, -0.075),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Name:',
            text_align=TextNode.A_center,
            text_scale=(0.75, 0.75),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.6, 0.6, 0.6, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.pg1983.setTransparency(0)
コード例 #14
0
    def __init__(self, rootParent=None):

        self.btnRollDice = DirectButton(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.25, 0.25, -0.25, 0.25),
            hpr=LVecBase3f(0, 0, 0),
            image='./assets/Dice/DiceButton.png',
            pos=LPoint3f(0.25, 0, 0.25),
            relief=1,
            scale=LVecBase3f(1, 1, 1),
            text='',
            image_scale=LVecBase3f(0.25, 0.25, 0.25),
            image_pos=LPoint3f(0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(0.15, 0.15),
            text_pos=(-0.08, -0.09),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["rollDice"],
            pressEffect=0,
        )
        self.btnRollDice.setTransparency(1)
コード例 #15
0
ファイル: Panda3DApp.py プロジェクト: jcfandinocal/progaf
    def __init__(self):
        Application.__init__(self)

        # Create ShowBase Object for Panda3D Rendering and event handling
        self.base = ShowBase()

        # Set Some defaults
        white = LVecBase4f(1, 1, 1, 1)
        self.base.setBackgroundColor(white)
        self.base.setFrameRateMeter(True)

        # Set Some Common KeyBindings. (Un)Comment as required! ;)
        self.accept("w", self.toogleWireFrame)

        # Collections for all objects and sprites used in the game.
        self.gameObjects = OrderedDict()
コード例 #16
0
    def __init__(self, text, x, z, scale, r, g, b):
        self.x = x
        self.z = z
        self.scale = scale
        self.r = r
        self.g = g
        self.b = b

        textnode = TextNode('fadingtext')
        textnode.setText(text)
        self.node = aspect2d.attachNewNode(textnode)
        self.node.setScale(self.scale)

        self.node.setTransparency(TransparencyAttrib.MAlpha)
        self.node.setPos(self.x, -1, self.z)
        self.node.setColorScale(LVecBase4f(self.r, self.g, self.b, 0.0))
        self.node.reparentTo(aspect2d)

        delay = 3.0
        seq = Sequence(self.fadeIn(delay), Wait(delay), self.fadeOut(delay))
        seq.start()
コード例 #17
0
    def __init__(self, rootParent=None):

        self.table = DirectFrame(
            frameColor=(1.0, 1.0, 1.0, 0.0),
            frameSize=(-1, 1, -1, 1),
            hpr=LVecBase3f(0, 0, 0),
            image='chapter1/table.png',
            pos=LPoint3f(0.55, 0, -0.575),
            sortOrder=200,
            image_scale=LVecBase3f(0.256, 1, 0.312),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.table.setTransparency(1)

        self.btnFlashlight = DirectButton(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.4, 0.4, -0.4, 0.4),
            hpr=LVecBase3f(0, 0, 0),
            image='chapter1/flashlight.png',
            pos=LPoint3f(0.39, 0, -0.39),
            sortOrder=201,
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            image_scale=LVecBase3f(0.4, 0, 0.4),
            image_pos=LPoint3f(0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["chapter1_flashlight"],
            pressEffect=1,
        )
        self.btnFlashlight.setTransparency(1)

        self.btnTelephone = DirectButton(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.4, 0.4, -0.4, 0.4),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.625, 0, -0.125),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["chapter1_telephone"],
            pressEffect=1,
        )
        self.btnTelephone.setTransparency(0)

        self.btnDoor = DirectButton(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.5, 0.5, -2.0, 2.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.75, 0, -0.125),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["chapter1_door"],
            pressEffect=1,
        )
        self.btnDoor.setTransparency(0)

        self.ringRing = DirectFrame(
            frameColor=(1.0, 1.0, 1.0, 0.0),
            frameSize=(-0.1, 0.1, -0.1, 0.1),
            hpr=LVecBase3f(0, 0, 0),
            image='chapter1/ringRing.png',
            pos=LPoint3f(0.5, 0, -0.025),
            image_scale=LVecBase3f(0.1, 1, 0.1),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.ringRing.setTransparency(1)
コード例 #18
0
    def __init__(self, rootParent=None):
        self.background = loader.load_model("assets/models/highscoreBack.bam")
        self.background.reparent_to(render)

        x = -0.8
        y = 0.8

        xShift = 0.15
        yShift = -0.15

        lb = base.leaderboard.leaderboard()

        self.lbl1 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='1 - {} : {}'.format(lb[0][0], lb[0][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl1.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl2 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='2 - {} : {}'.format(lb[1][0], lb[1][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl2.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl3 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='3 - {} : {}'.format(lb[2][0], lb[2][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl3.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl4 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='4 - {} : {}'.format(lb[3][0], lb[3][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl4.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl5 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='5 - {} : {}'.format(lb[4][0], lb[4][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl5.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl6 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='6 - {} : {}'.format(lb[5][0], lb[5][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl6.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl7 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='7 - {} : {}'.format(lb[6][0], lb[6][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl7.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl8 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='8 - {} : {}'.format(lb[7][0], lb[7][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl8.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl9 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='9 - {} : {}'.format(lb[8][0], lb[8][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl9.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl10 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='10 - {} : {}'.format(lb[9][0], lb[9][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl10.setTransparency(0)

        credits = '''
            hendrik-jan - Lead design & Audio
            tizilogic - Procedural Generation
            fireclaw - Graphics
            rdb - Fireworks
        '''
        self.credits = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text=credits,
            text_align=0,  #TextNode.A_left,
            text_scale=(0.5, 0.5),
            text_pos=(-4, 4),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.credits.reparent_to(base.a2dBottomLeft)

        self.wait = 0.3
        self.task = base.task_mgr.add(self.update)
コード例 #19
0
ファイル: Chat.py プロジェクト: fireclawthefox/AnkandoraLight
    def __init__(self, rootParent=None):
        
        self.frmChat = DirectFrame(
            frameColor=(0.25, 0.25, 0.25, 1.0),
            frameSize=(-0.4, 0.4, -1.25, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmChat.setTransparency(0)

        self.frmMessages = DirectScrolledFrame(
            borderWidth=(0.005, 0.005),
            canvasSize=(-0.38, 0.34, -1.2, 0.0),
            frameColor=(1, 1, 1, 1),
            frameSize=(-0.38, 0.38, -1.0, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.1),
            relief=3,
            scrollBarWidth=0.03,
            state='normal',
            horizontalScroll_borderWidth=(0.01, 0.01),
            horizontalScroll_frameSize=(-0.05, 0.05, -0.015, 0.015),
            horizontalScroll_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_pos=LPoint3f(0, 0, 0),
            horizontalScroll_decButton_borderWidth=(0.01, 0.01),
            horizontalScroll_decButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_decButton_pos=LPoint3f(0, 0, 0),
            horizontalScroll_incButton_borderWidth=(0.01, 0.01),
            horizontalScroll_incButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_incButton_pos=LPoint3f(0, 0, 0),
            horizontalScroll_thumb_borderWidth=(0.01, 0.01),
            horizontalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_thumb_pos=LPoint3f(0, 0, 0),
            verticalScroll_borderWidth=(0.01, 0.01),
            verticalScroll_frameSize=(-0.015, 0.015, -0.05, 0.05),
            verticalScroll_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_pos=LPoint3f(0, 0, 0),
            verticalScroll_decButton_borderWidth=(0.01, 0.01),
            verticalScroll_decButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_decButton_pos=LPoint3f(0.36, 0, -0.02),
            verticalScroll_incButton_borderWidth=(0.01, 0.01),
            verticalScroll_incButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_incButton_pos=LPoint3f(0.36, 0, -0.98),
            verticalScroll_thumb_borderWidth=(0.01, 0.01),
            verticalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_thumb_pos=LPoint3f(0.36, 0, -0.418625),
            parent=self.frmChat,
        )
        self.frmMessages.setTransparency(0)

        self.txtMessage = DirectEntry(
            borderWidth=(0.005, 0.005),
            frameColor=(1.0, 1.0, 1.0, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            overflow=1,
            pos=LPoint3f(-0.375, 0, -1.195),
            relief=3,
            scale=LVecBase3f(0.045, 0.045, 0.045),
            width=14.0,
            text_align=TextNode.A_left,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmChat,
        )
        self.txtMessage.setTransparency(0)

        self.btnSend = DirectButton(
            frameColor=(0.0, 0.0, 0.0, 0.0),
            frameSize=(-0.4, 0.4, -0.4, 0.4),
            hpr=LVecBase3f(0, 0, 0),
            image='assets/chat/ChatSend.png',
            pos=LPoint3f(0.33, 0, -1.18),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            image_scale=LVecBase3f(0.4, 1, 0.4),
            image_pos=LPoint3f(0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmChat,
            command=base.messenger.send,
            extraArgs=["sendMessage"],
        )
        self.btnSend.setTransparency(1)

        self.btnToggleChat = DirectButton(
            frameColor=(0.15, 0.15, 0.15, 1.0),
            frameSize=(-0.4, 0.4, -0.02, 0.05),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.05),
            relief=1,
            scale=LVecBase3f(1, 1, 1),
            text='Toggle Chat',
            text_align=TextNode.A_center,
            text_scale=(0.05, 0.05),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.8, 0.8, 0.8, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["toggleChat"],
        )
        self.btnToggleChat.setTransparency(0)
コード例 #20
0
# linearized in reverse order of axes. So as we have an [x, y, c] array here,
# the data will be linearized in the order seen above, monotonically ascending.
# This can be seen if you PTAUchar(a_np).get_subdata(0, 18). First all c-columns
# in x=0 get written in order of y, then all in x=1.
# However, Texture.set_ram_image will delinearize the data slightly different.
# c-column order can be manipulated with an additional argument to
# set_ram_image_as, but x/y-wise, it will first write along the x-axis in y=0,
# then y=1 and so on.
# So to preserve x/y coordinate equality between numpy and Panda3D, the array
# first has to be transposed, swapping its x and y axes. That in turn seems to
# somehow "dirty" the returned array, making it necessary to copy it first.
# So basically you have the choice between one additional copy of the whole
# array that you're transferring, or you think of numpy arrays as [y, x, c]
# images.

a_np_t = a_np.transpose(1, 0, 2).copy()
a_p3d = PTAUchar(a_np_t)

tex = Texture()
# Note that if the Texture's dimentions and component type don't match that of
# your numpy array, you're gonna have a bad time.
tex.setup_2d_texture(2, 3, Texture.T_unsigned_byte, Texture.F_rgb)
tex.set_ram_image_as(a_p3d, 'RGB')

# Now let's see the data that we've just moved around.
p = LVecBase4f()
for x in range(2):
    for y in range(3):
        tex.peek().fetch_pixel(p, x, y)
        print(x, y, p * 256, a_np[x, y])
コード例 #21
0
ファイル: MetaData.py プロジェクト: tsp-team/panda3d
from panda3d.core import LVecBase3f, LVecBase2f, LVecBase4f, CKeyValues

from bsp.leveleditor.fgdtools import FgdEntityProperty
from bsp.leveleditor import LEUtils

MetaDataExclusions = ['id', 'classname', 'visgroup']

# (type, unserialize func, serialize func, default value)
MetaDataType = {
    'string': (str, str, str, ""),
    'decal': (str, str, str, ""),
    'sound': (str, str, str, ""),
    'float': (float, float, str, 0.0),
    'color255': (LVecBase4f, CKeyValues.to4f, CKeyValues.toString,
                 LVecBase4f(255, 255, 255, 255)),
    'vec3':
    (LVecBase3f, CKeyValues.to3f, CKeyValues.toString, LVecBase3f(0, 0, 0)),
    'vec4':
    (LVecBase4f, CKeyValues.to4f, CKeyValues.toString, LVecBase4f(0, 0, 0, 0)),
    'vec2':
    (LVecBase2f, CKeyValues.to2f, CKeyValues.toString, LVecBase2f(0, 0)),
    'integer': (int, int, str, 0),
    'choices': (int, int, str, 0),
    'flags': (int, int, str, 0),
    'studio': (str, str, str, ""),
    'target_source': (str, str, str, ""),
    'target_destination': (str, str, str, ""),
    'target_destinations': (str, str, str, ""),
    'boolean': (bool, LEUtils.strToBool, LEUtils.boolToStr, False)
}
コード例 #22
0
ファイル: BamGlobals.py プロジェクト: darktohka/p3bamboo
def read_vec4(di):
    return LVecBase4f(di.get_float32(), di.get_float32(), di.get_float32(), di.get_float32())
コード例 #23
0
    def __init__(self, rootParent=None):

        self.lblDescription = DirectFrame(
            frameColor=(1.0, 1.0, 1.0, 0.0),
            frameSize=(-0.75, 0.75, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            image='./assets/quest/QuestBG.png',
            pos=LPoint3f(0, 0, 0),
            image_scale=LVecBase3f(0.75, 1, 0.8),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.lblDescription.setTransparency(2)

        self.lblHeader = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.59),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Quest',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblHeader.setTransparency(1)

        self.lblQuestDesc = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, 0.525),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Quest description part 1',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblQuestDesc.setTransparency(1)

        self.lblControl = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, -0.25),
            scale=LVecBase3f(0.08, 0.08, 0.08),
            text='Controls',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblControl.setTransparency(1)

        self.lblControlDesc = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, -0.315),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text="If it's your turn, click the dice button or hit D",
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblControlDesc.setTransparency(1)

        self.btnClose = DirectButton(
            frameColor=(0.8, 0.8, 0.8, 0.75),
            frameSize=(-1.288, 1.387, -0.213, 0.825),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.65),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Close',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
            pressEffect=1,
        )
        self.btnClose.setTransparency(0)
コード例 #24
0
ファイル: endscreen.py プロジェクト: fireclawthefox/pyweek31
    def __init__(self, rootParent=None):

        self.frmBack = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 1.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmBack.setTransparency(0)

        self.pg671 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.893750011920929, 1.0187499523162842,
                       -0.11250001192092896, 0.7124999761581421),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.5),
            scale=LVecBase3f(0.2, 0.2, 0.2),
            text='END',
            text_align=TextNode.A_center,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg671.setTransparency(0)

        self.lblEnding = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.025, 0, -0.675),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text="You've found ending x/x",
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.lblEnding.setTransparency(0)

        self.pg6340 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.893750011920929, 1.0187499523162842,
                       -0.11250001192092896, 0.7124999761581421),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.125, 0, 0.65),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='the',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg6340.setTransparency(0)

        self.pg1228 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.35),
            scale=LVecBase3f(0.05, 0.1, 0.056),
            text='A Game By',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg1228.setTransparency(0)

        self.pg1785 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.275),
            scale=LVecBase3f(0.08, 0.1, 0.08),
            text='Fireclaw',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg1785.setTransparency(0)

        self.pg4435 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.175),
            scale=LVecBase3f(0.05, 0.1, 0.056),
            text='Music from Jamendo by Golden Antelope',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg4435.setTransparency(0)

        self.pg5320 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.1),
            scale=LVecBase3f(0.05, 0.1, 0.056),
            text='Audio from freesound by reinsamba',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg5320.setTransparency(0)
コード例 #25
0
    def __init__(self, rootParent=None):

        self.pg456 = DirectScrolledList(
            forceHeight=0.1,
            frameSize=(-0.5, 0.5, -0.01, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            numItemsVisible=5,
            pos=LPoint3f(0.025, 0, -0.175),
            state='normal',
            text='Developers',
            decButton_borderWidth=(0.005, 0.005),
            decButton_hpr=LVecBase3f(0, 0, 0),
            decButton_pos=LPoint3f(-0.45, 0, 0.03),
            decButton_state='disabled',
            decButton_text='Prev',
            decButton_text_align=TextNode.A_left,
            decButton_text_scale=(0.05, 0.05),
            decButton_text_pos=(0, 0),
            decButton_text_fg=LVecBase4f(0, 0, 0, 1),
            decButton_text_bg=LVecBase4f(0, 0, 0, 0),
            decButton_text_wordwrap=None,
            incButton_borderWidth=(0.005, 0.005),
            incButton_hpr=LVecBase3f(0, 0, 0),
            incButton_pos=LPoint3f(0.45, 0, 0.03),
            incButton_state='disabled',
            incButton_text='Next',
            incButton_text_align=TextNode.A_right,
            incButton_text_scale=(0.05, 0.05),
            incButton_text_pos=(0, 0),
            incButton_text_fg=LVecBase4f(0, 0, 0, 1),
            incButton_text_bg=LVecBase4f(0, 0, 0, 0),
            incButton_text_wordwrap=None,
            itemFrame_frameColor=(1, 1, 1, 1),
            itemFrame_frameSize=(-0.47, 0.47, -0.5, 0.1),
            itemFrame_hpr=LVecBase3f(0, 0, 0),
            itemFrame_pos=LPoint3f(0, 0, 0.6),
            text_align=TextNode.A_center,
            text_scale=(0.1, 0.1),
            text_pos=(0, 0.015),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.pg456.setTransparency(0)

        self.pg1135 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317,
                       -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Marcic_Admin',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg456,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1135.setTransparency(0)

        self.pg1154 = DirectScrolledListItem(
            frameSize=(-4.831, 4.831, -0.213, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.1),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            state='disabled',
            text='panda3dmastercoder',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg456,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1154.setTransparency(0)

        self.pg456.addItem(self.pg1135)
        self.pg456.addItem(self.pg1154)
コード例 #26
0
ファイル: menu.py プロジェクト: fireclawthefox/pyweek31
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-1, 1, -1, 1),
            hpr=LVecBase3f(0, 0, 0),
            image='menu/background.png',
            pos=LPoint3f(0, 0, 0),
            image_scale=LVecBase3f(1, 1, 1),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.btnStart = DirectButton(
            frameColor=(1.0, 1.0, 0.5, 0.1),
            frameSize=(-1.9, 1.8, -0.6, 0.6),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.46),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Start Game',
            text_align=TextNode.A_center,
            text_scale=(0.42, 0.4),
            text_pos=(0.03, -0.45),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["startGame"],
            pressEffect=1,
        )
        self.btnStart.setTransparency(0)

        self.btnOptions = DirectButton(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-1.825, 1.925, -0.437, 0.85),
            hpr=LVecBase3f(35, -28, 20),
            pos=LPoint3f(0.6, 0, -0.125),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Options',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.7, 0.7, 0.7, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["options"],
            pressEffect=0,
        )
        self.btnOptions.setTransparency(0)

        self.btnExit = DirectButton(
            frameColor=(0.1, 0.7, 0.1, 1.0),
            frameSize=(-1.5249999523162843, 1.6499999523162843,
                       -0.21250001192092896, 0.8250000238418579),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.45, 0, -0.6),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='EXIT',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.9, 0.9, 0.9, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["exit"],
            pressEffect=0,
        )
        self.btnExit.setTransparency(0)
コード例 #27
0
ファイル: main.py プロジェクト: grimfang/owp_ajaw
    def __init__(self):
        ShowBase.__init__(self)
        FSM.__init__(self, "FSM-Game")

        #
        # BASIC APPLICATION CONFIGURATIONS
        #
        self.disableMouse()
        self.setBackgroundColor(0, 0, 0)
        self.camLens.setFov(75)
        self.camLens.setNear(0.8)

        # check if the config file hasn't been created
        base.textWriteSpeed = 0.05
        mute = ConfigVariableBool("audio-mute", False).getValue()
        if mute:
            self.disableAllAudio()
        else:
            self.enableAllAudio()
        particles = ConfigVariableBool("particles-enabled", True).getValue()
        if particles:
            self.enableParticles()
        base.textWriteSpeed = ConfigVariableDouble("text-write-speed",0.05).getValue()
        base.controlType = ConfigVariableString("control-type", "Gamepad").getValue()
        base.mouseSensitivity = ConfigVariableDouble("mouse-sensitivity",1.0).getValue()
        if not os.path.exists(prcFile):
            self.__writeConfig()
            # set window properties
            # clear all properties not previously set
            self.win.clearRejectedProperties()
            # setup new window properties
            props = WindowProperties()
            # Fullscreen
            props.setFullscreen(True)
            # window icon
            print props.hasIconFilename()
            props.setIconFilename(windowicon)
            # get the displays width and height
            w = self.pipe.getDisplayWidth()
            h = self.pipe.getDisplayHeight()
            # set the window size to the screen resolution
            props.setSize(w, h)
            # request the new properties
            self.win.requestProperties(props)
        atexit.register(self.__writeConfig)

        # enable collision handling
        base.cTrav = CollisionTraverser("base collision traverser")
        base.pusher = CollisionHandlerPusher()
        base.pusher.addInPattern('%fn-in-%in')
        base.pusher.addOutPattern('%fn-out-%in')

        self.menu = Menu()
        self.options = OptionsMenu()

        self.musicMenu = loader.loadMusic("MayanJingle6_Menu.ogg")
        self.musicMenu.setLoop(True)

        cm = CardMaker("menuFade")
        cm.setFrameFullscreenQuad()
        self.menuCoverFade = NodePath(cm.generate())
        self.menuCoverFade.setTransparency(TransparencyAttrib.MAlpha)
        self.menuCoverFade.setBin("fixed", 1000)
        self.menuCoverFade.reparentTo(render2d)
        self.menuCoverFade.hide()
        self.menuCoverFadeOutInterval = Sequence(
            Func(self.menuCoverFade.show),
            LerpColorScaleInterval(
                self.menuCoverFade,
                1,
                LVecBase4f(0.0,0.0,0.0,1.0),
                LVecBase4f(0.0,0.0,0.0,0.0)),
            Func(self.menuCoverFade.hide))
        self.menuCoverFadeInInterval = Sequence(
            Func(self.menuCoverFade.show),
            LerpColorScaleInterval(
                self.menuCoverFade,
                1,
                LVecBase4f(0.0,0.0,0.0,0.0),
                LVecBase4f(0.0,0.0,0.0,1.0)),
            Func(self.menuCoverFade.hide))
        self.lerpAudioFadeOut = LerpFunc(
            self.audioFade,
            fromData=1.0,
            toData=0.0,
            duration=0.25,
            extraArgs=[self.musicMenu])
        self.fadeMusicOut = Sequence(
            self.lerpAudioFadeOut,
            Func(self.musicMenu.stop))
        self.lerpAudioFadeIn = LerpFunc(
            self.audioFade,
            fromData=0.0,
            toData=1.0,
            duration=1,
            extraArgs=[self.musicMenu])
        self.fadeMusicIn = Sequence(
                Func(self.musicMenu.play),
                self.lerpAudioFadeIn)

        self.seqFade = None
        self.acceptAll()

        self.request("Intro")
コード例 #28
0
ファイル: gameScreen.py プロジェクト: fireclawthefox/pyweek31
    def __init__(self, rootParent=None):
        
        self.frmInventory = DirectFrame(
            frameColor=(0.2, 0.2, 0.2, 1.0),
            frameSize=(-0.3, 0.3, -0.5, 0.5),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, 0.2),
            parent=rootParent,
        )
        self.frmInventory.setTransparency(0)

        self.frmContent = DirectScrolledFrame(
            canvasSize=(-0.8, 0.8, -0.8, 0.8),
            frameColor=(0.2, 0.2, 0.2, 1.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.475, 0, 0.1),
            scrollBarWidth=0.08,
            state='normal',
            horizontalScroll_borderWidth=(0.01, 0.01),
            horizontalScroll_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_pos=LPoint3f(0, 0, 0),
            horizontalScroll_decButton_borderWidth=(0.01, 0.01),
            horizontalScroll_decButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_decButton_pos=LPoint3f(0, 0, 0),
            horizontalScroll_incButton_borderWidth=(0.01, 0.01),
            horizontalScroll_incButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_incButton_pos=LPoint3f(0, 0, 0),
            horizontalScroll_thumb_borderWidth=(0.01, 0.01),
            horizontalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_thumb_pos=LPoint3f(0, 0, 0),
            verticalScroll_borderWidth=(0.01, 0.01),
            verticalScroll_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_pos=LPoint3f(0, 0, 0),
            verticalScroll_decButton_borderWidth=(0.01, 0.01),
            verticalScroll_decButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_decButton_pos=LPoint3f(0, 0, 0),
            verticalScroll_incButton_borderWidth=(0.01, 0.01),
            verticalScroll_incButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_incButton_pos=LPoint3f(0, 0, 0),
            verticalScroll_thumb_borderWidth=(0.01, 0.01),
            verticalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_thumb_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmContent.setTransparency(1)

        self.btnQuit = DirectButton(
            frameSize=(-3.0, 3.0, -0.3, 0.9),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, -0.85),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Quit',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["quitGame"],
            pressEffect=1,
        )
        self.btnQuit.setTransparency(0)

        self.btnAudioToggle = DirectButton(
            frameSize=(-3.0, 3.0, -0.3, 0.9),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, -0.7),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Audio On',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["toggleAudio"],
            pressEffect=1,
        )
        self.btnAudioToggle.setTransparency(0)

        self.frmBorderOverlay = DirectFrame(
            frameColor=(1.0, 1.0, 1.0, 0.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            image='gameScreen/border.png',
            pos=LPoint3f(-0.475, 0, 0.1),
            image_scale=LVecBase3f(0.8, 1, 0.8),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmBorderOverlay.setTransparency(1)

        self.lblInventory = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, 0.775),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Inventory',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.9, 0.9, 0.9, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lblInventory.setTransparency(0)

        self.lblStory = DirectLabel(
            frameSize=(-0.125, 12.0, -0.313, 0.925),
            hpr=LVecBase3f(0, 0, 0),
            pad=(0.2, 0.2),
            pos=LPoint3f(-1.26, 0, -0.845),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            text_align=TextNode.A_left,
            text_scale=(0.4, 0.4),
            text_pos=(0.0, 0.4),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=29.8,
            parent=rootParent,
        )
        self.lblStory.setTransparency(0)

        self.btnContinue = DirectButton(
            frameSize=(-1.8, 1.8, -0.3, 0.9),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.145, 0, -0.845),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Cont.',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["story_continue"],
            pressEffect=1,
        )
        self.btnContinue.setTransparency(0)

        self.frmFadeOverlay = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 1.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.475, 0, 0.1),
            parent=rootParent,
        )
        self.frmFadeOverlay.setTransparency(1)
コード例 #29
0
ファイル: main.py プロジェクト: grimfang/owp_ajaw
    def enterIntro(self):
        helper.hide_cursor()
        cm = CardMaker("fade")
        cm.setFrameFullscreenQuad()
        self.gfLogo = NodePath(cm.generate())
        self.gfLogo.setTransparency(TransparencyAttrib.MAlpha)
        gfLogotex = loader.loadTexture('GrimFangLogo.png')
        gfLogots = TextureStage('gfLogoTS')
        gfLogots.setMode(TextureStage.MReplace)
        self.gfLogo.setTexture(gfLogots, gfLogotex)
        self.gfLogo.setY(-50)
        self.gfLogo.reparentTo(render2d)
        self.gfLogo.hide()

        self.pandaLogo = NodePath(cm.generate())
        self.pandaLogo.setTransparency(TransparencyAttrib.MAlpha)
        pandaLogotex = loader.loadTexture('Panda3DLogo.png')
        pandaLogots = TextureStage('pandaLogoTS')
        pandaLogots.setMode(TextureStage.MReplace)
        self.pandaLogo.setTexture(pandaLogots, pandaLogotex)
        self.pandaLogo.setY(-50)
        self.pandaLogo.reparentTo(render2d)
        self.pandaLogo.hide()

        gfFadeInInterval = LerpColorScaleInterval(
            self.gfLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,1.0),
            LVecBase4f(0.0,0.0,0.0,0.0))

        gfFadeOutInterval = LerpColorScaleInterval(
            self.gfLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,0.0),
            LVecBase4f(0.0,0.0,0.0,1.0))

        p3dFadeInInterval = LerpColorScaleInterval(
            self.pandaLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,1.0),
            LVecBase4f(0.0,0.0,0.0,0.0))

        p3dFadeOutInterval = LerpColorScaleInterval(
            self.pandaLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,0.0),
            LVecBase4f(0.0,0.0,0.0,1.0))

        self.fadeInOut = Sequence(
            Func(self.pandaLogo.show),
            p3dFadeInInterval,
            Wait(1.0),
            p3dFadeOutInterval,
            Wait(0.5),
            Func(self.pandaLogo.hide),
            Func(self.gfLogo.show),
            gfFadeInInterval,
            Wait(1.0),
            gfFadeOutInterval,
            Wait(0.5),
            Func(self.gfLogo.hide),
            Func(self.request, "Menu"),
            Func(helper.show_cursor),
            name="fadeInOut")
        self.fadeInOut.start()
コード例 #30
0
ファイル: main.py プロジェクト: grimfang/pyweek21
 def createFadeOut(logo):
     return LerpColorScaleInterval(logo, 2,
                                   LVecBase4f(0.0, 0.0, 0.0, 0.0),
                                   LVecBase4f(0.0, 0.0, 0.0, 1.0))