Example #1
0
  def renderForeground( self, scene ):
    font = scene.fontDict['songListFont']
    ( w, h ) = scene.geometry
    font = scene.fontDict['songListFont']

    ( c1, c2, c3 ) = self.song_sort_color
    glColor3f( c1, c2, c3 )

    text = _( 'SORTED BY' ) + ' '
    if scene.sortOrder == 0:
      text = text + ( 'SONG NAME' )
    elif scene.sortOrder == 1:
      text = text + ( 'ARTIST' )
    elif scene.sortOrder == 2:
      text = text + ( 'PLAY COUNT' )
    elif scene.sortOrder == 3:
      text = text + ( 'ALBUM NAME' )
    elif scene.sortOrder == 4:
      text = text + ( 'GENRE' )
    elif scene.sortOrder == 5:
      text = text + ( 'YEAR' )
    elif scene.sortOrder == 6:
      text = text + ( 'BAND DIFFICULTY' )
    elif scene.sortOrder == 7:
      text = text + ( 'INSTRUMENT DIFFICULTY' )
    else:
      text = text + ( 'SONG COLLECTION' )

    font.render( text, ( .18, .106 ), scale = 0.0015 )


    scene.drawImage(scene.img_6thlayer, scale = (1.0, -1.0), coord = (w/2,h/2), stretched = 3)

    if scene.searching:
      font.render( scene.searchText, ( .5, .7 ), align = 1 )
  def render(self, visibility, playerNum):
    w, h, = self.stage.engine.view.geometry[2:4]
    v = 1.0

    scene = self.stage.scene

    def get(value, type = str, default = None):
      if self.config.has_option(self.section, value):
        return type(self.config.get(self.section, value))
      return default

    if self in self.stage.sharedlayers:
      score = scene.coOpScoreCard.score
      stars = scene.coOpScoreCard.stars
      rock = scene.rock[scene.coOpPlayerMeter] / scene.rockMax
    else:
      score = scene.scoring[playerNum].score
      stars = scene.scoring[playerNum].stars
      rock = scene.rock[playerNum] / scene.rockMax

    streak = scene.scoring[playerNum].streak
    power = scene.instruments[playerNum].starPower/100.0
    if streak >= 30:
      multiplier = 4
    else:
      multiplier = int(streak*.1) + 1

    self.text = eval(get("text"))
    self.replace    = get("replace")

    if self.replace != None:
      self.replace = self.replace.split(";")
      for replace in self.replace:
        self.text = str(self.text).replace(replace.split(",")[0],replace.split(",")[1])

    wid, hgt = self.font.getStringSize(str(self.text))

    try:  self.position    = (get("xpos",   float, 0.0), get("ypos",   float, 0.0))
    except:  self.position    = (eval(get("xpos")), eval(get("ypos")))
    glColor3f(*self.engine.theme.hexToColor(self.color))

    self.font.render(str(self.text), self.position)
 def render(self, visibility, topMost):
   try:
     font = self.engine.data.fontDict[self.engine.theme.characterCreateOptionFont]
     helpFont = self.engine.data.fontDict[self.engine.theme.characterCreateHelpFont]
   except KeyError:
     font = self.engine.data.font
     helpFont = self.engine.data.loadingFont
   self.engine.view.setOrthogonalProjection(normalize = True)
   v = ((1 - visibility) **2)
   w, h = self.fullView
   try:
     if self.background:
       wFactor = 640.000/self.background.width1()
       self.engine.drawImage(self.background, scale = (wFactor,-wFactor), coord = (w/2,h/2))
     helpFont.render(_("Player %d") % (self.playerNum + 1), pos = (.5, .1), scale = self.engine.theme.characterCreateScale, align = 1)
     for i, option in enumerate(self.options):
       r, g, b = self.engine.theme.characterCreateHelpColor
       glColor3f(r, g, b)
       cursor = ""
       if self.selected == i:
         wText, hText = helpFont.getStringSize(option[1], scale = self.engine.theme.characterCreateScale)
         helpFont.render(option[1], (self.engine.theme.characterCreateHelpX-(wText/2), self.engine.theme.characterCreateHelpY-hText), scale = self.engine.theme.characterCreateHelpScale)
         r, g, b = self.engine.theme.characterCreateSelectColor
         glColor3f(r, g, b)
         cursor = self.cursor
       else:
         r, g, b = self.engine.theme.characterCreateFontColor
         glColor3f(r, g, b)
       wText, hText = font.getStringSize(option[0], scale = self.engine.theme.characterCreateScale)
       font.render(option[0], (self.engine.theme.characterCreateX, self.engine.theme.characterCreateY+self.engine.theme.characterCreateSpace*i), scale = self.engine.theme.characterCreateScale)
       if self.active and self.selected == i:
         self.engine.theme.setSelectedColor(1-v)
       if i == 0 or i > 6:
         wText, hText = font.getStringSize(self.choices[i], scale = self.engine.theme.characterCreateScale)
         font.render(self.choices[i]+cursor, (self.engine.theme.characterCreateOptionX-wText, self.engine.theme.characterCreateY+self.engine.theme.characterCreateSpace*i), scale = self.engine.theme.characterCreateScale)
       else:
         if i == self.selected:
           str = "< %s >" % self.values[i-1][self.choices[i]]
         else:
           str = self.values[i-1][self.choices[i]]
         wText, hText = font.getStringSize(str, scale = self.engine.theme.characterCreateScale)
         font.render(str, (self.engine.theme.characterCreateOptionX-wText, self.engine.theme.characterCreateY+self.engine.theme.characterCreateSpace*i), scale = self.engine.theme.characterCreateScale)
     if self.backgroundTop:
       wFactor = 640.000/self.backgroundTop.width1()
       self.engine.drawImage(self.backgroundTop, scale = (wFactor,-wFactor), coord = (w/2,h/2))
   finally:
     self.engine.view.resetProjection()
  def render(self, visibility, topMost):
    #MFH - display version in any menu:

    if not visibility:
      self.active = False
      return

    self.active = True
    if self.graphicMenu and self.menuBackground:
      self.engine.graphicMenuShown = True
    else:
      self.engine.graphicMenuShown = False
    
    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      v = (1 - visibility) ** 2
      # Default to this font if none was specified

      font = self.font
      tipFont = self.tipFont

      if self.fadeScreen:
        Dialogs.fadeScreen(v)
        
      wS, hS = self.engine.view.geometry[2:4]
        
      if self.graphicMenu and self.menuBackground:
        #volshebnyi - better menu scaling
        self.engine.drawImage(self.menuBackground, scale = (1.0,-1.0), coord = (wS/2,hS/2), stretched = 3)
      else:
        glEnable(GL_BLEND)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
        glEnable(GL_COLOR_MATERIAL)

      n = len(self.choices)
      x, y = self.pos

      for i, choice in enumerate(self.choices[self.viewOffset:self.viewOffset + self.viewSize]):
        if self.graphicMenu:
          if self.currentIndex == i:
            xpos = (.5,1)
          else:
            xpos = (0,.5)
          ypos = float(i+self.viewOffset)
          self.menuText.transform.reset()
          self.menuText.transform.scale(.5*self.menuScale,(-1.0/n*self.menuScale))
          self.menuText.transform.translate(wS*self.menux,(hS*self.menuy)-(hS*self.vSpace)*i)
          self.menuText.draw(rect = (xpos[0],xpos[1],ypos/n,(ypos+1.0)/n))
          #self.engine.drawImage(self.menuText, scale = (self.menuScale,-self.menuScale*2/n), coord = (wS*self.menux,hS*(self.menuy-self.vSpace*i)), rect = (xpos[0],xpos[1],ypos/n,(ypos+1.0)/n), stretched = 11)
        else:
          text = choice.getText(i + self.viewOffset == self.currentIndex)
          glPushMatrix()
          glRotate(v * 45, 0, 0, 1)

          scale = 0.002
          if self.mainMenu and self.theme < 2 and i % 2 == 1:#8bit
              scale = 0.0016

          w, h = font.getStringSize(" ", scale = scale)

          # Draw arrows if scrolling is needed to see all items
          if i == 0 and self.viewOffset > 0:
            self.engine.theme.setBaseColor((1 - v) * max(.1, 1 - (1.0 / self.viewOffset) / 3))
            glPushMatrix()
            glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
            self.renderTriangle(up = (0, -1), s = .015)
            glPopMatrix()
          elif i == self.viewSize - 1 and self.viewOffset + self.viewSize < n:
            self.engine.theme.setBaseColor((1 - v) * max(.1, 1 - (1.0 / (n - self.viewOffset - self.viewSize)) / 3))
            glPushMatrix()
            glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
            self.renderTriangle(up = (0, 1), s = .015)
            glPopMatrix()

          if i + self.viewOffset == self.currentIndex:
            if choice.tipText and self.showTips:
              if self.tipColor:
                c1, c2, c3 = self.tipColor
                glColor3f(c1,c2,c3)
              elif self.textColor:
                c1, c2, c3 = self.textColor
                glColor3f(c1,c2,c3)
              else:
                self.engine.theme.setBaseColor(1-v)
              tipScale = self.tipScale
              if self.tipScroll > -(self.tipSize) and self.tipScroll < 1:
                tipFont.render(choice.tipText, (self.tipScroll, self.tipY), scale = tipScale)
              if self.tipScrollMode == 0:
                if self.tipScrollB > -(self.tipSize) and self.tipScrollB < 1:
                  tipFont.render(choice.tipText, (self.tipScrollB, self.tipY), scale = tipScale)
            a = (math.sin(self.time) * .15 + .75) * (1 - v * 2)
            self.engine.theme.setSelectedColor(a)
            a *= -.005
            glTranslatef(a, a, a)
          else:
            self.engine.theme.setBaseColor(1 - v)      
        
          #MFH - settable color through Menu constructor
          if i + self.viewOffset == self.currentIndex and self.selectedColor:
            c1,c2,c3 = self.selectedColor
            glColor3f(c1,c2,c3)
          elif self.textColor:
            c1,c2,c3 = self.textColor
            glColor3f(c1,c2,c3)
        
          #MFH - now to catch " >" main menu options and blank them:
          if text == " >":
            text = ""
            
          if self.engine.data.submenuSelectFound and len(text) > 0 and not self.mainMenu and self.useSelectedBox:
            Tw, Th = font.getStringSize(text,scale)
            lineSpacing = font.getLineSpacing(scale)
            frameWidth = Tw*1.10
            #frameHeight = (Th+Th2)*1.10
            frameHeight = Th + lineSpacing
            boxXOffset = (x + (Tw/2))*wS
            boxYOffset = (1.0 - (y*4.0/3.0) - (Th*1.2/2))*hS
            subSelectHYFactor = 640.000/self.engine.view.aspectRatio
            subSelectHFactor = subSelectHYFactor/self.engine.data.subSelectImgH
            self.engine.data.submenuSelect.transform.reset()
            tempWScale = frameWidth*self.engine.data.subSelectWFactor
            tempHScale = -(frameHeight)*subSelectHFactor
            self.engine.data.submenuSelect.transform.scale(tempWScale,tempHScale)
            self.engine.data.submenuSelect.transform.translate(boxXOffset,boxYOffset)
            self.engine.data.submenuSelect.draw()
          
          font.render(text, (x - v / 4, y), scale = scale)
        
        
          v *= 2
          if self.theme == 1 and self.font == self.engine.data.pauseFont: # evilynux - Ugly workaround for Gh3
            y += h*.70      #Worldrave - Changed Pause menu spacing back to .70 from .65 for now.
          else:
            y += h
          glPopMatrix()
    
    
    finally:
      self.engine.view.resetProjection()
  def render(self, visibility, topMost):
    self.engine.view.setOrthogonalProjection(normalize = True)
    
    try:
      font = self.engine.data.font
      scale = 0.0008
      glColor3f(.25, 1, .25)

      x, y = (.05, .05)
      h = font.getHeight() * scale
      
      font.render("Tasks:", (x, y), scale = scale)
      for task in self.engine.tasks + self.engine.frameTasks:
        font.render(self.className(task), (x + .1, y), scale = scale)
        y += h
        
      x, y = (.5, .05)
      font.render("Layers:", (x, y), scale = scale)
      for layer in self.engine.view.layers:
        try:
          v = self.engine.view.visibility[layer]
        except KeyError:
          v = -1
        font.render("%s - v = %.2f" % (self.className(layer), v), (x + .1, y), scale = scale)
        y += h
      glColor3f(.25, 1, .75)
      for layer in self.engine.view.incoming:
        font.render("Adding %s..."%self.className(layer), (x + .1, y), scale = scale)
        y += h
      glColor3f(1, .25, .25)
      for layer in self.engine.view.outgoing:
        font.render("Removing %s..."%self.className(layer), (x + .1, y), scale = scale)
        y += h
      
      glColor3f(.25, 1, .25)
      x, y = (.05, .4)
      font.render("Current Scene:", (x, y), scale = scale)
      if self.engine.world:
        text = self.engine.world.sceneName
        if text == "":
          text = "None (In Lobby)"
      else:
        text = "None (In Menu)"
      font.render(text, (x + .1, y), scale = scale)
      y += h
        
      x, y = (.5, .4)
      font.render("Loaders:", (x, y), scale = scale)
      for loader in self.engine.resource.loaders:
        font.render(str(loader), (x + .1, y), scale = scale)
        y += h
        
      x, y = (.5, .55)
      font.render("Input:", (x, y), scale = scale)
      for listener in self.engine.input.mouseListeners + \
                      self.engine.input.keyListeners + \
                      self.engine.input.systemListeners:
        font.render(self.className(listener), (x + .1, y), scale = scale)
        y += h
      for listener in self.engine.input.priorityKeyListeners:
        font.render(self.className(listener)+" (Priority)", (x + .1, y), scale = scale)
        y += h
        
      x, y = (.05, .55)
      font.render("System:", (x, y), scale = scale)
      font.render("%d threads" % threading.activeCount(), (x + .1, y), scale = scale)
      y += h
      font.render("%.2f fps" % self.engine.fpsEstimate, (x + .1, y), scale = scale)
      #y += h
      #font.render("%d sessions, server %s" % (len(self.engine.sessions), self.engine.server and "on" or "off"), (x + .1, y), scale = scale)
      #y += h
      #font.render("%d gc objects" % len(gc.get_objects()), (x + .1, y), scale = scale)
      #y += h
      #font.render("%d collected" % gc.collect(), (x + .1, y), scale = scale)

    finally:
      self.engine.view.resetProjection()
Example #6
0
  def renderSelectedInfo( self, scene ):
    ( w, h ) = scene.geometry
    font = scene.fontDict['songListFont']
    item = scene.selectedItem

    #weirdpeople - This renders stuff about only the currently selected song
    if isinstance( item, Song.SongInfo ):

      #albumtag = item.album
      #( wt, ht ) = font.getStringSize( albumtag, scale = scale )

      #while wt > .22:
      #  tlength = len( albumtag ) - 4
      #  albumtag = albumtag[:tlength] + '...'
      #  ( wt, ht ) = font.getStringSize( albumtag, scale = scale )
      #  if wt < .08:
      #    break

      #font.render( albumtag, ( .08, .35 ), scale = 0.00150001 )

      #genretag = item.genre
      #font.render( genretag, ( .08, .37 ), scale = 0.00150001 )

      #yeartag = item.year
      #font.render( yeartag, ( .08, .39 ), scale = 0.00150001 )

      imgwidth = scene.img_guitar.width1()
      wfactor1 = 15.5 / imgwidth

      scene.drawImage( scene.img_band, scale = ( wfactor1, -wfactor1), coord = (.725 * w, .465 * h ), stretched = 11 )

      scene.drawImage( scene.img_guitar, scale = ( wfactor1, -wfactor1), coord = (.725 * w, .41 * h ), stretched = 11 )
      scene.drawImage( scene.img_proguitar, scale = ( wfactor1, -wfactor1), coord = (.845 * w, .41 * h ), stretched = 11 )

      scene.drawImage( scene.img_bass, scale = ( wfactor1, -wfactor1), coord = (.725 * w, .355 * h ), stretched = 11 )
      scene.drawImage( scene.img_probass, scale = ( wfactor1, -wfactor1), coord = (.845 * w, .355 * h ), stretched = 11 )

      scene.drawImage( scene.img_drum, scale = ( wfactor1, -wfactor1), coord = (.725 * w, .30 * h ), stretched = 11 )
      scene.drawImage( scene.img_prodrum, scale = ( wfactor1, -wfactor1), coord = (.845 * w, .30 * h ), stretched = 11 )

      scene.drawImage( scene.img_keys, scale = ( wfactor1, -wfactor1), coord = (.725 * w, .245 * h ), stretched = 11 )
      scene.drawImage( scene.img_prokeys, scale = ( wfactor1, -wfactor1), coord = (.845 * w, .245 * h ), stretched = 11 )

      scene.drawImage( scene.img_vocal, scale = ( wfactor1, -wfactor1), coord = (.725 * w, .19 * h ), stretched = 11 )
      scene.drawImage( scene.img_vocalharm3, scale = ( wfactor1, -wfactor1), coord = (.845 * w, .19 * h ), stretched = 11 )

      if scene.img_diff3 != None:
        imgwidth = scene.img_diff3.width1()

        wfactor1 = .9 / imgwidth

      for i in range( 6 ):
        glColor3f( 1, 1, 1 )
        if i == 0:
          diff = item.diffSong
        elif i == 1:
          diff = item.diffGuitar
        elif i == 2:
          diff = item.diffDrums
        elif i == 3:
          diff = item.diffBass
        elif i == 4:
          diff = -2
        elif i == 5:
          diff = item.diffVocals
        if diff == -1:
          font.render( 'NO PART', ( .75, .4035 + i * 0.0415 ), scale = 0.00125 )
        elif diff == -2:
          font.render( 'N/A', ( .75, .4035 + i * 0.0415 ), scale = 0.00125 )#that specific instrument isn't implemented in fofix
        elif diff == 6:
          for k in range( 0, 5 ):
            scene.drawImage( scene.img_diff3, scale = ( wfactor1, -wfactor1), coord = ( ( .75 + .016 * k ) * w, ( 0.466 - 0.055 * i ) * h ), stretched = 11 )
        else:
          for k in range( 0, 5):
            scene.drawImage( scene.img_diff1, scale = ( wfactor1, -wfactor1), coord = ( ( .75 + .016 * k ) * w, ( 0.466 - 0.055 * i ) * h ), stretched = 11 )
          for k in range( 0, diff ):
            scene.drawImage( scene.img_diff2, scale = ( wfactor1, -wfactor1), coord = ( ( .75 + .016 * k ) * w, ( 0.466 - 0.055 * i ) * h ), stretched = 11 )

      for i in range( 5 ):#for when pro  instruments start toet implemented
        glColor3f( 1, 1, 1 )

        if i == 0:#pro guitar
          diff = -2

        elif i == 1:#pro drums
          diff = -2

        elif i == 2:#pro bass
          diff = -2

        elif i == 3:#pro keys
          diff = -2

        elif i == 4:#vocal harmonies
          diff = -2


        if diff == -1:
          font.render( 'NO PART', ( .87, .445 + i * .0415 ), scale = 0.00125 )

        elif diff == -2:
          font.render( 'N/A', ( .87, .445 + i * .0415 ), scale = 0.00125 )#that specific instrument isn't implemented in fofix

        elif diff == 6:
          for k in range( 0, 5 ):
            scene.drawImage( scene.img_diff3, scale = ( wfactor1, -wfactor1), coord = ( ( .86 + .016 * k ) * w, ( 0.466 - 0.055 * i ) * h ), stretched = 11 )

        else:
          for k in range( 0, 5):
            scene.drawImage( scene.img_diff1, scale = ( wfactor1, -wfactor1), coord = ( ( .87 + .016 * k ) * w, ( 0.466 - 0.055 * i ) * h ), stretched = 11 )
          for k in range( 0, diff ):
            scene.drawImage( scene.img_diff2, scale = ( wfactor1, -wfactor1), coord = ( ( .87 + .016 * k ) * w, ( 0.466 - 0.055 * i ) * h ), stretched = 11 )
Example #7
0
  def renderSelectedItem( self, scene, n ):
    ( w, h ) = scene.geometry
    font = scene.fontDict['songListFont']

    item = scene.selectedItem
    if not item:
      return
    if isinstance( item, Song.BlankSpaceInfo ):
      return

    if scene.img_tier:
      imgwidth = scene.img_tier.width1()
      imgheight = scene.img_tier.height1()
      wfactor = 1160.0/imgwidth
      hfactor = 60.00/imgheight
      if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo):
        scene.drawImage(scene.img_tier, scale = (wfactor,-hfactor), coord = (w/2.8762, ((-n*.0565)*h )+ h/1.235), stretched = 11)
      
    if scene.img_selected:
      imgwidth = scene.img_selected.width1()
      imgheight = scene.img_selected.height1()
      wfactor = 1160.0/imgwidth
      hfactor = 60.00/imgheight

      scene.drawImage(scene.img_selected, scale = (wfactor,-hfactor), coord = (w/2.8762, ((-n*.0565)*h )+ h/1.235), stretched = 11)
    icon = None
    if isinstance( item, Song.SongInfo ) and scene.practiceMode:
      ( c1, c2, c3 ) = self.song_name_selected_color
      glColor3f( c1, c2, c3 )
      text = _( 'Practice' )
    elif isinstance( item, Song.LibraryInfo ):
      ( c1, c2, c3 ) = self.library_selected_color
      glColor3f( c1, c2, c3 )
      if item.songCount == 1:
        text = _( 'There Is 1 Song In This Setlist.' )
      elif item.songCount > 1:
        text = _( 'There Are %d Songs In This Setlist.' ) % item.songCount
      else:
        text = ''
    else:
      text = ''

    font.render( text, ( 0.05, .155 ), scale = 0.0015, align = 2 )

    if isinstance( item, Song.SongInfo ) or isinstance( item, Song.LibraryInfo ) or isinstance( item, Song.RandomSongInfo ):
      ( c1, c2, c3 ) = self.song_name_selected_color
      glColor4f( c1, c2, c3, 1 )
    if isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ):
      ( c1, c2, c3 ) = self.career_title_color
      glColor4f( c1, c2, c3, 1 )

    text = item.name

    maxwidth = .43

    scale = 0.0016
    ( wt, ht ) = font.getStringSize( text, scale = scale )

    while wt > maxwidth:
      tlength = len( text ) - 2
      text = text[:tlength] + '...'
      ( wt, ht ) = font.getStringSize( text, scale = scale )
      if wt < maxwidth:
        break

    font.render( text, ( .07, .043 * ( n + 1 ) + .098 ), scale = scale )

    if isinstance( item, Song.SongInfo ):
      score = _( "Nil" )
      stars = 0
      name = ""
      if not item.getLocked():
        try:
          difficulties = item.partDifficulties[scene.scorePart.id]
        except KeyError:
          difficulties = []
        for d in difficulties:
          if d.id == scene.scoreDifficulty.id:
            scores = item.getHighscores( d, part = scene.scorePart )
            if scores:
              ( score, stars, name, scoreExt ) = scores[0]
              try:
                ( 
                  notesHit,
                  notesTotal,
                  noteStreak,
                  modVersion,
                  handicap,
                  handicapLong,
                  originalScore,
                  ) = scoreExt
              except ValueError:
                ( 
                  notesHit,
                  notesTotal,
                  noteStreak,
                  modVersion,
                  oldScores1,
                  oldScores2,
                  ) = scoreExt

              break
            else:
              ( score, stars, name ) = ( 0, 0, '---' )

        if score == _( 'Nil' ) and scene.nilShowNextScore:
          for d in difficulties:
            scores = item.getHighscores( d, part = scene.scorePart )
            if scores:
              ( score, stars, name, scoreExt ) = scores[0]
              try:
                ( 
                  notesHit,
                  notesTotal,
                  noteStreak,
                  modVersion,
                  handicap,
                  handicapLong,
                  originalScore,
                  ) = scoreExt
              except ValueError:
                ( 
                  notesHit,
                  notesTotal,
                  noteStreak,
                  modVersion,
                  oldScores1,
                  oldScores2,
                  ) = scoreExt
              break
            else:
              ( score, stars, name ) = ( 0, 0, '---' )
          else:
            ( score, stars, name ) = ( _( 'Nil' ), 0, '---' )

        scale = 0.0010
        if score != _( 'Nil' ) and score > 0 and notesTotal != 0:
          text = '%.1f%%' % ( float( notesHit ) / notesTotal * 100.0)
          ( w, h ) = font.getStringSize( text, scale = scale )
          font.render( text, ( 0.56, .043 * ( n + 1 ) + .098 ), scale = scale, align = 2 )


        if scene.img_starwhite and scene.img_stargold:
          ( w, h ) = scene.geometry
          imgwidth = scene.img_starwhite.width1()
          wfactor1 = 2.0 / imgwidth

          if stars == 6:
            for k in range( 0, 5 ):
              scene.drawImage( scene.img_stargold, scale = ( wfactor1 * 1.2, -wfactor1 * 1.2), coord = ( ( .58 + .025 * k ) * w, ((-n*.0565)*h )+ h/1.235), stretched = 11 )
          else:
            for k in range( 0, stars ):
              scene.drawImage( scene.img_starwhite, scale = ( wfactor1 * 1.2, -wfactor1 * 1.2), coord = ( ( .58 + .025 * k ) * w, ((-n*.0565)*h )+ h/1.235), stretched = 11 )
Example #8
0
    def renderPanels( self, lobby ):
        x = self.lobbyPanelPos[0]
        y = self.lobbyPanelPos[1]
        ( w, h ) = lobby.geometry

        controlFont = lobby.fontDict[self.lobbyControlFont]
        optionFont = lobby.fontDict[self.lobbyOptionFont]
        wP = w * self.lobbyPanelSize[0]
        hP = h * self.lobbyPanelSize[1]
        glColor3f( *self.lobbyHeaderColor )
        for i in range( 4 ):
            j = lobby.panelOrder[i]
            if j in lobby.blockedPlayers or len( lobby.selectedPlayers ) \
                == lobby.maxPlayers:
                glColor3f( *self.lobbyDisabledColor )
            else:
                glColor3f( *self.lobbyHeaderColor )
            if i == lobby.keyControl and lobby.img_keyboard_panel:
                lobby.drawImage( lobby.img_keyboard_panel,
                                scale = ( self.lobbyPanelSize[0],
                                - self.lobbyPanelSize[1] ), coord = ( wP
                                * .5 + w * x, hP * .5 + h * y ),
                                stretched = 3 )
            elif lobby.img_panel:
                lobby.drawImage( lobby.img_panel,
                                scale = ( self.lobbyPanelSize[0],
                                - self.lobbyPanelSize[1] ), coord = ( wP
                                * .5 + w * x, hP * .5 + h * y ),
                                stretched = 3 )
            if i == lobby.keyControl and lobby.img_keyboard:
                lobby.drawImage( lobby.img_keyboard,
                                scale = ( self.lobbyKeyboardImgScale,
                                - self.lobbyKeyboardImgScale ), coord = ( wP
                                * self.lobbyKeyboardImgPos[0] + w * x,
                                hP * self.lobbyKeyboardImgPos[1] + h
                                * y ) )
            controlFont.render( lobby.controls[j],
                               ( self.lobbyPanelSize[0]
                               * self.lobbyControlPos[0] + x,
                               self.lobbyPanelSize[1]
                               * self.lobbyControlPos[1] + y ),
                               scale = self.lobbyControlScale,
                               align = self.lobbyControlAlign, new = True )
            self.drawPartImage( lobby, lobby.types[j],
                               scale = ( self.lobbyPartScale,
                               - self.lobbyPartScale ), coord = ( wP
                               * self.lobbyPartPos[0] + w * x, hP
                               * self.lobbyPartPos[1] + h * y ) )

            for ( l, k ) in enumerate( range( lobby.pos[j][0],
                                    lobby.pos[j][1] + 1 ) ):
                if k >= len( lobby.options ):
                    break
                if lobby.selected[j] == k and ( j
                        not in lobby.blockedPlayers or j
                        in lobby.selectedPlayers ):
                    if lobby.img_selected:
                        lobby.drawImage( lobby.img_selected, scale = ( .5,
                                - .5 ), coord = ( wP * .5 + w * x, hP * ( .46
                                * .75 ) + h * y - h * .04 * l / .75 ) )
                    if lobby.avatars[k]:
                        pass
                    elif k == 0 and lobby.img_newchar_av:
                        pass
                    elif lobby.img_default_av:
                        pass
                    glColor3f( *self.lobbySelectedColor )
                elif k in lobby.blockedItems or j \
                    in lobby.blockedPlayers:
                    glColor3f( *self.lobbyDisabledColor )
                else:
                    glColor3f( *self.lobbyOptionColor )
                if k == 1:
                    if lobby.img_save_char:
                        lobby.drawImage( lobby.img_save_char, scale = ( .5,
                                - .5 ), coord = ( wP * .5 + w * x, hP * ( .46
                                * .75 ) + h * y - h * .04 * l / .75 ) )
                    else:
                        glColor3f( *self.lobbySaveCharColor )
                        lobby.fontDict[self.lobbySaveCharFont].render( lobby.options[k],
                                ( self.lobbyPanelSize[0]
                                * self.lobbyOptionPos[0] + x,
                                self.lobbyPanelSize[1]
                                * self.lobbyOptionPos[1] + y
                                + self.lobbyOptionSpace * l ),
                                scale = self.lobbySaveCharScale,
                                align = self.lobbySaveCharAlign, new = True )
                else:
                    optionFont.render( lobby.options[k],
                            ( self.lobbyPanelSize[0]
                            * self.lobbyOptionPos[0] + x,
                            self.lobbyPanelSize[1]
                            * self.lobbyOptionPos[1] + y
                            + self.lobbyOptionSpace * l ),
                            scale = self.lobbyOptionScale,
                            align = self.lobbyOptionAlign, new = True )
            x += self.lobbyPanelSpacing
  def textureSetup(self):
    # Free memory if we already allocated space for textures.
    if len(self.animTexs) > 0:
      glDeleteTextures(self.animTexs)

    self.animTexs = glGenTextures(len(self.animImgs))
    for texIdx, img in enumerate(self.animImgs):
      animSize = img.get_size()
      if img.get_alpha is None:
        color = "RGB"
        colorGL = GL_RGB
      else:
        color = "RGBA"
        colorGL = GL_RGBA
      
#       Log.debug("AnimationPlayer: Image %d format: %s (%dx%d)" % (texIdx, color, animSize[0], animSize[1]))
      glBindTexture(GL_TEXTURE_2D, self.animTexs[texIdx])
      surfaceData = pygame.image.tostring(img, color, True)
      # Linear filtering
      glTexImage2D(GL_TEXTURE_2D, 0, 3, animSize[0], animSize[1], 0, colorGL,
                   GL_UNSIGNED_BYTE, surfaceData)
      # MipMapping
#       gluBuild2DMipmaps(GL_TEXTURE_2D, colorGL,
#                         animSize[0], animSize[1], colorGL,
#                         GL_UNSIGNED_BYTE, surfaceData)
      glTexParameteri(GL_TEXTURE_2D, 
                      GL_TEXTURE_MAG_FILTER, GL_LINEAR)
      glTexParameteri(GL_TEXTURE_2D,
                      GL_TEXTURE_MIN_FILTER, GL_LINEAR)
      Log.debug("AnimationPlayer progress: %d%%" % \
                ( 100*(texIdx+1+len(self.animImgs)) / \
                  (2*len(self.animImgs)) ))

    # Resize animation (polygon) to respect resolution ratio
    # (The math is actually simple, take the time to draw it down if required)
    winRes = float(self.winWidth)/float(self.winHeight)
    animWidth = float(self.animImgs[0].get_size()[0])
    animHeight = float(self.animImgs[0].get_size()[1])
    animRes = animWidth/animHeight
    vtxX = 1.0
    vtxY = 1.0
    if winRes > animRes:
      r = float(self.winHeight)/animHeight
      vtxX = 1.0 - abs(self.winWidth-r*animWidth) / (float(self.winWidth))
    elif winRes < animRes:
      r = float(self.winWidth)/animWidth
      vtxY = 1.0 - abs(self.winHeight-r*animHeight) / (float(self.winHeight))

    # Vertices
    animVtx = array([[-vtxX,  vtxY],
                     [ vtxX, -vtxY],
                     [ vtxX,  vtxY],
                     [-vtxX,  vtxY],
                     [-vtxX, -vtxY],
                     [ vtxX, -vtxY]], dtype=float32)
    # Texture coordinates
    texCoord = array([[0.0, 1.0],
                      [1.0, 0.0],
                      [1.0, 1.0],
                      [0.0, 1.0],
                      [0.0, 0.0],
                      [1.0, 0.0]], dtype=float32)
    
    # Create a compiled OpenGL call list and do array-based drawing
    # Could have used GL_QUADS but IIRC triangles are recommended
    self.animList = cmglList()
    with self.animList:
      glEnable(GL_TEXTURE_2D)
      glColor3f(1., 1., 1.)
      cmglDrawArrays(GL_TRIANGLE_STRIP, vertices=animVtx, texcoords=texCoord)
      glDisable(GL_TEXTURE_2D)
Example #10
0
    def renderSelectedInfo( self, scene ):
        if self.setlist_type == 3:
            ( w, h ) = scene.geometry
            font = scene.fontDict['songListFont']
            item = scene.selectedItem
            if isinstance( item, Song.SongInfo ):
                text = item.artist
                if item.getLocked():
                    text = ''

                scale = 0.00160001
                ( wt, ht ) = font.getStringSize( text, scale = scale )

                while wt > .22:
                    tlength = len( text ) - 4
                    text = text[:tlength] + '...'
                    ( wt, ht ) = font.getStringSize( text, scale = scale )
                    if wt < .08:
                        break

                ( c1, c2, c3 ) = self.artist_text_color
                glColor3f( c1, c2, c3 )

                text = string.upper( text )
                font.render( text, ( .08, .33 ), scale = scale )

                if scene.img_diff3 != None:
                    imgwidth = scene.img_diff3.width1()

                    wfactor1 = 2.0 / imgwidth

                albumtag = item.album
                albumtag = string.upper( albumtag )
                ( wt, ht ) = font.getStringSize( albumtag, scale = scale )

                while wt > .22:
                    tlength = len( albumtag ) - 4
                    albumtag = albumtag[:tlength] + '...'
                    ( wt, ht ) = font.getStringSize( albumtag, scale = scale )
                    if wt < .08:
                        break

                font.render( albumtag, ( .08, .35 ),
                            scale = 0.00150001 )

                genretag = item.genre
                font.render( genretag, ( .08, .37 ),
                            scale = 0.00150001 )

                yeartag = item.year
                font.render( yeartag, ( .08, .39 ),
                            scale = 0.00150001 )

                for i in range( 5 ):
                    glColor3f( 1, 1, 1 )
                    if i == 0:
                        diff = item.diffSong
                    elif i == 1:
                        diff = item.diffGuitar
                    elif i == 2:
                        diff = item.diffDrums
                    elif i == 3:
                        diff = item.diffBass
                    elif i == 4:
                        diff = item.diffVocals
                    if scene.img_diff1 == None or scene.img_diff2 \
                        == None or scene.img_diff3 == None:
                        if diff == -1:
                            font.render( ' ', ( .3, .5585 + i * .025 ),
                                    scale = 0.00150001 )
                        elif diff == 6:
                            glColor3f( 1, 1, 0 )
                            font.render( str( '*' * ( diff - 1 ) ), ( .3,
                                    0.5525 + i * .025 ),
                                    scale = 0.00150001 )
                        else:
                            font.render( str( '*' * diff + ' ' * ( 5
                                    - diff ) ), ( .3, 0.5525 + i * .025 ),
                                    scale = 0.00150001 )
                    else:
                        if diff == -1:
                            font.render( ' ', ( .3, .5585 + i * .025 ),
                                    scale = 0.00150001 )
                        elif diff == 6:
                            for k in range( 0, 5 ):
                                scene.drawImage( scene.img_diff3,
                                        scale = ( wfactor1 * .1, -wfactor1
                                        * .1 ), coord = ( ( .25 + .03 * k )
                                        * w, ( 0.38 - .028 * i ) * h ), stretched = 11 )
                        else:
                            for k in range( 0, diff ):
                                scene.drawImage( scene.img_diff2,
                                        scale = ( wfactor1 * .1, -wfactor1
                                        * .1 ), coord = ( ( .25 + .03 * k )
                                        * w, ( 0.38 - .028 * i ) * h ), stretched = 11 )
                            for k in range( 0, 5 - diff ):
                                scene.drawImage( scene.img_diff1,
                                        scale = ( wfactor1 * .1, -wfactor1
                                        * .1 ), coord = ( ( .37 - .03 * k )
                                        * w, ( 0.38 - .028 * i ) * h ), stretched = 11 )
Example #11
0
    def renderForeground( self, scene ):
        font = scene.fontDict['songListFont']
        ( w, h ) = scene.geometry
        if self.setlist_type == 3:
            font = scene.fontDict['songListFont']

            ( c1, c2, c3 ) = self.song_rb2_diff_color
            glColor3f( c1, c2, c3 )

            scale = 0.00160001
            text = _( 'BAND:' )
            font.render( text, ( .08, .4665 ), scale = scale )
            text = _( 'GUITAR:' )
            font.render( text, ( .08, .4867 ), scale = scale )
            text = _( 'DRUM:' )
            font.render( text, ( .08, .5069 ), scale = scale )
            text = _( 'BASS:' )
            font.render( text, ( .08, .5271 ), scale = scale )
            text = _( 'VOCALS:' )
            font.render( text, ( .08, .5473 ), scale = scale )

            text = _( 'SORTING:' ) + '     '
            if scene.sortOrder == 0:
                text = text + _( 'ALPHABETICALLY BY TITLE' )
            elif scene.sortOrder == 1:


                text = text + _( 'ALPHABETICALLY BY ARTIST' )
            elif scene.sortOrder == 2:


                text = text + _( 'BY PLAY COUNT' )
            elif scene.sortOrder == 3:


                text = text + _( 'ALPHABETICALLY BY ALBUM' )
            elif scene.sortOrder == 4:


                text = text + _( 'ALPHABETICALLY BY GENRE' )
            elif scene.sortOrder == 5:


                text = text + _( 'BY YEAR' )
            elif scene.sortOrder == 6:


                text = text + _( 'BY BAND DIFFICULTY' )
            elif scene.sortOrder == 7:


                text = text + _( 'BY INSTRUMENT DIFFICULTY' )
            else:
                text = text + _( 'BY SONG COLLECTION' )

            font.render( text, ( .08, .155 ), scale = 0.00150001 )

            if scene.songLoader:
                font.render( _( 'Loading Preview...' ), ( .05, .7 ),
                            scale = 0.00150001 )
            return
        if scene.img_list_button_guide:
            scene.drawImage( scene.img_list_button_guide, scale = ( .5,
                            - .5 ), coord = ( w * .5, 0 ), fit = 2 )
        if scene.songLoader:
            font.render( _( 'Loading Preview...' ), ( .5, .7 ), align = 1 )
        if scene.searching:
            font.render( scene.searchText, ( .5, .7 ), align = 1 )
        if scene.img_list_fg:
            scene.drawImage( scene.img_list_fg, scale = ( 1.0, -1.0 ),
                            coord = ( w / 2, h / 2 ), stretched = 0 )
Example #12
0
    def renderSelectedItem( self, scene, n ):
        ( w, h ) = scene.geometry
        font = scene.fontDict['songListFont']

        item = scene.selectedItem
        if not item:
            return
        if isinstance( item, Song.BlankSpaceInfo ):
            return
        if self.setlist_type == 3:
            y = h * ( .7825 - .0459 * n )

            if scene.img_tier:
                imgwidth = scene.img_tier.width1()
                imgheight = scene.img_tier.height1()
                wfactor = 381.1 / imgwidth
                hfactor = 24.000 / imgheight
                if isinstance( item, Song.TitleInfo ) or isinstance( item,
                        Song.SortTitleInfo ):
                    scene.drawImage( scene.img_tier, scale = ( wfactor,
                                    - hfactor ), coord = ( w / 1.587, h
                                    - 0.055 * h * ( n + 1 ) - 0.219 * h ) )

            if scene.img_selected:
                imgwidth = scene.img_selected.width1()
                imgheight = scene.img_selected.height1()
                wfactor = 0.03

                scene.drawImage( scene.img_selected, scale = ( wfactor,
                                - wfactor ), coord = ( w / 1.587, y * 1.2
                                - h * .213 ), stretched = 11 )

            icon = None
            if isinstance( item, Song.SongInfo ):
                if item.icon != '':
                    try:
                        icon = scene.itemIcons[item.icon]
                        wfactor = 0.03
                        scene.drawImage( icon, scale = ( wfactor,
                                - wfactor ), coord = ( w / 1.052, h - 0.055
                                * h * ( n + 1 ) - 0.20000000000000001
                                * h ), stretched = 11 )
                    except KeyError:
                        pass

                ( c1, c2, c3 ) = self.song_name_selected_color
                glColor3f( c1, c2, c3 )
                if item.getLocked():
                    text = item.getUnlockText()
                elif scene.careerMode and not item.completed:
                    text = _( 'Play To Advance' )
                elif scene.practiceMode:
                    text = _( 'Practice' )
                elif item.count:
                    count = int( item.count )
                    if count == 1:
                        text = _( 'Played Once' )
                    else:
                        text = _( 'Played %d times.' ) % count
                else:
                    text = _( 'Quickplay' )
            elif isinstance( item, Song.LibraryInfo ):
                try:
                    icon = scene.itemIcons['Library']
                    wfactor = 0.03
                    scene.drawImage( icon, scale = ( wfactor, -wfactor ),
                                    coord = ( w / 1.052, h - 0.055 * h
                                    * ( n + 1 ) - 0.20000000000000001
                                    * h ), stretched = 11 )
                except KeyError:
                    pass
                ( c1, c2, c3 ) = self.library_selected_color
                glColor3f( c1, c2, c3 )
                if item.songCount == 1:
                    text = _( 'There Is 1 Song In This Setlist.' )
                elif item.songCount > 1:
                    text = _( 'There Are %d Songs In This Setlist.' ) \
                        % item.songCount
                else:
                    text = ''
            elif isinstance( item, Song.TitleInfo ) or isinstance( item,
                    Song.SortTitleInfo ):
                text = _( 'Tier' )
                ( c1, c2, c3 ) = self.career_title_color
                glColor3f( c1, c2, c3 )
            elif isinstance( item, Song.RandomSongInfo ):
                try:
                    icon = scene.itemIcons['Random']
                    wfactor = 0.03
                    scene.drawImage( icon, scale = ( wfactor, -wfactor ),
                                    coord = ( w / 1.052, h - 0.055 * h
                                    * ( n + 1 ) - 0.20000000000000001
                                    * h ), stretched = 11 )
                except KeyError:
                    pass
                text = _( 'Random Song' )
                ( c1, c2, c3 ) = self.career_title_color
                glColor3f( c1, c2, c3 )

            font.render( text, ( 0.92000000000000003, .155 ),
                        scale = 0.00150001, align = 2 )

            maxwidth = 0.20000000000000001
            if isinstance( item, Song.SongInfo ) or isinstance( item,
                    Song.LibraryInfo ) or isinstance( item,
                    Song.RandomSongInfo ):
                ( c1, c2, c3 ) = self.song_name_selected_color
                glColor4f( c1, c2, c3, 1 )
            if isinstance( item, Song.TitleInfo ) or isinstance( item,
                    Song.SortTitleInfo ):
                ( c1, c2, c3 ) = self.career_title_color
                glColor4f( c1, c2, c3, 1 )

            text = item.name

            if isinstance( item, Song.SongInfo ) and item.getLocked():
                text = _( '-- Locked --' )

            if isinstance( item, Song.SongInfo ):
                if scene.tiersPresent or icon:
                    text = '    ' + text

            if isinstance( item, Song.TitleInfo ) or isinstance( item,
                    Song.SortTitleInfo ):
                maxwidth = 0.20000000000000001
                text = string.upper( text )

            scale = 0.00160001
            ( wt, ht ) = font.getStringSize( text, scale = scale )

            while wt > maxwidth:
                tlength = len( text ) - 4
                text = text[:tlength] + '...'
                ( wt, ht ) = font.getStringSize( text, scale = scale )
                if wt < .45:
                    break

            font.render( text, ( .40, .0413 * ( n + 1 ) + .15 ), scale = scale )

            if isinstance( item, Song.SongInfo ):
                score = _( "Nil" )
                stars = 0
                name = ""
                if not item.getLocked():
                    try:
                        difficulties = \
                            item.partDifficulties[scene.scorePart.id]
                    except KeyError:
                        difficulties = []
                    for d in difficulties:
                        if d.id == scene.scoreDifficulty.id:
                            scores = item.getHighscores( d,
                                    part = scene.scorePart )
                            if scores:
                                ( score, stars, name, scoreExt ) = \
                                    scores[0]
                                try:
                                    ( 
                                        notesHit,
                                        notesTotal,
                                        noteStreak,
                                        modVersion,
                                        handicap,
                                        handicapLong,
                                        originalScore,
                                        ) = scoreExt
                                except ValueError:
                                    ( 
                                        notesHit,
                                        notesTotal,
                                        noteStreak,
                                        modVersion,
                                        oldScores1,
                                        oldScores2,
                                        ) = scoreExt

                                break
                            else:
                                ( score, stars, name ) = ( 0, 0, '---' )

                    if score == _( 'Nil' ) and scene.nilShowNextScore:
                        for d in difficulties:
                            scores = item.getHighscores( d,
                                    part = scene.scorePart )
                            if scores:
                                ( score, stars, name, scoreExt ) = \
                                    scores[0]
                                try:
                                    ( 
                                        notesHit,
                                        notesTotal,
                                        noteStreak,
                                        modVersion,
                                        handicap,
                                        handicapLong,
                                        originalScore,
                                        ) = scoreExt
                                except ValueError:
                                    ( 
                                        notesHit,
                                        notesTotal,
                                        noteStreak,
                                        modVersion,
                                        oldScores1,
                                        oldScores2,
                                        ) = scoreExt
                                break
                            else:
                                ( score, stars, name ) = ( 0, 0, '---' )
                        else:
                            ( score, stars, name ) = ( _( 'Nil' ), 0, '---' )

                    scale = 0.0010
                    if score != _( 'Nil' ) and score > 0 \
                        and notesTotal != 0:
                        text = '%.1f%% (%d)' % ( float( notesHit )
                                / notesTotal * 100.0, noteStreak )
                        ( w, h ) = font.getStringSize( text, scale = scale )
                        font.render( text, ( 0.92000000000000003, .0413
                                    * ( n + 1 ) + .163 ), scale = scale,
                                    align = 2 )

                    text = str( score )

                    font.render( text, ( 0.92000000000000003, .0413 * ( n
                                + 1 ) + .15 ), scale = scale, align = 2 )
Example #13
0
    def renderPanels( self, dialog ):
        self.dialog = dialog
        x = self.partDiffPanelPos[0]
        y = self.partDiffPanelPos[1]
        ( w, h ) = dialog.geometry
        font = dialog.fontDict['font']
        controlFont = dialog.fontDict[self.partDiffControlFont]
        panelNameFont = dialog.fontDict[self.partDiffPanelNameFont]
        wP = w * self.partDiffPanelSize[0]
        hP = h * self.partDiffPanelSize[1]

        glColor3f( *self.partDiffHeaderColor )
        if self.partDiffTitleText:
            dialog.fontDict[self.partDiffTitleTextFont].render( self.partDiffTitleText,
                    self.partDiffTitleTextPos,
                    scale = self.partDiffTitleTextScale,
                    align = self.partDiffTitleTextAlign )
        if self.partDiffSubtitleText:
            dialog.fontDict[self.partDiffSubtitleTextFont].render( self.partDiffSubtitleText,
                    self.partDiffSubtitleTextPos,
                    scale = self.partDiffSubtitleTextScale,
                    align = self.partDiffSubtitleTextAlign )
        for i in range( len( dialog.players ) ):
            glColor3f( *self.partDiffHeaderColor )
            dialog.fontDict[self.partDiffGameModeFont].render( dialog.gameModeText,
                    self.partDiffGameModePos,
                    scale = self.partDiffGameModeScale,
                    align = self.partDiffGameModeAlign )
            controlFont.render( dialog.players[i].name,
                               ( self.partDiffPanelSize[0]
                               * self.partDiffControlPos[0] + x,
                               self.partDiffPanelSize[1]
                               * self.partDiffControlPos[1] + y ),
                               scale = self.partDiffControlScale,
                               align = self.partDiffControlAlign,
                               new = True )
            panelNameFont.render( dialog.players[i].name.lower(), ( x + w
                                 * self.partDiffPanelNamePos[0], y + h
                                 * self.partDiffPanelNamePos[1] ),
                                 scale = self.partDiffPanelNameScale,
                                 align = self.partDiffPanelNameAlign,
                                 new = True )
            if dialog.mode[i] == 0:
                self.drawPartImage( dialog,
                                   dialog.parts[i][dialog.selected[i]].id,
                                   scale = ( self.partDiffPartScale,
                                   - self.partDiffPartScale ), coord = ( wP
                                   * self.partDiffPartPos[0] + w * x,
                                   hP * self.partDiffPartPos[1] + h
                                   * y ) )
                for p in range( len( dialog.parts[i] ) ):
                    if dialog.selected[i] == p:
                        glColor3f( *self.partDiffSelectedColor )
                    else:
                        glColor3f( *self.partDiffOptionColor )
                    font.render( str( dialog.parts[i][p] ), ( .09 * .5 * p
                                + x, 1.295 * .46 + y + .07 ),
                                scale = .001, align = 0, new = True )
            elif dialog.mode[i] == 1:


                self.drawPartImage( dialog, dialog.players[i].part.id,
                                   scale = ( self.partDiffPartScale,
                                   - self.partDiffPartScale ), coord = ( wP
                                   * self.partDiffPartPos[0] + w * x,
                                   hP * self.partDiffPartPos[1] + h
                                   * y ) )
                for d in \
                    range( len( dialog.info.partDifficulties[dialog.players[i].part.id] ) ):
                    if dialog.selected[i] == d:
                        glColor3f( *self.partDiffSelectedColor )
                    else:
                        glColor3f( *self.partDiffOptionColor )
                    font.render( str( dialog.info.partDifficulties[dialog.players[i].part.id][d] ),
                                ( .09 * .65 * d + x, 1.295 * .46 + y
                                + .07 ), scale = .001, align = 0, new = True )

            x += .24