def drawmid(y, mheight, color): x = p[0] + middleofnoteoffset if mheight > 0: if self.shape() == "square": pygame.draw.rect(variables.screen, color, [x, y, width, mheight], borderwidth) elif self.shape() == "triangle": fourthx = width/4 pygame.draw.polygon(variables.screen, color, [[x+3*fourthx, y], [x+fourthx, y], [x, y + mheight/2], [x+fourthx, y+mheight], [x+3*fourthx, y+mheight], [x+width, y + mheight/2]], borderwidth) elif self.shape() == "round": ellipsesurface = pygame.Surface((width, mheight), pygame.SRCALPHA) pygame.draw.ellipse(ellipsesurface, color, [0, -20, width, mheight+40], borderwidth) variables.screen.blit(ellipsesurface, [x, y]) # draw the multiplier if it is not 1 if self.scoremultiplier != 1: scorepic = getTextPic("x" + str(self.scoremultiplier), variables.gettextsize(), variables.WHITE) variables.screen.blit(scorepic, (x, y + mheight/2 - variables.gettextsize()/2)) # now draw pink line if it is an accidental if self.accidentalp: pygame.draw.rect(variables.screen, variables.PINK, [x+width/4, y, width/2, mheight]) # don't change border width
def drawmid(y, mheight, color): x = self.pos[0] + middleofnoteoffset if mheight > 0: if self.shape() == "square": pygame.draw.rect(variables.screen, color, [x, y, width, mheight], borderwidth) elif self.shape() == "triangle": fourthx = width/4 pygame.draw.polygon(variables.screen, color, [[x+3*fourthx, y], [x+fourthx, y], [x, y + mheight/2], [x+fourthx, y+mheight], [x+3*fourthx, y+mheight], [x+width, y + mheight/2]], borderwidth) elif self.shape() == "round": ellipsesurface = pygame.Surface((width, mheight), pygame.SRCALPHA) pygame.draw.ellipse(ellipsesurface, color, [0, -20, width, mheight+40], borderwidth) variables.screen.blit(ellipsesurface, [x, y]) # draw the multiplier if it is not 1 if self.scoremultiplier != 1: scorepic = getTextPic("x" + str(self.scoremultiplier), variables.gettextsize(), variables.WHITE) variables.screen.blit(scorepic, (x, y + mheight/2 - variables.gettextsize()/2)) # now draw pink line if it is an accidental if self.accidentalp: pygame.draw.rect(variables.screen, variables.PINK, [x+width/4, y, width/2, mheight]) # don't change border width
def drawscoretable(self): scores = self.beatmaps[self.current_beatmap].scores if len(scores) > 0: percent = int((sum(scores) / (len(scores)*2))*10) / 10.0 misses = 0 okays = 0 goods = 0 perfects = 0 for s in scores: if s == variables.miss_value: misses += 1 elif s == variables.ok_value: okays += 1 elif s == variables.good_value: goods += 1 elif s == variables.perfect_value: perfects += 1 tabletext = str(percent) + "% perfects: " + str(perfects) + \ " goods: " + str(goods) + " okays: " + str(okays) + \ " misses: " + str(misses) + " total: " + str(len(scores)) tablepic = getTextPic( tabletext, variables.gettextsize(), variables.WHITE) tabley = variables.height-tablepic.get_height() tablerect = Rect((variables.width-tablepic.get_width())/2, tabley, tablepic.get_width(), tablepic.get_height()) variables.screen.blit(tablepic, tablerect) variables.dirtyrects.append(tablerect)
def drawscoretable(self): scores = self.beatmaps[self.current_beatmap].scores if len(scores) > 0: percent = int((sum(scores) / (len(scores)*2))*10) / 10.0 misses = 0 okays = 0 goods = 0 perfects = 0 for s in scores: if s == variables.miss_value: misses += 1 elif s == variables.ok_value: okays += 1 elif s == variables.good_value: goods += 1 elif s == variables.perfect_value: perfects += 1 tabletext = str(percent) + "% perfects: " + str(perfects) + \ " goods: " + str(goods) + " okays: " + str(okays) + \ " misses: " + str(misses) + " total: " + str(len(scores)) tablepic = getTextPic(tabletext, variables.gettextsize(), variables.WHITE) tabley = variables.height-tablepic.get_height() tablerect = Rect((variables.width-tablepic.get_width())/2, tabley, tablepic.get_width(), tablepic.get_height()) variables.screen.blit(tablepic, tablerect) variables.dirtyrects.append(tablerect)
def __init__(self): self.settingsmenu = SettingsMenu() self.option = 0 self.state = "main" self.message = None self.messagetime = 0 self.nameprompts = ["Your name:", "The sleeping bear's name:", "Increase difficulty of game by:", "Confirm difficulty level ", "Wake up the sleeping bear."] self.yesno = ChoiceButtons(["yes","no"], 3*variables.gettextsize()/variables.height) # so that it starts on "no" self.yesno.nextoption() self.tempdifficulty = 0 self.enemyanimation = None self.reset() # if it is true, it is displaying the main menu self.mainmenup = True self.namestring = "" self.shifton = False self.backspaceon = False self.backspacetime = 0 self.firstbootup = True # keep track of when the menu was turned on self.pausetime = None self._freeze()
def drawcombo(self): currentb = self.beatmaps[self.current_beatmap] totalcombo = self.getcombo() if totalcombo >= 10: combocolor = difficultytocolor( ((totalcombo-9)/variables.numofrounds)/len(currentb.originalnotes)) # find combo height based on the last time it was increased comboheight = variables.gettextsize() deltatcombo = variables.settings.current_time-currentb.timeoflastcomboaddition # threshhold in millis for making the resizing text animation comboanimthreshhold = 100 if deltatcombo < comboanimthreshhold: comboheight *= 1 + (1 - deltatcombo/comboanimthreshhold)*0.5 playerpicandrect = self.getplayerpicandrect() combopic = getTextPic( "COMBO: " + str(totalcombo), comboheight, combocolor) combox = variables.width-combopic.get_width() combodif = combox-(variables.width-playerpicandrect[1].width) if combodif > 0: combox = combox-combodif/2 comborect = Rect( combox, playerpicandrect[1].y-comboheight*1.5, combopic.get_width(), combopic.get_height()) variables.screen.blit(combopic, comborect) variables.dirtyrects.append(comborect)
def drawname(self): promptstring = self.nameprompts[self.option] extrabuttonwidth = variables.getmenutextxoffset() / 4 if self.nameprompts[self.option] == "Confirm difficulty level ": reccomendedtext = getTextPic("The reccomended difficulty for new players is 0.", variables.gettextsize(), variables.beginningprompttextcolor) variables.screen.blit(reccomendedtext, [variables.width/2 - reccomendedtext.get_width()/2, variables.gettextsize()*0]) self.yesno.draw() promptstring = promptstring + str(self.tempdifficulty) + "?" textpic = getTextPic(promptstring, variables.gettextsize(), variables.beginningprompttextcolor) typestring = self.namestring typecolor = variables.BLACK if self.option == 2: typestring = str(self.tempdifficulty) typecolor = difficultytocolor(self.tempdifficulty/20.0) typepic = getTextPic(typestring, variables.gettextsize(), typecolor) variables.screen.blit(textpic, [variables.width/2 - textpic.get_width()/2, variables.gettextsize()*1.5]) variables.screen.blit(typepic, [variables.width/2 - typepic.get_width()/2, variables.gettextsize()*2.5])
def drawthismessage(messagestring): extrabuttonwidth = variables.getmenutextxoffset() / 4 mpic = getTextPic(messagestring, variables.gettextsize(), variables.WHITE) mx = variables.width/2-mpic.get_width()/2 my = variables.height/2+mpic.get_height()*2 r = Rect(mx-extrabuttonwidth, my, mpic.get_width()+2*extrabuttonwidth, mpic.get_height()) variables.screen.fill(variables.BLACK, r) variables.screen.blit(mpic, [mx, my]) variables.dirtyrects.append(r)
def drawmessage(self): if self.message != None: if variables.settings.current_time - self.messagetime > 1000: self.message = None # blit message on top if self.message != None: if self.message == "saved!": icon = getTextPic("saved", variables.gettextsize(), variables.WHITE) srect = Rect(0, variables.height-icon.get_height(), icon.get_width(), icon.get_height()) variables.screen.blit(icon, [srect.x, srect.y]) variables.dirtyrects.append(srect) else: graphics.drawthismessage(self.message)
def gettextpic(self, i, keylist): if i > len(keylist)-1: return None else: if i == len(keylist)-1: textstring = keylist[i] elif i == 0: textstring = keylist[i] elif keylist[i] == None: textstring = "none" elif type(keylist[i]) == str: textstring = keylist[i] else: textstring = pygame.key.name(keylist[i]) textpic = getTextPic(textstring, variables.gettextsize(), variables.WHITE) return textpic
def drawmain(self): extrabuttonwidth = variables.getmenutextxoffset() / 4 opics = [] optionnames = self.options() for o in optionnames: textpic = getTextPic(o, variables.gettextsize(), variables.WHITE) opics.append(textpic) xoffset = variables.getmenutextxoffset() for x in range(len(opics)): textpic = opics[x] if self.mainmenup: xoffset = int(variables.width / 2 - (textpic.get_width() / 2)) pygame.draw.rect(variables.screen, variables.BLACK, pygame.Rect(xoffset-extrabuttonwidth, (x + 1) * variables.getmenutextyspace(), textpic.get_width() + 2*extrabuttonwidth, textpic.get_height())) variables.screen.blit(textpic, [xoffset, (x + 1) * variables.getmenutextyspace()]) dotxoffset = variables.getmenutextxoffset() dotwidth = variables.getmenutextxoffset() * 1/3 if self.mainmenup: dotxoffset = int(variables.width / 2 - (opics[self.option].get_width() / 2)) pygame.draw.rect(variables.screen, variables.WHITE, [dotxoffset - dotwidth, (self.option + 1) * variables.getmenutextyspace(), dotwidth, dotwidth]) if self.mainmenup: enemywidth = self.enemyanimation.pic_width(variables.height/5) self.enemyanimation.draw_topright(variables.screen, variables.height/5, topoffset = (len(opics) + 1) * variables.getmenutextyspace(), rightoffset = int(variables.width/2 - enemywidth/2))
def displaywave(buf, channel, drawnsofar): if not variables.settings.soundonp(): return global furthestdisplaywavex, nextdisplaywavey # make it so that each second crosses .2 of the width of the screen wavelen = (buf.size/2)/variables.sample_rate * 0.2 * variables.width t = displaytuples[channel] waveamp = variables.gettextsize() * 0.7 if t == None: if nextdisplaywavey < waveamp: nextdisplaywavey = waveamp # init a new display tuple displaytuples[channel] = (furthestdisplaywavex-wavelen, nextdisplaywavey, (random.randint(0,255), random.randint(0,255), random.randint(0,255))) nextdisplaywavey += waveamp*2 if nextdisplaywavey > int(variables.getpadypos() -waveamp): nextdisplaywavey = waveamp t = displaytuples[channel] wavex = t[0] wavey = t[1] skiplen = len(buf)/wavelen drawwave(buf, skiplen, wavex, wavey, waveamp, wavelen, t[2], False) # now just update once and let it stay on screen pygame.display.update(Rect(wavex, wavey-waveamp, wavelen, waveamp*2)) maxwavex = (variables.width*9/12) newwavex = wavex+wavelen if newwavex > maxwavex: newwavex = 0 furthestdisplaywavex = newwavex variables.dirtyrects = [Rect(0,0,variables.width,variables.height)] displaytuples[channel] = (newwavex, wavey, t[2]) if newwavex > furthestdisplaywavex: furthestdisplaywavex = newwavex
def getfeedbackpic(self, index): color = variables.WHITE if self.feedbackcolor[index] != None: color = self.feedbackcolor[index] s = self.feedback[index] rotatep = False if s == "miss": s = "MISS" rotatep = True elif s == "ok": rotatep = True s = "OK" elif s == "good": s = "GOOD" rotatep = True elif s == "perfect": s = "PERFECT" rotatep = True pic = graphics.getTextPic(s, variables.gettextsize(), color) if rotatep: pic = pygame.transform.rotate(pic, -45) return pic
def displaywave(buf, channel, drawnsofar): if not variables.settings.soundonp(): return global furthestdisplaywavex, nextdisplaywavey # make it so that each second crosses .2 of the width of the screen wavelen = (buf.size/2)/variables.sample_rate * 0.2 * variables.width t = displaytuples[channel] waveamp = variables.gettextsize() * 0.7 if t == None: if nextdisplaywavey < waveamp: nextdisplaywavey = waveamp # init a new display tuple displaytuples[channel] = (furthestdisplaywavex-wavelen, nextdisplaywavey, (random.randint(0,255), random.randint(0,255), random.randint(0,255))) nextdisplaywavey += waveamp*2 if nextdisplaywavey > int(variables.getpadypos() -waveamp): nextdisplaywavey = waveamp t = displaytuples[channel] wavex = t[0] wavey = t[1] skiplen = len(buf)/wavelen drawwave(variables.battle_background, buf, skiplen, wavex, wavey, waveamp, wavelen, t[2], False) maxwavex = (variables.width*9/12) newwavex = wavex+wavelen if newwavex > maxwavex: newwavex = 0 furthestdisplaywavex = newwavex variables.dirtyrects = [Rect(0,0,variables.width,variables.height)] displaytuples[channel] = (newwavex, wavey, t[2]) if newwavex > furthestdisplaywavex: furthestdisplaywavex = newwavex
def drawcombo(self): currentb=self.beatmaps[self.current_beatmap] totalcombo = self.getcombo() if totalcombo >= 10: combocolor = difficultytocolor(((totalcombo-9)/variables.numofrounds)/len(currentb.originalnotes)) # find combo height based on the last time it was increased comboheight = variables.gettextsize() deltatcombo = variables.settings.current_time-currentb.timeoflastcomboaddition # threshhold in millis for making the resizing text animation comboanimthreshhold = 100 if deltatcombo < comboanimthreshhold: comboheight *= 1 + (1 - deltatcombo/comboanimthreshhold)*0.5 playerpicandrect = self.getplayerpicandrect() combopic = getTextPic("COMBO: " + str(totalcombo), comboheight, combocolor) combox = variables.width-combopic.get_width() combodif = combox-(variables.width-playerpicandrect[1].width) if combodif > 0: combox = combox-combodif/2 comborect = Rect(combox, playerpicandrect[1].y-comboheight*1.5, combopic.get_width(), combopic.get_height()) variables.screen.blit(combopic, comborect) variables.dirtyrects.append(comborect)
def __init__(self, pic, dialogue, side = None, bottomp = True, options = [], special_battle = "none"): if pic == None: self.pic = "empty" else: self.pic = pic # dialogue is a list of strings, one per line if type(dialogue) == str: self.dialogue = [dialogue] else: self.dialogue = dialogue self.side = side # a list of keys that work to exit the conversation- keys acceced in settings keydict self.specialexitkeys = None self.bottomp = bottomp self.releaseexit = False self.line = 0 self.releaseexit = False self.dialogue_initializedp = False self.wraplines() self.state = "talking" # options is a list of text for buttons to be displayed at the end of the speak self.options = options self.choicebuttons = None if len(self.options)>0: self.choicebuttons = ChoiceButtons(self.options, 1- variables.gettextsize()/variables.height-1/20) # start on second option self.choicebuttons.nextoption() self.special_battle = special_battle self._freeze()
def drawline(self, keytype, ypos, selectedoption = None): title = getTextPic(keytype + "-", variables.gettextsize(), variables.WHITE) variables.screen.blit(title, (variables.getmenutextxoffset(), ypos)) keylist = ["-"] + self.workingcopy.keydict[keytype] + ["+"] i = self.bindingscroll currentx = variables.getmenutextxoffset()*2 + title.get_width() while i < len(keylist): textpic = self.gettextpic(i, keylist) if i == selectedoption: self.drawdot(currentx) # handle scrolling for next frame if currentx + textpic.get_width() > variables.width: self.bindingscroll += 1 variables.screen.blit(textpic, (currentx, ypos)) currentx += variables.getmenutextxoffset()+textpic.get_width() i += 1 if self.bindingoption < self.bindingscroll: self.bindingscroll -= 1
def __init__(self, options, ypos, buttontextsize = variables.gettextsize()/variables.height): # a list of strings self.options = options self.current_option = 0 self.buttons = [] self.maxwidth = 0 for s in options: newb = Button(0, ypos, s, buttontextsize) self.buttons.append(newb) if newb.width()/variables.width > self.maxwidth: # devide by width because positions are multipliers of width self.maxwidth = newb.width()/variables.width spacing = self.maxwidth / 4 length = len(self.buttons) self.length = length centering = (1 - length * self.maxwidth - (length-1) * spacing) / 2 for i in range(self.length): self.buttons[i].screenwidthoverride = self.maxwidth self.buttons[i].x = i * (self.maxwidth + spacing) + centering self._freeze()
def linepic(self, index): return getTextPic(self.dialogue[index], variables.gettextsize(), variables.WHITE)
def draw(self): if self.current_beatmap<len(self.beatmaps): currentb = self.beatmaps[self.current_beatmap] else: currentb = None h = variables.height w = variables.width b = h * 13 / 16 p = classvar.player # background variables.screen.fill(variables.BLACK) # draw enemy first if self.state != "dance": self.enemy.animation.reset() # if not dancing, use first frame # draw enemy self.enemy.animation.draw_topright(variables.screen, enemypic_height()) playerpicandrect = self.getplayerpicandrect() # draw the player if self.state == "dance": # draw the special animation behind the player self.drawspecialmove() variables.screen.blit(playerpicandrect[0], playerpicandrect[1]) if currentb != None: # now draw the combo if necessary self.drawcombo() if self.enemy.animation.updatealwaysbattle: self.updatescreenforenemy() # draw beatmap if self.state == "dance": self.beatmaps[self.current_beatmap].draw() elif self.state == "attacking": self.beatmaps[self.current_beatmap].draw_pads() if self.state == "choose": # enemy name enemyname = variables.font.render("LV " + str(self.enemy.lv) + " " + self.enemy.name + " appears!", 0, variables.WHITE) enemynamescaled = sscale(enemyname) variables.screen.blit(enemynamescaled, [w / 2 - (enemynamescaled.get_width() / 2), h / 2]) self.battlechoice.draw() # draw the wave above the battlechoice wavex = self.battlechoice.buttons[-2].x * variables.width # the height of the wave waveamp = (self.battlechoice.buttons[-2].height()*3/4) * 0.5 wavelen = self.battlechoice.buttons[-2].width()*3/4 wavey = self.battlechoice.buttons[-2].y*variables.height-waveamp loopbuffer = play_sound.all_tones[variables.settings.soundpack].loopbuffers[0] skiplen = (len(loopbuffer)/25)/wavelen drawwave(loopbuffer, skiplen, wavex, wavey, waveamp, wavelen, (255,255,255)) # draw the scale above battlechoice firstscalex = self.battlechoice.buttons[-1].x * variables.width scalex = firstscalex scaley = self.battlechoice.buttons[-1].y*variables.height - self.battlechoice.buttons[-1].height() scaleintervals = play_sound.scales[self.getscalename()] for i in scaleintervals: tpic = getTextPic(str(i)+" ", variables.gettextsize(), variables.WHITE) variables.screen.blit(tpic, (scalex, scaley)) scalex += tpic.get_width() variables.dirtyrects.append(Rect(firstscalex, scaley, scalex-firstscalex, self.battlechoice.buttons[-1].height())) elif self.state == "lose" or self.state == "win": # button if self.state == "win": conttext = "continue" # button coordinates are multipliers of screen width and height continuebutton = Button(1 / 2, b/h, conttext, variables.gettextsize()/h) continuebutton.iscentered = True continuebutton.draw(True) else: self.retrychoice.draw() # text text = None if self.state == "lose": text = variables.font.render("you lost...", 0, variables.WHITE) else: text = variables.font.render("you win!", 0, variables.WHITE) textscaled = sscale(text) variables.screen.blit(textscaled, [w / 2 - (textscaled.get_width() / 2), h / 2]) self.drawscoretable() elif self.state == "exp" or self.state == "got exp": text = "continue" # continue button continuebutton = Button(1 / 2, b/h, text, variables.gettextsize()/h) continuebutton.iscentered = True continuebutton.draw(True) # text text = variables.font.render("EXP", 0, variables.WHITE) textscaled = sscale(text) exppos = [w / 2 - (textscaled.get_width() / 2), h / 3] variables.screen.blit(textscaled, exppos) variables.dirtyrects.append(Rect(exppos[0], exppos[1], textscaled.get_width(), textscaled.get_height())) text = variables.font.render("Lv " + str(classvar.player.lv()), 0, variables.WHITE) textscaled = sscale(text) lvpos = [0, h / 3 - textscaled.get_height()] variables.screen.blit(textscaled, lvpos) variables.dirtyrects.append(Rect(lvpos[0], lvpos[1], textscaled.get_width(), textscaled.get_height())) # exp bar percentofbar = stathandeling.percentoflevel(p.exp) barrect = Rect(0, h/2, w*percentofbar, h/18) variables.screen.fill(variables.BLUE, barrect) variables.dirtyrects.append(barrect) # level up text if self.state == "got exp" and stathandeling.explv(self.oldexp) < stathandeling.explv(self.newexp): text = variables.font.render(variables.settings.bearname + "'s dance level increased.", 0, variables.GREEN) textscaled = sscale(text) coordinates = [w / 2 - (textscaled.get_width() / 2), h / 3 - textscaled.get_height()] variables.screen.blit(textscaled, coordinates) variables.dirtyrects.append(Rect(coordinates[0], coordinates[1], textscaled.get_width(), textscaled.get_height())) self.drawscoretable() # player health bar playermaxh = stathandeling.max_health(p.lv()) healthh = h * (1 / 18) enemyhealthh = h * (1 / 50) epich = enemypic_height() epicw = self.enemy.animation.pic_width(epich) percenthealthlefte = self.enemy.health / stathandeling.max_health(self.enemy.lv) healthbarcolor = variables.GREEN if p.health != playermaxh: percenthealthleft = p.health / playermaxh barrect = Rect(w - epicw, epich, epicw * (1 - percenthealthleft),enemyhealthh) variables.screen.fill(healthbarcolor, barrect) variables.dirtyrects.append(barrect) if not percenthealthlefte == 1: barrect = Rect(0, h-healthh, w*(1-percenthealthlefte), healthh) variables.screen.fill(healthbarcolor, barrect) variables.dirtyrects.append(barrect) # if they did not miss any in the last beatmap if (self.damage_multiplier > variables.perfect_value and self.state == "attacking"): punscaled = variables.font.render("PERFECT!", 0, variables.WHITE) ptext = sscale_customfactor(punscaled, 1.5) coordinates = [(variables.width / 2) - (ptext.get_width() / 2) - epich, variables.getpadypos() - ptext.get_height() - 10] variables.screen.blit(ptext, coordinates) variables.dirtyrects.append(Rect(coordinates[0], coordinates[1], ptext.get_width(), ptext.get_height()))
def draw(self): options = self.getoptionlist() if self.state == "main": onscreen = options[self.scroll:self.scroll+self.linesperscreen()] for i in range(len(onscreen)): ypos = i * variables.getmenutextyspace() keytype = onscreen[i] # if it is not a binding if not keytype in self.workingcopy.keydict: title = getTextPic(keytype, variables.gettextsize(), variables.WHITE) variables.screen.blit(title, (variables.getmenutextxoffset(), ypos)) # draw dot if i == self.option-self.scroll and keytype != "mode": self.drawdot(variables.getmenutextxoffset()) if keytype == "volume": for x in range(int(self.workingcopy.volume*10)): xpos = variables.getmenutextxoffset() + variables.gettextsize()*x + title.get_width() variables.screen.fill(variables.BLUE, (xpos + variables.gettextsize()/4, ypos + variables.gettextsize()/4, variables.gettextsize()*(3/4), variables.gettextsize()*(3/4))) elif keytype == "mode": xpos = variables.getmenutextxoffset()*2 + title.get_width() i = 0 for t in self.windowmodes: if i == self.bindingoption: if options[self.option] == "mode": self.drawdot(xpos, ypos) pic = getTextPic(t, variables.gettextsize(), variables.WHITE) variables.screen.blit(pic, (xpos, ypos)) if self.workingcopy.windowmode == t: pygame.draw.rect(variables.screen, variables.BLUE, (xpos-2, ypos+2, pic.get_width()+4, pic.get_height()+2), 2) xpos += variables.getmenutextxoffset() + pic.get_width() i += 1 elif keytype in self.toggleoptions: xpos = variables.getmenutextxoffset()*2 + title.get_width() text = "off" if getattr(self.workingcopy, self.toggleoptionsvars[self.toggleoptions.index(keytype)]): text = "on" pic = getTextPic(text, variables.gettextsize(), variables.WHITE) variables.screen.blit(pic, (xpos, ypos)) if self.workingcopy.autosavep: pygame.draw.rect(variables.screen, variables.BLUE, (xpos-2, ypos+2, pic.get_width()+4, pic.get_height()+2), 1) else: if i == self.option-self.scroll: self.drawline(keytype, ypos, selectedoption = self.bindingoption) else: self.drawline(keytype, ypos) elif self.state == "keychange": text = getTextPic("Press a key to bind to " + options[self.option], variables.gettextsize(), variables.WHITE) variables.screen.blit(text, (variables.width/2 - text.get_width()/2, variables.height/2 - text.get_height()/2)) elif self.state == "confirm": text = getTextPic("Continue with these settings?", variables.gettextsize(), variables.WHITE) variables.screen.blit(text, (variables.width/2 - text.get_width()/2, variables.height/2 - variables.gettextsize()*2)) counter = getTextPic(str(self.confirmsecondsleft()), variables.gettextsize(), variables.WHITE) variables.screen.blit(counter, (variables.width/2 - counter.get_width()/2, variables.height/2 - variables.gettextsize()/2)) yesnoy = variables.height/2 + variables.gettextsize()*2 yes = getTextPic("yes", variables.gettextsize(), variables.WHITE) yesx = variables.width/2 - yes.get_width() - variables.getmenutextxoffset() variables.screen.blit(yes, (yesx, yesnoy)) no = getTextPic("no", variables.gettextsize(), variables.WHITE) nox = variables.width/2 + no.get_width() + variables.getmenutextxoffset() variables.screen.blit(no, (nox, yesnoy)) # draw dot next to yes if self.confirmoption == 0: self.drawdot(yesx, yesnoy) elif self.confirmoption == 1: self.drawdot(nox, yesnoy)