我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用pyglet.graphics()。
def __init__(self): '''Create a graphics batch.''' # Mapping to find domain. # group -> (attributes, mode, indexed) -> domain self.group_map = {} # Mapping of group to list of children. self.group_children = {} # List of top-level groups self.top_groups = [] self._draw_list = [] self._draw_list_dirty = False
def group(self): """Parent graphics group. The sprite can change its rendering group, however this can be an expensive operation. :type: `Group` """ return self._group.parent
def _create_vertex_list(self): if self._subpixel: vertex_format = 'v2f/%s' % self._usage else: vertex_format = 'v2i/%s' % self._usage if self._batch is None: self._vertex_list = graphics.vertex_list(4, vertex_format, 'c4B', ('t3f', self._texture.tex_coords)) else: self._vertex_list = self._batch.add(4, GL_QUADS, self._group, vertex_format, 'c4B', ('t3f', self._texture.tex_coords)) self._update_position() self._update_color()