本文整理匯總了Python中pandac.PandaModules.LineSegs.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Python LineSegs.setColor方法的具體用法?Python LineSegs.setColor怎麽用?Python LineSegs.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandac.PandaModules.LineSegs
的用法示例。
在下文中一共展示了LineSegs.setColor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: draw
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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)
示例2: add_line
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
def add_line(self, rendering_node, color, thickness, start, end):
linesegs = LineSegs()
linesegs.setColor(*color)
linesegs.setThickness(thickness)
linesegs.drawTo((start[0], start[1], start[2]))
linesegs.drawTo((end[0], end[1], end[2]))
new_node = linesegs.create()
rendering_node.attachNewNode(new_node)
示例3: drawLine
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
def drawLine(self, parent, source, target):
line = LineSegs()
line.setThickness(LINETHICKNESS)
line.reset()
line.setColor(*GRIDCOLOR)
line.moveTo(source)
line.drawTo(target)
node = line.create()
lineSegNP = NodePath(node).reparentTo(parent)
示例4: drawLineToNeighbors
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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)
示例5: AttackCursor
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
class AttackCursor(object):
_EDGES = 40
_color = Vec4(0.8, 0.3, 0.3, 1)
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()
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)
def removeNode(self):
for e in self.attackables:
if isinstance(e, Entity.EntityShip):
e.representation.unsetAttackable()
self._footCircleNP.removeNode()
self._attackRadCircleNP.removeNode()
self._np.removeNode()
def __del__(self):
self.removeNode()
示例6: __createLine
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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
示例7: drawBestPath
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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)
示例8: sepLine
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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()
示例9: bevelArrow
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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
示例10: rectangle
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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
示例11: makeArc
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
def makeArc(color, angle_degrees = 360, numsteps = 16, horizon_plane = 0,):
ls = LineSegs()
ls.setColor(color)
angleRadians = deg2Rad(angle_degrees)
for i in xrange(numsteps + 1):
a = angleRadians * i / numsteps
y = math.sin(a)
x = math.cos(a)
ls.drawTo(x, y, horizon_plane)
ls.setThickness(2.0)
ls.setColor(color)
node = ls.create()
return NodePath(node)
示例12: makeArc
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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)
示例13: radioBTN
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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
示例14: bevelBG
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
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
示例15: checkBox
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setColor [as 別名]
def checkBox(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)
hoff = min(2*bevel, h/4)
rect(ls, (frame[0]+hoff,frame[0]+hoff+h/2,frame[2]+h/4,frame[3]-h/4))
a = ls.create()
if BGColor:
fill(bevelBox, frame, BGColor, lineThick, bevel).reparentTo(NodePath(a))
return a