def renderOverlay(el): if not (el.width and el.height): return con = libtcod.console_new(el.width, el.height) libtcod.console_set_default_background(con, libtcod.black) libtcod.console_blit(con, 0, 0, el.width, el.height, el.console, 0, 0, 0.0, 0.4) libtcod.console_delete(con)
def renderOverlay(el): if not (el.width and el.height): return con = libtcod.console_new(el.width, el.height) libtcod.console_set_default_background(con, el.bg) libtcod.console_clear(con) libtcod.console_blit(con, 0, 0, el.width, el.height, el.console, 0, 0, 0.0, 0.4) libtcod.console_delete(con) el.setDirty()
def renderElements(self): for e in self._elements: if not e.visible: continue if e.isDirty(): e.clear() e.draw() e.renderElements() if not e.enabled: self.renderOverlay(e) libtcod.console_blit(e.console, 0, 0, e.width, e.height, self.console, e.x, e.y, e.fgOpacity, e.bgOpacity)
def renderElements(self): for e in self._elements: e.clearConsole() if not e.visible: continue try: e.updateAnimationFrame() except AttributeError: pass e.draw() e.renderElements() if not e.enabled: self.renderOverlay(e) libtcod.console_blit(e.getConsole(), 0, 0, e.width, e.height, self.console, e.x, e.y, e.fgOpacity, e.bgOpacity)
def _blitToRoot(self, console): width = libtcod.console_get_width(console) height = libtcod.console_get_height(console) root = 0 libtcod.console_blit(console, 0, 0, width, height, root, 0, 0)
def _blitToRoot(self, console, x, y): width = libtcod.console_get_width(console) height = libtcod.console_get_height(console) root = 0 libtcod.console_blit(console, 0, 0, width, height, root, x, y)