本文整理汇总了Python中vecrec.Rect.from_pyglet_window方法的典型用法代码示例。如果您正苦于以下问题:Python Rect.from_pyglet_window方法的具体用法?Python Rect.from_pyglet_window怎么用?Python Rect.from_pyglet_window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vecrec.Rect
的用法示例。
在下文中一共展示了Rect.from_pyglet_window方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_outline
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import from_pyglet_window [as 别名]
#!/usr/bin/env python3
import pyglet
import glooey
import run_demos
from vecrec import Vector, Rect
window = pyglet.window.Window()
batch = pyglet.graphics.Batch()
full = Rect.from_pyglet_window(window)
left = Rect(full.left, full.bottom, full.width/2, full.height)
right = Rect(full.left, full.bottom, full.width/2, full.height)
right.left = left.right
left.shrink(50)
right.shrink(50)
@run_demos.on_space(window, batch)
def test_outline():
a = glooey.drawing.Outline(left, batch=batch)
b = glooey.drawing.Outline(right, batch=batch)
yield "Show two unconnected outlines."
a.hide()
b.hide()
c = glooey.drawing.Outline(full, batch=batch)
yield "Put an outline just inside the window."
c.hide()
@window.event
示例2: on_resize
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import from_pyglet_window [as 别名]
def on_resize(self, width, height):
rect = Rect.from_pyglet_window(self.window)
self.resize(rect)
示例3: __init__
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import from_pyglet_window [as 别名]
def __init__(self, window, batch=None, group=None):
rect = Rect.from_pyglet_window(window)
super().__init__(rect, window, batch, group)
示例4: test_background
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import from_pyglet_window [as 别名]
#!/usr/bin/env python3
import pyglet
import glooey
import run_demos
from vecrec import Rect
from pyglet.image import load
window = pyglet.window.Window()
batch = pyglet.graphics.Batch()
rect = Rect.from_size(64*8, 64*6)
rect.center = Rect.from_pyglet_window(window).center
bg = glooey.drawing.Background(rect=rect, batch=batch)
@run_demos.on_space(window, batch)
def test_background():
# Make sure colors can be set, updated, and removed.
bg.set_appearance(color='green')
yield "Show a solid green background."
bg.set_appearance(color='orange')
yield "Change to a solid orange background."
# Make sure outlines can be set, updated, and removed.
bg.set_appearance(outline='green')
yield "Show a solid green outline."
bg.set_appearance(outline='orange')
yield "Change to a solid orange outline."
# Make sure non-tiled images can be set, updated, and removed.
示例5: get_territory
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import from_pyglet_window [as 别名]
def get_territory(self):
return Rect.from_pyglet_window(self.window)
示例6: test_tile
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import from_pyglet_window [as 别名]
import run_demos
from vecrec import Vector, Rect
window = pyglet.window.Window()
batch = pyglet.graphics.Batch()
rects = { #
'big': Rect.from_size(64*8, 64*6),
'small': Rect.from_size(64*4, 64*3),
}
images = { #
'green': pyglet.image.load('assets/64x64/green.png'),
'orange': pyglet.image.load('assets/64x64/orange.png'),
}
window_rect = Rect.from_pyglet_window(window)
for rect in rects.values():
rect.center = window_rect.center
artist = glooey.drawing.Tile(
rects['big'], images['green'], vtile=True, htile=True, batch=batch)
@run_demos.on_space(window, batch)
def test_tile():
yield "Show a green pattern."
artist.image = images['orange']
yield "Change to an orange pattern."
artist.image = images['green']
artist.rect = rects['small']
yield "Make the rect smaller."