本文整理汇总了Python中pyglet.clock.schedule函数的典型用法代码示例。如果您正苦于以下问题:Python schedule函数的具体用法?Python schedule怎么用?Python schedule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schedule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
global win
clock.schedule(rabbyt.add_time)
win = Window(width=800, height=600)
rabbyt.set_default_attribs()
lawn = Lawn()
wind = Wind()
magicEventRegister(win, events, list(lawn))
while not win.has_exit:
tick = clock.tick()
win.dispatch_events()
lawn.update(tick)
wind.update(tick)
events.ConsumeEventQueue()
rabbyt.clear((1, 1, 1))
lawn.draw()
win.flip()
示例2: play
def play(self):
if self.playing: return
clock.schedule(self.update)
self.player.play()
self.control.play.setVisible(False)
self.control.pause.setVisible(True)
self.playing = True
示例3: main
def main():
global fps_display
win = Window(width=800, height=600)
clock.schedule(rabbyt.add_time)
rabbyt.set_default_attribs()
bg = Background()
fps_display = clock.ClockDisplay()
while not win.has_exit:
tick = clock.tick()
win.dispatch_events()
bg.update(tick)
rabbyt.clear((bg.color))
bg.draw()
fps_display.draw()
win.flip()
示例4: main
def main():
global win
clock.schedule(rabbyt.add_time)
win = pyglet.window.Window(width=leaves.SCREEN_WIDTH, height=leaves.SCREEN_HEIGHT)
window.set_window(win)
rabbyt.set_default_attribs()
garbage = GarbageCan()
leafs = leaves.LeafGroup()
leafs += [leaves.Leaf(), leaves.Leaf(), leaves.Leaf() ]
for i in range(len(leafs)):
leafs[i].logicalX = 260 + i*80
leafs[i].logicalY = 100 + i*60
leafs[i].logicalZ = 10
while not win.has_exit:
tick = clock.tick()
win.dispatch_events()
leafs.update(tick)
garbage.update(tick)
events.ConsumeEventQueue()
rabbyt.clear((1, 1, 1))
leafs.draw()
garbage.draw()
win.flip()
示例5: main
def main():
clock.schedule(rabbyt.add_time)
window.game_window = Window(width=SCREEN_WIDTH, height=SCREEN_HEIGHT)
rabbyt.set_default_attribs()
mower = Mower()
bubble = RPMBubble()
guage = Guage(mower)
objs = [mower, guage, bubble]
magicEventRegister(window.game_window, events, objs)
while not window.game_window.has_exit:
tick = clock.tick()
window.game_window.dispatch_events()
for obj in objs:
obj.update(tick)
events.ConsumeEventQueue()
rabbyt.clear((1, 1, 1))
guage.draw()
mower.draw()
bubble.draw()
window.game_window.flip()
示例6: __init__
def __init__(self, window, player, console):
self.keys = key.KeyStateHandler()
self.player = player
# Console
self.console = console
# States
self.states = {}
self.states[wireframe] = False
self.states[flight] = False
self.mouse_speed = 0.0014
# Key Press Events
self.keyPressEvents = {}
clock.schedule(self.update)
window.push_handlers(self.on_key_press)
window.push_handlers(self.on_key_release)
window.push_handlers(self.keys)
window.push_handlers(self.on_mouse_motion)
window.push_handlers(self.on_mouse_drag)
window.push_handlers(self.on_mouse_press)
window.push_handlers(self.on_mouse_release)
示例7: main
def main():
# Create the main window
window = Window(800, 600, visible=False,
caption="FF:Tactics.py", style='dialog')
# Create the default camera and have it always updating
camera = Camera((-600, -300, 1400, 600), (400, 300), 300, speed=PEPPY)
clock.schedule(camera.update)
# Load the first scene
world = World(window, camera)
world.transition(MainMenuScene)
# centre the window on whichever screen it is currently on
window.set_location(window.screen.width/2 - window.width/2,
window.screen.height/2 - window.height/2)
# clear and flip the window
# otherwise we see junk in the buffer before the first frame
window.clear()
window.flip()
# make the window visible at last
window.set_visible(True)
# finally, run the application
pyglet.app.run()
示例8: __init__
def __init__(self, *args, **kwargs):
clock.schedule(self.update)
self.autoRun = False
#self.autoRun = True
self.translatex = self.translatey = 0
self.rotx = 0
self.depthtarget = self.depth = -7
super(AppWindow, self).__init__(*args,**kwargs)
示例9: on_scene_enter
def on_scene_enter(self):
#glEnable(GL_POINT_SMOOTH)
#glEnable(GL_TEXTURE_2D)
self.player = Player()
self.players = [self.player]
self.dynamic.append(self.player)
self.last_lead = self.player.position = self.campos = self.cam_spline.get_point(0)
clock.schedule(self.update)
示例10: _schedule_callback
def _schedule_callback(dt, func, *args, **kwargs):
"""
Schedule a callback to occur every event loop.
"""
# schedule it
clock.schedule(func, *args, **kwargs)
# call it
func(dt, *args, **kwargs)
示例11: __init__
def __init__(self):
config = gl.Config(sample_buffers=1, samples=4, depth_size=16, double_buffer=True)
try:
super(HypyrApp, self).__init__(resizable=True, config=config, vsync=False, width=800, height=600)
except pyglet.window.NoSuchConfigException:
super(HypyrApp, self).__init__(resizable=True)
self.scene = scene.Thing()
self.camera = scene.Camera()
clock.schedule(self.update)
self.setupOpenGL()
示例12: __init__
def __init__(self):
self.init_window()
self.world = World()
self.bot = Bot(SimpleController())
self.bot.position = self.world.size * 0.5
self.world.add_bot(self.bot)
clock.schedule(self.update)
示例13: start
def start(self):
# schedule update function to be called every frame
# I need to add some sort of FPS setting here
clock.schedule(self.update)
# instantiate the main game instance
# this will be changed to the menu instance when it's implemented
gameState = Game(self)
self.stateManager.addState('game', gameState)
self.stateManager.setState('game')
示例14: __init__
def __init__(self, parent, file=None, source=None, playing=False,
x=0, y=0, z=0, width=None, height=None, scale=True, **kw):
self.parent = parent
self.scale = scale
if file is not None:
source = self.source = media.load(file, streaming=True)
else:
assert source is not None, 'one of file or source is required'
self.player = media.Player()
self.player.eos_action = self.player.EOS_PAUSE
self.player.on_eos = self.on_eos
# poke at the video format
if not source.video_format:
raise ValueError("Movie file doesn't contain video")
video_format = source.video_format
if width is None:
width = video_format.width
if video_format.sample_aspect > 1:
width *= video_format.sample_aspect
if height is None:
height = video_format.height
if video_format.sample_aspect < 1:
height /= video_format.sample_aspect
super().__init__(parent, x, y, z, width, height, **kw)
# control frame top-level
c = self.control = Frame(self, bgcolor=(1, 1, 1, .5),
is_visible=False, width='100%', height=64)
# controls underlay
f = Frame(c, is_transparent=True, width='100%', height='100%')
f.layout = layouts.Horizontal(f, valign='center', halign='center',
padding=10)
c.play = Image(f, data.load_gui_image('media-play.png'),
classes=('-play-button',), is_visible=not playing)
c.pause = Image(f, data.load_gui_image('media-pause.png'),
bgcolor=None, classes=('-pause-button',),
is_visible=playing)
fi = Frame(f, is_transparent=True)
c.range = Image(fi, data.load_gui_image('media-range.png'))
im = data.load_gui_image('media-position.png')
c.position = Image(fi, im, x=0, y=-2, classes=('-position',))
c.time = Label(f, '00:00', font_size=20)
c.anim = None
# make sure we get at least one frame to display
self.player.queue(source)
clock.schedule(self.update)
self.playing = False
if playing:
self.play()
示例15: test_schedule_multiple
def test_schedule_multiple(self):
clock.set_default(clock.Clock())
clock.schedule(self.callback)
clock.schedule(self.callback)
self.callback_count = 0
clock.tick()
self.assertTrue(self.callback_count == 2)
clock.tick()
self.assertTrue(self.callback_count == 4)