本文整理汇总了Python中renpy.display.render.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: render
def render(self, width, height, st, at):
if renpy.game.less_updates:
return null_render(self, width, height, st, at)
if st >= self.time:
self.events = True
return render(self.new_widget, width, height, st, at)
step = st // self.quantum + 1
visible = self.old_widget
if step > self.steps:
step = (self.steps * 2) - step + 1
visible = self.new_widget
self.events = True
rdr = render(visible, width, height, st, at)
rv = renpy.display.render.Render(rdr.width, rdr.height)
rv.blit(rdr, (0, 0))
rv.operation = renpy.display.render.PIXELLATE
rv.operation_parameter = 2 ** step
renpy.display.render.redraw(self, 0)
return rv
开发者ID:BlackDragonHunt,项目名称:renpy,代码行数:29,代码来源:transition.py
示例2: render
def render(self, width, height, st, at):
if renpy.game.less_updates:
return null_render(self, width, height, st, at)
if st >= self.time:
self.events = True
return render(self.new_widget, width, height, st, at)
if st < self.time:
renpy.display.render.redraw(self, 0)
alpha = min(255, int(255 * st / self.time))
bottom = render(self.old_widget, width, height, st, at)
top = render(self.new_widget, width, height, st, at)
bottom_surface = bottom.pygame_surface(self.alpha)
top_surface = top.pygame_surface(self.alpha)
width = min(top.width, bottom.width)
height = min(top.height, bottom.height)
def draw(dest, x, y):
dw, dh = dest.get_size()
w = min(dw, width + x)
h = min(dh, height + y)
if w <= 0 or h <= 0:
return
renpy.display.module.blend(
bottom_surface.subsurface((-x, -y, w, h)),
top_surface.subsurface((-x, -y, w, h)),
dest.subsurface((0, 0, w, h)),
alpha)
if self.alpha:
surf = renpy.display.pgrender.surface((width, height), True)
draw(surf, 0, 0)
renpy.display.render.mutated_surface(surf)
rv = renpy.display.render.Render(width, height)
rv.blit(surf, (0, 0))
else:
rv = renpy.display.render.Render(width, height, draw_func=draw, opaque=True)
rv.depends_on(top, True)
rv.depends_on(bottom)
return rv
开发者ID:remro,项目名称:ksalpha-repair,代码行数:54,代码来源:transition.py
示例3: render
def render(self, width, height, st, at):
self.width = width
self.height = height
if self.update_function is not None:
redraw = self.update_function(st)
if redraw is not None:
renpy.display.render.redraw(self, redraw)
if not self.ignore_time:
self.displayable_map.clear()
if self.dead_child:
self.children = [ i for i in self.children if i.live ]
self.children.sort()
caches = [ ]
rv = renpy.display.render.Render(width, height)
events = False
for i in self.children:
events |= i.events
cache = i.cache
r = i.cache.render
if cache.render is None:
if cache.st is None:
cache.st = st
cst = st - cache.st
cache.render = r = render(cache.child, width, height, cst, cst)
cache.fast = (r.operation == BLIT) and (r.forward is None) and (r.alpha == 1.0)
rv.depends_on(r)
caches.append(cache)
if cache.fast:
for child, xo, yo, _focus, _main in r.children:
rv.children.append((child,
xo + i.x,
yo + i.y,
False,
False))
else:
rv.subpixel_blit(r, (i.x, i.y))
for i in caches:
i.render = None
return rv
开发者ID:FractalBobz,项目名称:renpy,代码行数:60,代码来源:particle.py
示例4: sizeit
def sizeit(pos, width, height, owidth, oheight):
if pos not in pos_d:
return owidth, oheight
rend = render(pos_d[pos], width, height, st, at)
rv = max(owidth, rend.width), max(oheight, rend.height)
rend.kill()
return rv
开发者ID:JakeStaines,项目名称:renpy,代码行数:8,代码来源:layout.py
示例5: place
def place(pos, x, y, w, h):
if pos not in pos_d:
return
d = pos_d[pos]
i = pos_i[pos]
rend = render(d, w, h, st, at)
self.offsets[i] = pos_d[pos].place(rv, x, y, w, h, rend)
开发者ID:JakeStaines,项目名称:renpy,代码行数:9,代码来源:layout.py
示例6: render
def render(self, width, height, st, at):
surf = render(self.child, width, height, st, at)
self.offsets = [ (0, 0) ]
rv = renpy.display.render.Render(surf.width, surf.height)
rv.blit(surf, (0, 0))
return rv
开发者ID:JakeStaines,项目名称:renpy,代码行数:10,代码来源:layout.py
示例7: render
def render(self, width, height, st, at):
if self.anim_timebase:
t = at
else:
t = st
child = render(self.child, width, height, st, at)
cw, ch = child.get_size()
self.update_position(t, (width, height, cw, ch))
rv = renpy.display.render.Render(cw, ch)
rv.blit(child, (0, 0))
self.offsets = [ (0, 0) ]
return rv
开发者ID:maniacs-games,项目名称:renpy,代码行数:18,代码来源:motion.py
示例8: render
def render(self, width, height, st, at):
color = self.color or self.style.color
rv = Render(width, height)
if color is None or width <= 0 or height <= 0:
return rv
SIZE = 10
si = renpy.display.im.SolidImage(color, SIZE, SIZE)
sr = render(si, SIZE, SIZE, st, at)
rv.forward = Matrix2D(1.0 * SIZE / width, 0, 0, 1.0 * SIZE / height)
rv.reverse = Matrix2D(1.0 * width / SIZE, 0, 0, 1.0 * height / SIZE)
rv.blit(sr, (0, 0))
return rv
开发者ID:thirdtruck,项目名称:Ludum-Dare-48-Entry-Fall-2011,代码行数:19,代码来源:imagelike.py
示例9: wrap_render
def wrap_render(child, w, h, st, at):
rend = render(child, w, h, st, at)
rv = Render(rend.width, rend.height)
rv.blit(rend, (0, 0))
return rv
开发者ID:defconcepts,项目名称:renpy,代码行数:5,代码来源:image.py
示例10: render
def render(self, width, height, st, at):
child = self.style.child
if child is None:
child = self.child
self.parent_width = width
self.parent_height = height
cr = render(child, width, height, st, at)
cw, ch = cr.get_size()
rv = Render(cw, ch)
rv.blit(cr, (0, 0))
self.w = cw
self.h = ch
position = (self.style.xpos, self.style.ypos, self.style.xanchor, self.style.yanchor, self.style.xoffset, self.style.yoffset)
# If we don't have a position, then look for it in a drag group.
if (self.x is None) and (self.drag_group is not None) and (self.drag_name is not None):
if self.drag_name in self.drag_group.positions:
dgp = self.drag_group.positions[self.drag_name]
if len(dgp) == 3:
self.x, self.y, self.old_position = dgp
else:
self.x, self.y = dgp
self.old_position = position
if self.old_position != position:
place = True
elif self.x is None:
place = True
else:
place = False
# If we don't have a position, run the placement code and use
# that to compute our placement.
if place:
# This is required to get get_placement to work properly.
self.x = None
place_x, place_y = self.place(None, 0, 0, width, height, rv)
self.x = int(place_x)
self.y = int(place_y)
self.target_x = None
self.old_position = position
if self.target_x is None:
self.target_x = self.x
self.target_y = self.y
self.target_at = at
# Determine if we need to do the snap animation.
if at >= self.target_at:
self.x = self.target_x
self.y = self.target_y
else:
done = (at - self.at) / (self.target_at - self.at)
self.x = absolute(self.x + done * (self.target_x - self.x))
self.y = absolute(self.y + done * (self.target_y - self.y))
redraw(self, 0)
if self.draggable or self.clicked is not None:
fx, fy, fw, fh = self.drag_handle
if isinstance(fx, float):
fx = int(fx * cw)
if isinstance(fy, float):
fy = int(fy * ch)
if isinstance(fw, float):
fw = int(fw * cw)
if isinstance(fh, float):
fh = int(fh * ch)
rv.add_focus(self, None, fx, fy, fw, fh, fx, fy, cr.subsurface((fx, fy, fw, fh)))
self.last_x = self.x
self.last_y = self.y
self.at = at
return rv
开发者ID:Habatchii,项目名称:renpy,代码行数:90,代码来源:dragdrop.py
示例11: render
def render(self, width, height, st, at):
if self.anim_timebase:
t = at
else:
t = st
if renpy.game.less_updates:
if self.delay:
t = self.delay
if self.repeat:
t = t % self.period
else:
t = self.period
elif self.delay and t >= self.delay:
t = self.delay
if self.repeat:
t = t % self.period
elif self.repeat:
t = t % self.period
renpy.display.render.redraw(self, 0)
else:
if t > self.period:
t = self.period
else:
renpy.display.render.redraw(self, 0)
if self.period > 0:
t /= self.period
else:
t = 1
if self.time_warp:
t = self.time_warp(t)
if self.bounce:
t = t * 2
if t > 1.0:
t = 2.0 - t
child = render(self.child, width, height, st, at)
cw, ch = child.get_size()
if self.add_sizes:
res = self.function(t, (width, height, cw, ch))
else:
res = self.function(t)
res = tuple(res)
if len(res) == 2:
self.position = res + (self.style.xanchor, self.style.yanchor)
else:
self.position = res
rv = renpy.display.render.Render(cw, ch)
rv.blit(child, (0, 0))
self.offsets = [ (0, 0) ]
return rv
开发者ID:Zonny,项目名称:TooManyTreesGame,代码行数:61,代码来源:motion.py
示例12: render
def render(self, width, height, st, at):
# Do we need to adjust the child times due to our being a layer?
if self.layer_name or (self.layers is not None):
adjust_times = True
else:
adjust_times = False
minx = self.style.xminimum
if minx is not None:
width = max(width, scale(minx, width))
miny = self.style.yminimum
if miny is not None:
height = max(height, scale(miny, height))
if self.first:
self.first = False
if adjust_times:
it = renpy.game.interface.interact_time
self.start_times = [ i or it for i in self.start_times ]
self.anim_times = [ i or it for i in self.anim_times ]
layout = self.style.box_layout
if layout is None:
layout = self.default_layout
self.layout = layout # W0201
else:
layout = self.layout
# Handle time adjustment, store the results in csts and cats.
if adjust_times:
t = renpy.game.interface.frame_time
csts = [ t - start for start in self.start_times ]
cats = [ t - anim for anim in self.anim_times ]
else:
csts = [ st ] * len(self.children)
cats = [ at ] * len(self.children)
offsets = [ ]
if layout == "fixed":
rv = None
if self.style.order_reverse:
iterator = zip(reversed(self.children), reversed(csts), reversed(cats))
else:
iterator = zip(self.children, csts, cats)
rv = renpy.display.render.Render(width, height, layer_name=self.layer_name)
xfit = self.style.xfit
yfit = self.style.yfit
fit_first = self.style.fit_first
if fit_first == "width":
first_fit_width = True
first_fit_height = False
elif fit_first == "height":
first_fit_width = False
first_fit_height = True
elif fit_first:
first_fit_width = True
first_fit_height = True
else:
first_fit_width = False
first_fit_height = False
sizes = [ ]
for child, cst, cat in iterator:
surf = render(child, width, height, cst, cat)
size = surf.get_size()
sizes.append(size)
if first_fit_width:
width = rv.width = size[0]
first_fit_width = False
if first_fit_height:
height = rv.height = size[1]
first_fit_height = False
if surf:
offset = child.place(rv, 0, 0, width, height, surf)
offsets.append(offset)
else:
offsets.append((0, 0))
#.........这里部分代码省略.........
开发者ID:williamd1k0,项目名称:renpy,代码行数:101,代码来源:layout.py
示例13: render
def render(self, width, height, st, at):
cr = render(self.child, width, height, st, at)
return cr.subsurface(self.rect)
开发者ID:CensoredUsername,项目名称:renpy,代码行数:3,代码来源:imagemap.py
示例14: render
def render(self, width, height, st, at):
width = max(self.style.xminimum, width)
height = max(self.style.yminimum, height)
image = self.style.child or self.image
crend = render(image, width, height, st, at)
sw, sh = crend.get_size()
sw = int(sw)
sh = int(sh)
dw = int(width)
dh = int(height)
bw = self.left + self.right
bh = self.top + self.bottom
xborder = min(bw, sw - 2, dw)
if xborder and bw:
left = self.left * xborder / bw
right = self.right * xborder / bw
else:
left = 0
right = 0
yborder = min(bh, sh - 2, dh)
if yborder and bh:
top = self.top * yborder / bh
bottom = self.bottom * yborder / bh
else:
top = 0
bottom = 0
if renpy.display.draw.info["renderer"] == "sw":
return self.sw_render(crend, dw, dh, left, top, right, bottom)
def draw(x0, x1, y0, y1):
# Compute the coordinates of the left, right, top, and
# bottom sides of the region, for both the source and
# destination surfaces.
# left side.
if x0 >= 0:
dx0 = x0
sx0 = x0
else:
dx0 = dw + x0
sx0 = sw + x0
# right side.
if x1 > 0:
dx1 = x1
sx1 = x1
else:
dx1 = dw + x1
sx1 = sw + x1
# top side.
if y0 >= 0:
dy0 = y0
sy0 = y0
else:
dy0 = dh + y0
sy0 = sh + y0
# bottom side
if y1 > 0:
dy1 = y1
sy1 = y1
else:
dy1 = dh + y1
sy1 = sh + y1
# Quick exit.
if sx0 == sx1 or sy0 == sy1:
return
# Compute sizes.
csw = sx1 - sx0
csh = sy1 - sy0
cdw = dx1 - dx0
cdh = dy1 - dy0
if csw <= 0 or csh <= 0 or cdh <= 0 or cdw <= 0:
return
# Get a subsurface.
cr = crend.subsurface((sx0, sy0, csw, csh))
# Scale or tile if we have to.
if csw != cdw or csh != cdh:
if self.tile:
newcr = Render(cdw, cdh)
newcr.xclipping = True
newcr.yclipping = True
for x in xrange(0, cdw, csw):
#.........这里部分代码省略.........
开发者ID:huanxuantian,项目名称:renpy,代码行数:101,代码来源:imagelike.py
示例15: render
def render(self, width, height, st, at):
child = self.style.child
if child is None:
child = self.child
self.parent_width = width
self.parent_height = height
cr = render(child, width, height, st, at)
cw, ch = cr.get_size()
rv = Render(cw, ch)
rv.blit(cr, (0, 0))
self.w = cw
self.h = ch
# If we don't have a position, then look for it in a drag group.
if (self.x is None) and (self.drag_group is not None) and (self.drag_name is not None):
if self.drag_name in self.drag_group.positions:
self.x, self.y = self.drag_group.positions[self.drag_name]
# If we don't have a position, run the placement code and use
# that to compute our placement.
if self.x is None:
self.x, self.y = self.place(None, 0, 0, width, height, rv)
self.x = int(self.x)
self.y = int(self.y)
if self.target_x is None:
self.target_x = self.x
self.target_y = self.y
self.target_at = at
# Determine if we need to do the snap animation.
if at >= self.target_at:
self.x = self.target_x
self.y = self.target_y
else:
done = (at - self.at) / (self.target_at - self.at)
self.x = absolute(self.x + done * (self.target_x - self.x))
self.y = absolute(self.y + done * (self.target_y - self.y))
redraw(self, 0)
if self.draggable or self.clicked is not None:
fx, fy, fw, fh = self.drag_handle
if isinstance(fx, float):
fx = int(fx * cw)
if isinstance(fy, float):
fy = int(fy * ch)
if isinstance(fw, float):
fw = int(fw * cw)
if isinstance(fh, float):
fh = int(fh * ch)
rv.add_focus(self, None, fx, fy, fw, fh, fx, fy, cr.subsurface((fx, fy, fw, fh)))
self.last_x = self.x
self.last_y = self.y
self.at = at
return rv
开发者ID:thirdtruck,项目名称:Ludum-Dare-48-Entry-Fall-2011,代码行数:68,代码来源:dragdrop.py
示例16: render
def render(self, width, height, st, at):
child = self.style.child
if child is None:
child = self.child
self.parent_width = width
self.parent_height = height
cr = render(child, width, height, st, at)
cw, ch = cr.get_size()
rv = Render(cw, ch)
rv.blit(cr, (0, 0))
self.w = cw
self.h = ch
position = (self.style.xpos, self.style.ypos, self.style.xanchor, self.style.yanchor, self.style.xoffset, self.style.yoffset)
# If we don't have a position, then look for it in a drag group.
if (self.x is None) and (self.drag_group is not None) and (self.drag_name is not None):
if self.drag_name in self.drag_group.positions:
dgp = self.drag_group.positions[self.drag_name]
if len(dgp) == 3:
self.x, self.y, self.old_position = dgp
else:
self.x, self.y = dgp
self.old_position = position
if self.old_position != position:
place = True
elif self.x is None:
place = True
else:
place = False
# If we don't have a position, run the placement code and use
# that to compute our placement.
if place:
# This is required to get get_placement to work properly.
self.x = None
place_x, place_y = self.place(None, 0, 0, width, height, rv)
self.x = int(place_x)
self.y = int(place_y)
self.target_x = None
self.old_position = position
if self.target_x is None:
self.target_x = self.x
self.target_y = self.y
self.target_at = at
# Determine if we need to do the snap animation.
if self.target_at_delay:
# Snap starts now
self.target_at = at + self.target_at_delay
self.target_at_delay = 0
redraw(self, 0)
elif at >= self.target_at:
# Snap complete
self.x = self.target_x
self.y = self.target_y
else:
# Snap in progress
done = (at - self.at) / (self.target_at - self.at)
self.x = absolute(self.x + done * (self.target_x - self.x))
self.y = absolute(self.y + done * (self.target_y - self.y))
redraw(self, 0)
if self.draggable or self.clicked is not None:
fx, fy, fw, fh = self.drag_handle
if isinstance(fx, float):
fx = int(fx * cw)
if isinstance(fy, float):
fy = int(fy * ch)
if isinstance(fw, float):
fw = int(fw * cw)
if isinstance(fh, float):
fh = int(fh * ch)
mask = self.style.focus_mask
if mask is True:
mask = cr.subsurface((fx, fy, fw, fh))
elif mask is not None:
try:
mask = renpy.display.render.render(mask, fw, fh, st, at)
except:
if callable(mask):
mask = mask
#.........这里部分代码省略.........
开发者ID:maniacs-games,项目名称:renpy,代码行数:101,代码来源:dragdrop.py
示例17: render
def render(self, width, height, st, at):
# Handle redrawing.
if self.value is not None:
redraw = self.value.periodic(st)
if redraw is not None:
renpy.display.render.redraw(self, redraw)
# Store the width and height for the event function to use.
self.width = width
self.height = height
range = self.adjustment.range #@ReservedAssignment
value = self.adjustment.value
page = self.adjustment.page
if range <= 0:
if self.style.unscrollable == "hide":
self.hidden = True
return renpy.display.render.Render(width, height)
elif self.style.unscrollable == "insensitive":
self.set_style_prefix("insensitive_", True)
self.hidden = False
if self.style.bar_invert ^ self.style.bar_vertical:
value = range - value
bar_vertical = self.style.bar_vertical
if bar_vertical:
dimension = height
else:
dimension = width
fore_gutter = self.style.fore_gutter
aft_gutter = self.style.aft_gutter
active = dimension - fore_gutter - aft_gutter
if range:
thumb_dim = active * page / (range + page)
else:
thumb_dim = active
thumb_offset = abs(self.style.thumb_offset)
if bar_vertical:
thumb = render(self.style.thumb, width, thumb_dim, st, at)
thumb_shadow = render(self.style.thumb_shadow, width, thumb_dim, st, at)
thumb_dim = thumb.height
else:
thumb = render(self.style.thumb, thumb_dim, height, st, at)
thumb_shadow = render(self.style.thumb_shadow, thumb_dim, height, st, at)
thumb_dim = thumb.width
# Remove the offset from the thumb.
thumb_dim -= thumb_offset * 2
self.thumb_dim = thumb_dim
active -= thumb_dim
if range:
fore_size = active * value / range
else:
fore_size = active
fore_size = int(fore_size)
aft_size = active - fore_size
fore_size += fore_gutter
aft_size += aft_gutter
rv = renpy.display.render.Render(width, height)
if bar_vertical:
if self.style.bar_resizing:
foresurf = render(self.style.fore_bar, width, fore_size, st, at)
aftsurf = render(self.style.aft_bar, width, aft_size, st, at)
rv.blit(thumb_shadow, (0, fore_size - thumb_offset))
rv.blit(foresurf, (0, 0), main=False)
rv.blit(aftsurf, (0, height-aft_size), main=False)
rv.blit(thumb, (0, fore_size - thumb_offset))
else:
foresurf = render(self.style.fore_bar, width, height, st, at)
aftsurf = render(self.style.aft_bar, width, height, st, at)
rv.blit(thumb_shadow, (0, fore_size - thumb_offset))
rv.blit(foresurf.subsurface((0, 0, width, fore_size)), (0, 0), main=False)
rv.blit(aftsurf.subsurface((0, height - aft_size, width, aft_size)), (0, height - aft_size), main=False)
rv.blit(thumb, (0, fore_size - thumb_offset))
else:
if self.style.bar_resizing:
foresurf = render(self.style.fore_bar, fore_size, height, st, at)
aftsurf = render(self.style.aft_bar, aft_size, height, st, at)
rv.blit(thumb_shadow, (fore_size - thumb_offset, 0))
rv.blit(foresurf, (0, 0), main=False)
#.........这里部分代码省略.........
开发者ID:BAPK,项目名称:HrmTrain,代码行数:101,代码来源:behavior.py
注:本文中的renpy.display.render.render函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论