def drawRelative(self, player_xpos, player_ypos, lensWidth, lensHeight): if not self.hasBeenSeen: self.level.timeline.add(self, 0) self.hasBeenSeen = True unicurses.attron(unicurses.COLOR_PAIR(config.colorDict[self.displayColor])) unicurses.mvaddch(-self.ypos + player_ypos + lensHeight, self.xpos - player_xpos + lensWidth, self.display) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict[self.displayColor]))
def drawInventoryInputParser(self): unicurses.erase() self.camera.drawHUDBoundaries() for index, item in enumerate(self.player.inventory.inventoryList): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict["white"])) unicurses.mvaddstr(index+1, 1, self.player.inventory.letterList[index+1]+") "+self.player.inventory.inventoryList[index].description) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict["white"]))
def drawRelativeBold(self, player_xpos, player_ypos, lensWidth, lensHeight): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict[self.displayColor])) unicurses.mvaddch( -self.ypos + player_ypos + lensHeight, self.xpos - player_xpos + lensWidth, ord(self.display), unicurses.A_REVERSE, ) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict[self.displayColor]))
def drawHUD(self): if self.player is None: raise RuntimeError("You didn't call levelManager.setPlayer()!!!!") unicurses.attron(unicurses.COLOR_PAIR(config.colorDict["white"])) unicurses.mvaddstr(1, self.lensWidth, self.level.player.playerName) unicurses.mvaddstr(2, self.lensWidth, self.level.player.title) unicurses.mvaddstr(4, self.lensWidth, "Health: "+str(self.level.player.health)+"/"+str(self.level.player.maxHealth)) unicurses.mvaddstr(5, self.lensWidth, "Poise: "+str(self.player.poise)+"/"+str(self.level.player.maxPoise)) unicurses.mvaddstr(8, self.lensWidth, "Turn: "+str(config.world.currentLevel.timeline.absoluteTime)) if(self.player.lastObelisk != None): unicurses.mvaddstr(6, self.lensWidth, "Shards of Divinity: "+str(self.player.shardCount)) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict["white"])) self.drawHUDBoundaries()
def drawHUDBoundaries(self): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict["white"])) for ypos in range(0, self.lensHeight): unicurses.mvaddch(ypos, self.lensWidth-1, ord("|")) unicurses.mvaddch(ypos, 0, ord("|")) for xpos in range(0, self.lensWidth): unicurses.mvaddch(0, xpos, ord("-")) unicurses.mvaddch(self.lensHeight-1, xpos, ord("-")) for ypos in range(0, self.lensHeight): unicurses.mvaddch(ypos, self.lensWidth+self.hudWidth, ord("|")) for xpos in range(self.lensWidth, self.lensWidth+self.hudWidth+1): unicurses.mvaddch(0, xpos, ord("-")) unicurses.mvaddch(self.lensHeight-1, xpos, ord("-")) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict["white"]))
# Set up the global colorPalette for i in range(0, 256): config.colorPalette.update({i:[i, i, unicurses.COLOR_BLACK]}) config.colorDict.update({str(i):i}) for entry in config.colorPalette: unicurses.init_pair(config.colorPalette[entry][0], config.colorPalette[entry][1], config.colorPalette[entry][2]) # Main menu erase() selected = 0 temp_camera = Camera(51, 19, None) temp_camera.drawHUDBoundaries() while(True): if(selected == 0): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict["white"])) unicurses.mvaddstr(1, 1, "New game") unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict["white"])) else: unicurses.attron(unicurses.COLOR_PAIR(config.colorDict["g12"])) unicurses.mvaddstr(1, 1, "New game") unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict["g12"])) if(selected == 1): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict["white"])) unicurses.mvaddstr(2, 1, "Load game") unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict["white"])) else: unicurses.attron(unicurses.COLOR_PAIR(config.colorDict["g12"])) unicurses.mvaddstr(2, 1, "Load game") unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict["g12"])) if(selected == 2):
def drawArbitrary(self, xpos, ypos, display, displayColor): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict[displayColor])) unicurses.mvaddch(-ypos+self.level.player.ypos +self.adjLensHeight, xpos-self.level.player.xpos+self.adjLensWidth, display) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict[displayColor]))
def output(self): for tupleCount, inTuple in enumerate(self.oBuffer): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict[inTuple[1]])) unicurses.mvaddstr(self.cameraHeight + tupleCount, 0, str(inTuple[0])) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict[inTuple[1]])) self.clear()
def drawRelativeFromMemory(self, player_xpos, player_ypos, lensWidth, lensHeight): unicurses.attron(unicurses.COLOR_PAIR(config.colorDict[self.memoryDisplayColor])) unicurses.mvaddch(-self.ypos + player_ypos + lensHeight, self.xpos - player_xpos + lensWidth, ord(self.display)) unicurses.attroff(unicurses.COLOR_PAIR(config.colorDict[self.memoryDisplayColor]))