本文整理汇总了Python中pyglet.clock.schedule函数的典型用法代码示例。如果您正苦于以下问题:Python schedule函数的具体用法?Python schedule怎么用?Python schedule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schedule函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:pdevine,项目名称:suburbia,代码行数:25,代码来源:gutter.py
示例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
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:7,代码来源:movie.py
示例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()
开发者ID:pdevine,项目名称:suburbia,代码行数:25,代码来源:sky.py
示例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()
开发者ID:pdevine,项目名称:suburbia,代码行数:32,代码来源:garbage.py
示例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()
开发者ID:pdevine,项目名称:suburbia,代码行数:29,代码来源:mower.py
示例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)
开发者ID:bsmr-opengl,项目名称:glblox,代码行数:26,代码来源:controller.py
示例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()
开发者ID:johnmendel,项目名称:python-tactics,代码行数:25,代码来源:tactics.py
示例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)
开发者ID:bronek89,项目名称:binview,代码行数:8,代码来源:binview.py
示例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)
开发者ID:dustinlacewell,项目名称:pw9-darkpastel,代码行数:8,代码来源:winscene.py
示例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)
开发者ID:psederberg,项目名称:smile,代码行数:8,代码来源:state.py
示例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()
开发者ID:Tythos,项目名称:hypyr,代码行数:10,代码来源:main.py
示例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)
开发者ID:oxivanisher,项目名称:pybot,代码行数:10,代码来源:game.py
示例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')
开发者ID:IsakUlstrup,项目名称:PandaRunner,代码行数:10,代码来源:GameController.py
示例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()
开发者ID:bitcraft,项目名称:pyglet,代码行数:55,代码来源:movie.py
示例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)
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:11,代码来源:SCHEDULE.py
示例16: test_unschedule
def test_unschedule(self):
clock.set_default(clock.Clock())
clock.schedule(self.callback)
result = clock.tick()
self.assertTrue(result == self.callback_dt)
self.callback_dt = None
time.sleep(1)
clock.unschedule(self.callback)
result = clock.tick()
self.assertTrue(self.callback_dt == None)
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:12,代码来源:SCHEDULE.py
示例17: main
def main():
window = pyglet.window.Window(
width=400, height=400
)
model = None
view = View(model, window)
#clock.schedule_interval(model.update, 0.001)
clock.schedule(view.render)
pyglet.app.run()
开发者ID:institution,项目名称:c3rush,代码行数:12,代码来源:main_new.py
示例18: __init__
def __init__(self, parent, file=None, source=None, title=None,
playing=False, bgcolor=(1, 1, 1, 1), color=(0, 0, 0, 1),
font_size=20, **kw):
"""Pass in a filename as "file" or a pyglet Source as "source".
"""
self.parent = parent
if file is not None:
source = media.load(file, streaming=True)
else:
assert source is not None, 'one of file or source is required'
self.player = media.Player()
# poke at the audio format
if not source.audio_format:
raise ValueError("File doesn't contain audio")
super().__init__(parent, bgcolor=bgcolor, **kw)
# lay it out
# control frame top-level
c = self.control = Frame(self, width='100%', height=64)
ft = Frame(c, is_transparent=True, width='100%', height='100%')
ft.layout = layouts.Vertical(ft)
Label(ft, title or 'unknown', color=color, bgcolor=bgcolor,
padding=2, font_size=font_size)
# controls underlay
f = Frame(ft, 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'))
c.position = Image(fi, data.load_gui_image('media-position.png'),
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()
开发者ID:bitcraft,项目名称:pyglet,代码行数:52,代码来源:music.py
示例19: start_game
def start_game(self, controller, player_name = "Samus", host="localhost", game_name = "Deathtroid"):
self.menu = None
#self.init_gl()
if controller == "server" or controller == "both":
if self.server == None:
self.server = server_controller.ServerController(game_name)
#clock.schedule(self.server.update)
clock.schedule_interval_soft(self.server.update, 1./30.)
if controller == "client" or controller == "both":
if self.client == None:
self.client = client_controller.ClientController(player_name, host)
clock.schedule(self.client.update)
开发者ID:alexsystemf,项目名称:deathtroid,代码行数:13,代码来源:main.py
示例20: startup
def startup(self, win):
self.add(Sky())
self.add(Ground())
self.add(StressTest())
self.add(HudLives())
self.add(HudScore())
self.add(HudMultiplier())
def update_and_refresh(win, dt):
self.update(dt)
win.invalid = True
clock.schedule(lambda dt: update_and_refresh(win, dt))
self.title()
开发者ID:tartley,项目名称:sinister-ducks,代码行数:14,代码来源:game.py
注:本文中的pyglet.clock.schedule函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论