本文整理汇总了Python中PyUnseen类的典型用法代码示例。如果您正苦于以下问题:Python PyUnseen类的具体用法?Python PyUnseen怎么用?Python PyUnseen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PyUnseen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadImage
def loadImage(self, filename, label = None):
if label:
handle = PyUnseen.createTexture(filename)
self.images[label] = handle
else:
handle = PyUnseen.createTexture(filename)
self.images[filename] = handle
示例2: run
def run():
done = 1
frame = 0
t = time.time()
import testopt
opts = testopt.parseCommandLine(800, 600, "dx")
pyui.init(*opts)
# w = pyui.widgets.ViewWindow(10, 10, 400, 300)
# w.pack()
terrainDetails = CreateTestTerrainDetails()
terrain = PyUnseen.createTerrainRegion(terrainDetails) # will take dictionary of stuff
rootWorld = PyUnseen.getRootWorld()
PyUnseen.addToWorld(rootWorld, terrain) # just like any other object
cameraPos = (-10, 6, -10)
cameraDir = (45, -45, 0)
view1 = PyUnseen.createView(rootWorld) # will also take zMin, zMax?
PyUnseen.setCameraParameters(view1, cameraPos, cameraDir)
rootView = PyUnseen.getRootView()
PyUnseen.setCameraParameters(rootView, cameraPos, cameraDir)
while done:
pyui.draw()
done = pyui.update()
print "done"
pyui.quit()
示例3: draw
def draw(self, windows):
"""run the python widgets drawing code. This calls describeWindow on any windows
that have changed. The actual drawing is done within PyUnseen.render.
"""
for w in windows:
w.drawWindow(self)
PyUnseen.render()
PyUnseen.messagepump()
self.mustFill = 0
self.dirtyRects = []
示例4: gotEvent
def gotEvent(event, wParam, lParam):
global keydown, keystate, debugEnabled
if event in mouseMsgs:
x = lParam & 0xffff
y = lParam >> 16
#print "Mouse Event: %d (%d,%d)" % (event, x, y)
mods = pyui.locals.MOD_NONE
if event in [WM_LBUTTONDOWN, WM_LBUTTONUP, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_MOUSEMOVE]:
if keystate[VK_SHIFT]:
mods |= pyui.locals.MOD_SHIFT
if keystate[VK_CONTROL]:
mods |= pyui.locals.MOD_CONTROL
if keystate[VK_MENU]:
mods |= pyui.locals.MOD_ALT
if getDesktop():
getDesktop().postUserEvent(event, x, y, wParam, mods)
return
# mods for key events
if event in [WM_CHAR, WM_KEYDOWN, WM_KEYUP]:
mods = pyui.locals.MOD_NONE
if keystate[VK_SHIFT]:
mods |= pyui.locals.MOD_SHIFT
if keystate[VK_CONTROL]:
mods |= pyui.locals.MOD_CONTROL
if keystate[VK_MENU]:
mods |= pyui.locals.MOD_ALT
# This is the handler for character keys.
if event == WM_CHAR:
getDesktop().postUserEvent(pyui.locals.CHAR, 0, 0, chr(wParam), mods)
return
if event == WM_KEYDOWN:
if debugEnabled and (DEBUG_KEY == wParam):
PyUnseen.debug(0)
return
global keydown, keystate
keystate[wParam] += 1
getDesktop().postUserEvent(pyui.locals.KEYDOWN, 0, 0, wParam, mods)
return
if event == WM_KEYUP:
global keydown, keystate
keystate[wParam] = 0
getDesktop().postUserEvent(pyui.locals.KEYUP, 0, 0, wParam, mods)
return
# special event handlers
if event == WM_CLOSE:
getDesktop().postUserEvent(pyui.locals.QUIT, 0, 0, 0)
return
示例5: __init__
def __init__(self, w, h, fullscreen, title="Unseen"):
Renderer3DBase.__init__(self, w, h, fullscreen)
PyUnseen.initialize(w, h, gotEvent, messageMap, title )
self.font1 = PyUnseen.createFont( "Arial", 9, 0 )
self.fixedFont = PyUnseen.createFont( "Courier", 7, 0 )
self.populateConstants()
# store the actual height and width surface created (might be less than requested)
#(getDesktop().width, getDesktop().height) = PyUnseen.getDesktopSize()
(w, pyui.locals.TEXT_HEIGHT) = self.getTextSize(" ")
self.images = {}
self.cache = {} # tracks all objects by Handle. useful for debugging
示例6: createView
def createView(self, world):
"""Create a view object and return the handle to it.
Width and height ignored by PyUnseen
"""
handle = PyUnseen.createView(world)
self.cache[handle] = "view"
return handle
示例7: getTextSize
def getTextSize(self, text, font = None):
if font == 'fixed':
font = self.fixedFont
elif not font:
font = self.font1
return PyUnseen.getTextSize(font, text)
示例8: quit
def quit(self):
print "PyUnseen Quitting."
PyUnseen.destroyFont(self.font1)
PyUnseen.destroyFont(self.fixedFont)
for filename in self.images.keys():
handle = self.images[filename]
PyUnseen.destroyTexture(handle)
self.dumpCache()
PyUnseen.cleanup()
示例9: describeWindow
def describeWindow(self, handle, drawList):
if not handle:
return
#print "Describing window (%d): %s" % (handle, drawList)
#print "Describing window ", handle
#for d in drawList:
# print d
return PyUnseen.describeWindow(handle, drawList)
示例10: getNodeEffect
def getNodeEffect(self, node, num):
return PyUnseen.getNodeEffect(node, num)
示例11: addGeometryNode
def addGeometryNode(self, objectHandle, bone=0):
return PyUnseen.addGeometryNode(objectHandle, bone)
示例12: setWindowEffect
def setWindowEffect(self, windowHandle, effectName):
return PyUnseen.setWindowViewEffect(windowHandle, effectName)
示例13: loadMusic
def loadMusic(self, waveFileName):
return PyUnseen.loadMusic(waveFileName)
示例14: playMusic
def playMusic(self, waveFileName, completionCallback = None):
return PyUnseen.playMusic(waveFileName, completionCallback)
示例15: stopSound
def stopSound(self, waveFileName):
return PyUnseen.stopSound(waveFileName)