示例#1
0
文件: GeomObjects.py 项目: crempp/psg
 def __init__(self, parent, entity, foot=1):
     self.entity = entity
     self._moveRadCircleNP = NodePath("Movement Radius Node")
     self._moveLine = LineSegs()
     self._moveLineNP = NodePath("Movement Direction Line Node")
     self._moveZLine = LineSegs()
     self._moveZLineNP = NodePath("Movement Z Line Node")
     self._moveZFootNP = NodePath("Movement Z Foot Node")
     self._moveFootCircle = LineSegs()
     self._moveFootCircleNP = NodePath("Movement Foot Circle Node")
     self._attackRadCircle = LineSegs()
     self._attackRadCircleNP = NodePath("Attack Radius Node")
     self._np = NodePath("Movement Node")
     self.attackables = []
     Event.Dispatcher().register(self, 'E_Key_ZUp', self.onZChange)
     Event.Dispatcher().register(self, 'E_Key_ZDown', self.onZChange)
     Event.Dispatcher().register(self, 'E_Key_ZUp-up', self.onZChange)
     Event.Dispatcher().register(self, 'E_Key_ZDown-up', self.onZChange)
     self.aaLevel = int(GameSettings().getSetting('ANTIALIAS'))
     self.parent = parent
     self.start = Vec3(0, 0, 0)
     self.moveRad = entity.moveRad
     self.footRad = foot
     self.attackRad = entity.attackRad
     self.plane = Plane(Vec3(0, 0, 1), Point3(0, 0, 0))
     self.draw()
     self._np.reparentTo(self.parent)
     if self.aaLevel > 0:
         self._np.setAntialias(AntialiasAttrib.MLine, self.aaLevel)
     taskMgr.add(self.updateMovePos, 'Movement Indicator Update Task')
示例#2
0
文件: GeomObjects.py 项目: crempp/psg
    def draw(self):
        # Draw attack radius
        attackRadLine = LineSegs()
        attackRadLine.setThickness(1)
        attackRadLine.setColor(self._color)
        attackRadLine.moveTo(self.attackRad, 0, 0)
        for i in range(self._EDGES + 1):
            newX = (self.attackRad * math.cos((2 * math.pi / self._EDGES) * i))
            newY = (self.attackRad * math.sin((2 * math.pi / self._EDGES) * i))
            attackRadLine.drawTo(newX, newY, 0)
        attackRadGeom = attackRadLine.create()
        self._attackRadCircleNP = NodePath(attackRadGeom)
        self._attackRadCircleNP.reparentTo(self._np)

        # Draw foot circle
        self._footCircle.setThickness(1)
        self._footCircle.setColor(self._color)
        self._footCircle.moveTo(self.footRad, 0, 0)
        for i in range(self._EDGES):
            newX = (self.footRad * math.cos((2 * math.pi / self._EDGES) * i))
            newY = (self.footRad * math.sin((2 * math.pi / self._EDGES) * i))
            self._footCircle.drawTo(newX, newY, 0)
        self._footCircle.drawTo(self.footRad, 0, 0)
        footCircleGeom = self._footCircle.create()
        self._footCircleNP = NodePath(footCircleGeom)
        self._footCircleNP.reparentTo(self._np)
示例#3
0
def fill(filler, frame, BGColor, lineThick, bevel=None, arrowhead=None):
    h = frame[3] - frame[2]
    incr = 10 / float(base.win.getProperties().getYSize())
    bg = LineSegs()
    bg.setColor(BGColor)
    bg.setThickness(lineThick)
    for i in range(1, int(h * 33)):
        if bevel and arrowhead:
            filler(bg, [
                frame[0] + incr * i, frame[1] - incr * i, frame[2] + incr * i,
                frame[3] - incr * i
            ], bevel, arrowhead)
        elif bevel:
            filler(bg, [
                frame[0] + incr * i, frame[1] - incr * i, frame[2] + incr * i,
                frame[3] - incr * i
            ], bevel)
        elif arrowhead:
            filler(bg, [
                frame[0] + incr * i, frame[1] - incr * i, frame[2] + incr * i,
                frame[3] - incr * i
            ], arrowhead)
        else:
            filler(bg, [
                frame[0] + incr * i, frame[1] - incr * i, frame[2] + incr * i,
                frame[3] - incr * i
            ])
    fnp = NodePath(bg.create())
    fnp.setBin("fixed", 10)
    return fnp
示例#4
0
    def __init__( self, *args, **kwargs ):
        colour = kwargs.pop( 'colour', (1, 1, 1, .2) )
        p3d.SingleTask.__init__( self, *args, **kwargs )

        # Create a card maker
        cm = CardMaker( self.name )
        cm.setFrame( 0, 1, 0, 1 )
        
        # Init the node path, wrapping the card maker to make a rectangle
        NodePath.__init__( self, cm.generate() )
        self.setColor( colour )
        self.setTransparency( 1 )
        self.reparentTo( self.root2d )
        self.hide()
        
        # Create the rectangle border
        ls = LineSegs()
        ls.moveTo( 0, 0, 0 )
        ls.drawTo( 1, 0, 0 )
        ls.drawTo( 1, 0, 1 )
        ls.drawTo( 0, 0, 1 )
        ls.drawTo( 0, 0, 0 )
        
        # Attach border to rectangle
        self.attachNewNode( ls.create() )
示例#5
0
    def __init__(self, *args, **kwargs):
        ViewTowers.__init__(self, *args, **kwargs)

        # ignore keys set by viewer
        for key in self.getAllAccepting():
            if key in ("s", "escape"):
                continue
            self.ignore(key)
        self.permanent_events = self.getAllAccepting()

        # global variables
        self.text_bg = (1, 1, 1, 0.7)
        self.font = self.loader.loadFont('cmr12.egg')
        self.question = (
            "Use the mouse to indicate the direction that "
            "the tower will fall.")
        self.feedback_time = 3.0
        self.buffer_time = 0.75

        # create text
        self.create_all_text()

        # create direction line
        self.line = LineSegs()
        self.line_node = None
        self.angle = None

        alight = AmbientLight('alight3')
        alight.setColor((0.8, 0.8, 0.8, 1))
        self.line_light = self.lights.attachNewNode(alight)
示例#6
0
def createBox(n):
    boxpoints = []
    np1 = (-26, -26, 0)
    np2 = (-26, 26, 0)
    np3 = (26, 26, 0)
    np4 = (26, -26, 0)
    boxpoints.append(np1)
    boxpoints.append(np2)
    boxpoints.append(np3)
    boxpoints.append(np4)
    boxpoints.append(np1)
    boxsegs = LineSegs()
    boxsegs.setThickness(2.0)
    boxsegs.setColor(Vec4(0.002, 0.002, 0.002, 0.18))
    boxsegs.moveTo(boxpoints[0])
    for p in boxpoints[1:]:
        boxsegs.drawTo(p)
    gridPoints = []
    l = float(52 / n)
    i = 1
    while i < (n):
        np = (-26, (-26 + (l * i)), 0)
        np2 = (26, (-26 + (l * i)), 0)
        np3 = ((-26 + (l * i)), -26, 0)
        np4 = ((-26 + (l * i)), 26, 0)
        gridPoints.append((np, np2))
        gridPoints.append((np3, np4))
        i = i + 1
    for p in gridPoints:
        boxsegs.moveTo(p[0])
        boxsegs.drawTo(p[1])
    return boxsegs.create()
示例#7
0
 def renderPath(self, path, color):
     segs = LineSegs()
     segs.setThickness(1.0)
     segs.setColor(color)
     segs.moveTo(Point3(path[0].getX(), path[0].getY(), 0))
     for i in range(1, len(path)):
         segs.drawTo(Point3(path[i].getX(), path[i].getY(), 0))
     return segs.create()
示例#8
0
文件: GeomObjects.py 项目: crempp/psg
    def __init__(self, parent, entity, foot=1):
        self.entity = entity
        self.pos = entity.pos
        self.attackRad = entity.attackRad
        self.footRad = foot
        self._footCircle = LineSegs()
        self._footCircleNP = NodePath("Movement Foot Circle Node")
        self._attackRadCircle = LineSegs()
        self._attackRadCircleNP = NodePath("Attack Radius Node")
        self._np = NodePath("Movement Node")
        self.attackables = Entity.EntityManager().getEntitiesWithin(
            self.pos, self.attackRad)

        for e in self.attackables:
            if isinstance(
                    e, Entity.EntityShip
            ) and e != self.entity and e.owner != self.entity.owner:
                e.representation.setAttackable()
示例#9
0
 def drawBorder(self, bounds, color):
     LS = LineSegs()
     LS.setColor(*color)
     LS.moveTo(bounds[0], 0, bounds[2])
     LS.drawTo(bounds[0], 0, bounds[3])
     LS.drawTo(bounds[1], 0, bounds[3])
     LS.drawTo(bounds[1], 0, bounds[2])
     LS.drawTo(bounds[0], 0, bounds[2])
     return LS.create()
 def drawLineToNeighbors(self):
     ls = LineSegs()
     ls.setThickness(1.0)
     for neighbor in self.neighbors:
         ls.setColor(1, 1, 1, 1)
         ls.moveTo(self.getPos(render))
         ls.drawTo(neighbor.getPos(render))
     self.np = NodePath(ls.create("Neighbor Line Segment"))
     self.np.reparentTo(render)
示例#11
0
def createVisibleSegments(environment, color, segments):
    global extraSegmentsToDisplayNP

    if extraSegmentsToDisplayNP != None:
        extraSegmentsToDisplayNP.removeNode()

    visibleSegs = LineSegs()
    environment.produceRenderingOfLines(visibleSegs, color, segments)
    extraSegmentsToDisplayNP = render.attachNewNode(visibleSegs.create())
示例#12
0
 def __createLine(self, length=1, color=(1, 1, 1, 1), endColor=None):
     LS = LineSegs()
     LS.setColor(*color)
     LS.moveTo(0, 0, 0)
     LS.drawTo(length * 1, 0, 0)
     node = LS.create()
     if endColor:
         LS.setVertexColor(1, *endColor)
     return node
示例#13
0
 def drawBestPath(self):
     if self.bestPath != None:
         ls = LineSegs()
         ls.setThickness(10.0)
         for i in range(len(self.bestPath) - 1):
             ls.setColor(0, 0, 1, 1)
             ls.moveTo(self.bestPath[i].getPos())
             ls.drawTo(self.bestPath[i + 1].getPos())
             np = NodePath(ls.create("aoeu"))
             np.reparentTo(render)
示例#14
0
def sepLine(frame, styles):
    style = styles['menu separator']
    ls = LineSegs('sepLine')
    ls.setColor(style['color'])
    ls.setThickness(style['thick'])
    hpad = (frame[1] - frame[0]) * .2
    hh = frame[3] + (frame[3] - frame[2])  #/2
    ls.moveTo(frame[0] + hpad, 0, hh)
    ls.drawTo(frame[1] - hpad, 0, hh)
    return ls.create()
 def __init__(self, parent, thickness, color, lineSpawnDist=0.01):
     self.points = []
     self.parent = parent
     self.thickness = thickness
     self.color = color
     self.lineNode = None
     self.lineDrawer = LineSegs()
     self.lineDrawer.setThickness(thickness)
     self.lineSpawnDist = lineSpawnDist
     self.currentPoint = None
     self.startPoint = None
     self.redraw()
示例#16
0
 def produceRending(self):
     segs = LineSegs()
     self.produceRenderingOfLines(segs, Vec4(1, 1, 1, 1),
                                  self.boundaryWalls)
     self.produceRenderingOfLines(segs, Vec4(1, 1, 1, 1),
                                  self.interiorWalls)
     self.produceRenderingOfLines(segs, Vec4(1, 1, 1, 1),
                                  self.obstaclesWalls)
     self.produceRenderingOfPosition(segs, Vec4(1, 0, 0, 1),
                                     self.shooterPos, 5)
     self.produceRenderingOfPosition(segs, Vec4(0, 1, 0, 1), self.end, 5)
     self.produceRenderingOfPosition(segs, Vec4(0, 0, 1, 1), self.start, 5)
     return segs.create()
 def __init__(self,
              origin,
              radius,
              thickness=1.0,
              color=(0.0, 1.0, 0.0, 1.0)):
     super(GreatArcs, self).__init__(origin, radius)
     self.thickness = thickness
     self.color = color
     self.vertex_count = 0
     self.vertices = []
     self.line_seqs = LineSegs()
     self.line_seqs.setThickness(self.thickness)
     (r, g, b, a) = self.color
     self.line_seqs.setColor(Vec4(r, g, b, a))
示例#18
0
	def __init__(self, listConsideration=[]):
		
		z = -0.05
		self.plane = Plane(Vec3(0, 0, 1), Point3(0, 0, z)) 
		cm = CardMaker("blah") 
		cm.setFrame(-100, 100, -100, 100) 
		render.attachNewNode(cm.generate()).lookAt(0, 0, -1) 
		
		#Create a selection window using cardmaker 
		#We will use the setScale function to dynamically scale the quad to the appropriate size in UpdateSelRect 
		temp = CardMaker('') 
		temp.setFrame(0, 1, 0, 1) 
		#self.npSelRect is the actual selection rectangle that we dynamically hide/unhide and change size 
		self.npSelRect = render2d.attachNewNode(temp.generate()) 
		self.npSelRect.setColor(0.5,1,0,.3) 
		self.npSelRect.setTransparency(1) 
		self.npSelRect.hide() 
		LS = LineSegs() 
		LS.setColor(0.5,1,0,1)
		LS.moveTo(0,0,0) 
		LS.drawTo(1,0,0) 
		LS.drawTo(1,0,1) 
		LS.drawTo(0,0,1) 
		LS.drawTo(0,0,0) 
		self.npSelRect.attachNewNode(LS.create()) 
		self.listConsideration = listConsideration 
		self.listSelected = [] 
		self.listLastSelected = [] 
		 
		self.pt2InitialMousePos = (-12, -12) 
		self.pt2LastMousePos = (-12, -12) 
		 
		####----Used to differentiate between group selections and point selections 
		#self.booMouseMoved  = False 
		self.fFovh, self.fFovv = base.camLens.getFov() 
		 
		####--Used to control how frequently update_rect is updated; 
		self.fTimeLastUpdateSelRect = 0 
		self.fTimeLastUpdateSelected = 0 
		self.UpdateTimeSelRect = 0.015 
		self.UpdateTimeSelected = 0.015 
		 
		####------Register the left-mouse-button to start selecting 
		self.accept("mouse1", self.OnStartSelect) 
		self.accept("control-mouse1", self.OnStartSelect) 
		self.accept("mouse1-up", self.OnStopSelect) 
		self.taskUpdateSelRect = 0 
		
		####------otherThings
		self.booSelecting = False
示例#19
0
 def makeArc(angleDegrees=360, numSteps=16, color=Vec4(1, 1, 1, 1)):
     ls = LineSegs()
     angleRadians = deg2Rad(angleDegrees)
     for i in range(numSteps + 1):
         a = angleRadians * i / numSteps
         y = math.sin(a)
         x = math.cos(a)
         ls.drawTo(x, y, 0)
     node = ls.create()
     if color != Vec4(1, 1, 1, 1):
         for i in range(numSteps + 1):
             ls.setVertexColor(i, color)
         pass
     return NodePath(node)
示例#20
0
def makeArc(initial_x, initial_y, angleDegrees=360, numSteps=16):
    ls = LineSegs()

    angleRadians = deg2Rad(angleDegrees)

    for i in range(numSteps + 1):
        a = angleRadians * i / numSteps
        y = initial_y + 0.01 * math.sin(a)
        x = initial_x + 0.01 * math.cos(a)
        ls.setThickness(3)
        ls.setColor(0, 0, 0, 1)
        ls.drawTo(x, 0, y)

    node = ls.create()
    return NodePath(node)
示例#21
0
def rectangle(frame,
              lineThick=2,
              color=(1, 1, 1, 1),
              brdrColor=(1, 1, 1, 1),
              BGColor=None):
    ls = LineSegs()
    ls.setThickness(lineThick)
    if brdrColor != 'transparent':
        ls.setColor(brdrColor)
        rectangleLine(ls, frame)
    else:
        ls.setColor(color)
    a = ls.create()
    if BGColor:
        fill(rectangleLine, frame, BGColor, lineThick).reparentTo(NodePath(a))
    return a
    def attach_to(self, render):
        '''creates Panda3D representation that can be attached to render
		this function is mainly used inside Render class and its derivatives and
		user not need to worry to call it'''
        new_line_seqs = LineSegs()
        new_line_seqs.setThickness(self.thickness)
        (r, g, b, a) = self.color
        new_line_seqs.setColor(Vec4(r, g, b, a))
        (x, y, z) = self.points[0]
        new_line_seqs.moveTo(Point3(x, y, z))
        for i in xrange(1, len(self.points)):
            (x, y, z) = self.points[i]
            new_line_seqs.drawTo(Point3(x, y, z))
        lines = NodePath(new_line_seqs.create())
        lines.reparentTo(render.render)
        return lines
示例#23
0
def HCtest():
    #    bounds = [(-10, -16, 0), (-10, 11, 0), (17, 11, 0), (17, -16, 0)]
    bounds = [(0, -3, 0), (0, 16, 0), (19, 16, 0), (19, -3, 0)]
    finalHCPoints = createHilbertCurve(4, bounds)
    boxsegs = LineSegs()
    boxsegs.setThickness(2.0)
    boxsegs.setColor(Vec4(1, 1, 1, 1))
    boxsegs.moveTo(bounds[0])
    boxsegs.drawTo(bounds[1])
    boxsegs.drawTo(bounds[2])
    boxsegs.drawTo(bounds[3])
    boxsegs.drawTo(bounds[0])
    boxsegs.moveTo(finalHCPoints[0])
    for p in finalHCPoints[1:]:
        boxsegs.drawTo(p)
    return boxsegs.create()
示例#24
0
def xBox(frame,
         lineThick=2,
         color=(1, 1, 1, 1),
         brdrColor=(1, 1, 1, 1),
         BGColor=None):
    w = frame[1] - frame[0]
    h = frame[3] - frame[2]
    bx = LineSegs('xbox')
    rect(bx, (frame[1] - h / 4, frame[1] - 3 * h / 4, frame[2] + h / 4,
              frame[3] - h / 4))
    ex(bx, (frame[1] - h / 4, frame[1] - 3 * h / 4, frame[2] + h / 4,
            frame[3] - h / 4))
    box = bx.create()
    if BGColor:
        fill(rectangleLine, frame, BGColor,
             lineThick).reparentTo(NodePath(box))
    return box
示例#25
0
def bevelBG(frame, bevel=.35, lineThick=2, color=(1, 1, 1, 1), BGColor=None):
    w = frame[1] - frame[0]
    h = frame[3] - frame[2]
    ls = LineSegs()
    ls.setThickness(lineThick)
    if color != 'transparent':
        ls.setColor(color)
        bevelBox(ls, frame, bevel)
    else:
        ls.setColor(1, 1, 1, 1)
        # ls.moveTo(0,0,0)
        # ls.drawTo(0,0,1)
    a = ls.create()
    if BGColor:
        fill(bevelBox, frame, BGColor, lineThick,
             bevel).reparentTo(NodePath(a))
    return a
示例#26
0
def bevelArrow(frame,
               bevel=.35,
               arrowhead=.4,
               lineThick=2,
               color=(1, 1, 1, 1),
               brdrColor=(1, 1, 1, 1),
               BGColor=None):
    ls = LineSegs()
    ls.setThickness(lineThick)
    if brdrColor != 'transparent':
        ls.setColor(brdrColor)
        bevelArrowLine(ls, frame, bevel, arrowhead)
    else:
        ls.setColor(color)
    a = ls.create()
    if BGColor:
        fill(bevelArrowLine, frame, BGColor, lineThick, bevel,
             arrowhead).reparentTo(NodePath(a))
    return a
    def _voro_draw(self):
        new_line_seqs = LineSegs()
        new_line_seqs.setThickness(2.0)  #TODO
        new_line_seqs.setColor(Vec4(1, 1, 0, 0.5))  #TODO
        n = 0
        for (points, faces) in self.input.current.voro:
            if self.selected_cells[n]:
                for (poly, poly_data) in faces:
                    (x, y, z, point_data) = points[poly[0][0]]
                    new_line_seqs.moveTo(Point3(x, y, z))
                    for i in xrange(1, len(poly)):
                        (x, y, z, point_data) = points[poly[i][0]]
                        new_line_seqs.drawTo(Point3(x, y, z))
                    (x, y, z, point_data) = points[poly[0][0]]
                    new_line_seqs.drawTo(Point3(x, y, z))
                if (self.grow_particles):
                    self.balls[n].setColor(1.0, 1.0, 1.0, 0.25)
                else:
                    self.balls[n].setColor(1.0, 1.0, 1.0, 1.0)
            else:
                if (self.grow_particles):
                    self.balls[n].setColor(1.0, 1.0, 1.0, 0.05)
                else:
                    self.balls[n].setColor(1.0, 1.0, 1.0, 0.5)
            n = n + 1

        if not (self.vertices is None):
            self.vertices.removeNode()
            self.vertices = None
        if not (self.sides is None):
            self.sides.removeNode()
            self.sides = None
        if not (self.lines_thin is None):
            self.lines_thin.removeNode()
            self.lines_thin = None
        if not (self.lines_thick is None):
            self.lines_thick.removeNode()
            self.lines_thick = None
        if not (self.lines is None):
            self.lines.removeNode()
        self.lines = NodePath(new_line_seqs.create())
        self.lines.reparentTo(self.render)
示例#28
0
 def createRainDrop(self, x=0, y=0, doubleDrop=False, tripleDrop=False):
     # Set up line geometry for rain.
     id = str(uuid.uuid4())
     dummy = NodePath('dummy' + id)
     lineSegs = LineSegs('line' + id)
     if self.tripleDrop:
         lineSegs.setThickness(3.0)
     elif self.doubleDrop:
         lineSegs.setThickness(2.0)
     else:
         lineSegs.setThickness(1.0)
     lineSegs.moveTo(0, 0, 0)
     lineSegs.drawTo(0, 0, self.deltaZ * .1)
     lineGeomNode = lineSegs.create()
     # True: gray; False: white and red.
     if True:
         lineSegs.setVertexColor(0, Vec4(1, 1, 1, .4))
         lineSegs.setVertexColor(1, Vec4(.3, .3, .3, 0))
         pass
     else:
         lineSegs.setVertexColor(0, Vec4(1, 1, 1, .4))
         lineSegs.setVertexColor(1, Vec4(1, 0, 0, 1))
     linePath = dummy.attachNewNode(lineGeomNode)
     linePath.setTransparency(True)
     linePath.reparentTo(render)
     # Add collision node with 'FROM' tag = 'rain'
     pickerNode = CollisionNode('linecnode' + id)
     pickerNode.setTag('FROM', 'rain')
     rayCollider = linePath.attachNewNode(pickerNode)
     # A small collision sphere is attached to the bottom of each rain drop.
     rayCollider.node().addSolid(CollisionSphere(0, 0, 0, .25))
     #base.cTrav.addCollider(rayCollider, collisionHandler)
     # Sequence rain
     Sequence(
         LerpPosInterval(linePath,
                         self.dropDuration,
                         Point3(x, y, self.pt1.z),
                         Point3(x, y, self.pt2.z),
                         blendType='easeIn',
                         fluid=1),
         Parallel(Func(dummy.removeNode),
                  Func(linePath.removeNode))).start()
示例#29
0
    def __init__(self, pickableList=[]):
        self.pickable = pickableList
        tempCard = CardMaker('')
        tempCard.setFrame(0, 1, 0, 1)

        #Lets render our frame so we can hide / show /resize it as needed
        self.selectFrame = render2d.attachNewNode(tempCard.generate())
        self.selectFrame.setColor(1, 1, 0, .2)
        self.selectFrame.setTransparency(1)
        self.selectFrame.hide()

        #Set up our line segmants for a border
        ls = LineSegs()
        ls.moveTo(0, 0, 0)
        ls.drawTo(1, 0, 0)
        ls.drawTo(1, 0, 1)
        ls.drawTo(0, 0, 1)
        ls.drawTo(0, 0, 0)

        self.selectFrame.attachNewNode(ls.create())

        self.selected = []
        self.previousSelect = []
        self.selectable = []

        #Init our mouse locations
        self.pt2InitMousePos = (-1, -1)
        self.pt2LastMousePos = (-1, -1)
        self.fFovh, self.fFovv = base.camLens.getFov()

        self.fTimeLastUpdateRect = 0
        self.fTimeLastUpdateSelected = 0
        self.UpdateTimeRect = 0.015
        self.UpdateTimeSelected = 0.015

        print "Running Select Tools"

        self.accept("mouse1", self.OnStartSelect)
        self.accept("control-mouse1", self.OnStartSelect)
        self.accept("mouse1-up", self.OnMouseRelease)
        self.taskUpdateSelectRect = 0
示例#30
0
def radioBTN(frame,
             bevel=.35,
             lineThick=2,
             color=(1, 1, 1, 1),
             brdrColor=(1, 1, 1, 1),
             BGColor=None):
    w = frame[1] - frame[0]
    h = frame[3] - frame[2]
    ls = LineSegs('off')
    ls.setThickness(lineThick)
    if brdrColor != 'transparent':
        ls.setColor(brdrColor)
        bevelBox(ls, frame, bevel)
    else:
        ls.setColor(color)
    diamond(ls, (frame[0] + h / 4, frame[0] + 3 * h / 4, frame[2] + h / 4,
                 frame[3] - h / 4))
    a = ls.create()
    if BGColor:
        fill(bevelBox, frame, BGColor, lineThick,
             bevel).reparentTo(NodePath(a))
    return a