本文整理匯總了Python中Window.draw方法的典型用法代碼示例。如果您正苦於以下問題:Python Window.draw方法的具體用法?Python Window.draw怎麽用?Python Window.draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Window
的用法示例。
在下文中一共展示了Window.draw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SFTaxiTest
# 需要導入模塊: import Window [as 別名]
# 或者: from Window import draw [as 別名]
def SFTaxiTest(polies,verts):
sfTaxiShader= SFTaxiShader([poly.centroid for poly in polies])
window= Window()
mouseCursor= MouseCursor(window)
sfObjects= SFObjects(polies,verts)
clickPos=None ; clock = sf.Clock()
while window.is_open:
tDelta= clock.restart().seconds
sfObjects.setScale(window.view.size.x/window.size.x)
window.clear()
#window.draw(sfTaxiShader)
sfTaxiShader.quad.align(window)
sfObjects.quadCorners = sfTaxiShader.quad.corners()
sfObjects.updateRays(sfTaxiShader.corners())
window.draw(sfObjects)
window.draw(mouseCursor)
window.display()
checkNavKeys(window,tDelta,mouseCursor.pos)
for event in window.events:
if type(event) is sf.CloseEvent: window.close()
elif type(event) is sf.MouseButtonEvent and event.pressed:
if event.button==sf.Mouse.LEFT: sfObjects.clickedAt(mouseCursor.pos)
else: checkForNavEvents(window,event,mouseCursor.pos)
elif type(event) is sf.KeyEvent and event.pressed:
if event.code == sf.Keyboard.ESCAPE: window.close()
elif event.code == sf.Keyboard.P: sfObjects.clickedAt= selectPoly
elif event.code == sf.Keyboard.I: sfObjects.clickedAt= selectIntersect
else: checkForNavEvents(window,event,mouseCursor.pos)
else: checkForNavEvents(window,event,mouseCursor.pos)
示例2: Window
# 需要導入模塊: import Window [as 別名]
# 或者: from Window import draw [as 別名]
#!/usr/bin/env python2
from Common import *
from Image import *
from Window import *
window = Window("DanRTS", 720)
believe = Image("believe.png")
window.add(believe)
while not done():
window.events()
window.draw()