当前位置: 首页>>代码示例>>Python>>正文


Python Window.draw方法代码示例

本文整理汇总了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)
开发者ID:bobbysoon,项目名称:TaxiVoronoi,代码行数:36,代码来源:__init__.py

示例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()


开发者ID:TheHistorian,项目名称:DanRTS,代码行数:16,代码来源:__main__.py


注:本文中的Window.draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。