def dbox(x, y, w, h, text, wrap=True, border=0, margin=0, con=0, disp='poly'): con_box = libtcod.console_new(w, h) pad = 0 if border == None else 1 offset = margin + pad fulltext = textwrap.fill(text, w - 2 * (margin + pad)) if wrap else text boxes = word.split_stanza( fulltext, h - 2 * (margin + pad)) if disp == 'poly' else [fulltext] length = len(boxes) i = 0 for box in boxes: i += 1 libtcod.console_clear(con_box) # print if border is not None: rectangle(con_box, 0, 0, w, h, border) libtcod.console_print(con_box, offset, offset, box) put_text_special_colors(con_box, box, offset) libtcod.console_blit( con_box, 0, 0, w, h, # Source con, x, y) # Destination # wait for user input to continue... if i < length: rog.blit_to_final(con, 0, 0) rog.refresh() while True: reply = rog.Input(x + w - 1, y + h - 1, mode="wait") if (reply == ' ' or reply == ''): break libtcod.console_delete(con_box)
def update(self): clearMsg = False #activate_all_necessary_updates() if self.updates[Update.U_HUD] : rog.render_hud(rog.pc()); if self.updates[Update.U_GAME] : rog.render_gameArea(rog.pc()); if self.updates[Update.U_MSG] : rog.logNewEntry(); clearMsg=True; if self.updates[Update.U_FINAL] : rog.blit_to_final( rog.con_game(),0,0); if self.updates[Update.U_BASE] : rog.refresh(); if clearMsg: rog.msg_clear() self.set_all_to_false()
def _printElement(elemStr): #global yy,y1,x1 rog.dbox(x1, y1 + iy, ROOMW, 3, text=elemStr, wrap=False, border=None, con=rog.con_game(), disp='mono') rog.blit_to_final(rog.con_game(), 0, 0) rog.refresh()
def update(self): rog.blit_to_final(self.con_mid, 0, self.y, 0, self.box1h) if self.con_top: rog.blit_to_final(self.con_top, 0, 0, 0, 0) if self.con_bot: rog.blit_to_final(self.con_bot, 0, 0, 0, self.box2y) rog.refresh()