当前位置: 首页>>代码示例>>Python>>正文


Python Theme.setBaseColor方法代码示例

本文整理汇总了Python中Theme.setBaseColor方法的典型用法代码示例。如果您正苦于以下问题:Python Theme.setBaseColor方法的具体用法?Python Theme.setBaseColor怎么用?Python Theme.setBaseColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Theme的用法示例。


在下文中一共展示了Theme.setBaseColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font
    
    try:
      v = (1 - visibility) ** 2
      
      fadeScreen(v)
      Theme.setBaseColor(1 - v)

      if (self.time % 10) < 5 and visibility > .9:
        cursor = "|"
      else:
        cursor = ""

      pos = wrapText(font, (.1, .33 - v), self.prompt)

      Theme.setSelectedColor(1 - v)
      
      if self.text is not None:
        pos = wrapText(font, (.1, (pos[1] + v) + .08 + v / 4), self.text)
        font.render(cursor, pos)
      
    finally:
      self.engine.view.resetProjection()
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:27,代码来源:Dialogs.py

示例2: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    v = (1 - visibility) ** 2

    # render the background

    t = self.time / 100
    w, h, = self.engine.view.geometry[2:4]
    r = .5

    if self.spinnyDisabled != True and Theme.spinnyEditorDisabled != True:      
      self.background.transform.reset()
      self.background.transform.translate(v * 2 * w + w / 2 + math.sin(t / 2) * w / 2 * r, h / 2 + math.cos(t) * h / 2 * r)
      self.background.transform.rotate(-t)
      self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
    self.background.draw()
      
    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font
    
    try:
      glEnable(GL_BLEND)
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
      glEnable(GL_COLOR_MATERIAL)
      Theme.setBaseColor(1 - v)
      wrapText(font, (.1, .05 - v), self.prompt)
    finally:
      self.engine.view.resetProjection()
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:29,代码来源:Dialogs.py

示例3: renderBars

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def renderBars(self, visibility, song, pos):
    if not song:
      return
    
    w            = self.boardWidth
    v            = 1.0 - visibility
    sw           = 0.02
    beatsPerUnit = self.beatsPerBoard / self.boardLength
    pos         -= self.lastBpmChange
    offset       = pos / self.currentPeriod * beatsPerUnit
    currentBeat  = pos / self.currentPeriod
    beat         = int(currentBeat)

    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    
    glPushMatrix()
    while beat < currentBeat + self.beatsPerBoard:
      z = (beat - currentBeat) / beatsPerUnit

      if z > self.boardLength * .8:
        c = (self.boardLength - z) / (self.boardLength * .2)
      elif z < 0:
        c = max(0, 1 + z)
      else:
        c = 1.0
        
      glRotate(v * 90, 0, 0, 1)

      if (beat % 1.0) < 0.001:
        Theme.setBaseColor(visibility * c * .75)
      else:
        Theme.setBaseColor(visibility * c * .5)

      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(-(w / 2), -v, z + sw)
      glVertex3f(-(w / 2), -v, z - sw)
      glVertex3f(w / 2,    -v, z + sw)
      glVertex3f(w / 2,    -v, z - sw)
      glEnd()
      
      if self.editorMode:
        beat += 1.0 / 4.0
      else:
        beat += 1
    glPopMatrix()

    Theme.setSelectedColor(visibility * .5)
    glBegin(GL_TRIANGLE_STRIP)
    glVertex3f(-w / 2, 0,  sw)
    glVertex3f(-w / 2, 0, -sw)
    glVertex3f(w / 2,  0,  sw)
    glVertex3f(w / 2,  0, -sw)
    glEnd()
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:56,代码来源:Guitar.py

示例4: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    if not self.song:
      return

    v = 1.0 - ((1 - visibility) ** 2)

    # render the background
    t = self.time / 100 + 34
    w, h, = self.engine.view.geometry[2:4]
    r = .5

    if self.spinnyDisabled != True and Theme.spinnyEditorDisabled:    
      self.background.transform.reset()
      self.background.transform.translate(w / 2 + math.sin(t / 2) * w / 2 * r, h / 2 + math.cos(t) * h / 2 * r)
      self.background.transform.rotate(-t)
      self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
    self.background.draw()

    self.camera.target = ( 2, 0, 5.5)
    self.camera.origin = (-2, 9, 5.5)

    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    gluPerspective(60, 4.0 / 3.0, 0.1, 1000)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()
    self.camera.apply()
    self.guitar.render(v, self.song, self.scrollPos, self.controls)

    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font

    try:
      Theme.setSelectedColor()

      w, h = font.getStringSize(" ")

      if self.song.isPlaying():
        status = str("Playing")
      else:
        status = str("Stopped")

      t = "%d.%02d'%03d" % (self.pos / 60000, (self.pos % 60000) / 1000, self.pos % 1000)
      font.render(t, (.05, .05 - h / 2))
      font.render(status, (.05, .05 + h / 2))
      font.render(unicode(self.song.difficulty[0]), (.05, .05 + 3 * h / 2))

      Theme.setBaseColor()
      text = self.song.info.name + (self.modified and "*" or "")
      Dialogs.wrapText(font, (.5, .05 - h / 2), text)
    finally:
      self.engine.view.resetProjection()
开发者ID:Gamer125,项目名称:fofix,代码行数:54,代码来源:Editor.py

示例5: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    v = (1 - visibility) ** 2

    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font

    try:
      w, h = font.getStringSize(" ")

      Theme.setSelectedColor()
      font.render(_("Importing Songs"), (.05, .05 - v))
      if self.stageInfoText:
        font.render("%s (%d%%)" % (self.stageInfoText, 100 * self.stageProgress), (.05, .7 + v), scale = 0.001)

      Theme.setBaseColor()
      Dialogs.wrapText(font, (.1, .3 + v), self.statusText)
    finally:
      self.engine.view.resetProjection()
开发者ID:fretsonfire,项目名称:fof-python,代码行数:20,代码来源:Editor.py

示例6: renderTracks

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def renderTracks(self, visibility):
    w = self.boardWidth / self.strings
    v = 1.0 - visibility

    if self.editorMode:
      x = (self.strings / 2 - self.selectedString) * w
      s = 2 * w / self.strings
      z1 = -0.5 * visibility ** 2
      z2 = (self.boardLength - 0.5) * visibility ** 2
      
      glColor4f(1, 1, 1, .15)
      
      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(x - s, 0, z1)
      glVertex3f(x + s, 0, z1)
      glVertex3f(x - s, 0, z2)
      glVertex3f(x + s, 0, z2)
      glEnd()

    sw = 0.035
    glEnable(GL_TEXTURE_2D)
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    Theme.setBaseColor(1 - v)
    self.stringDrawing.texture.bind()
    for n in range(self.strings - 1, -1, -1):
      glBegin(GL_TRIANGLE_STRIP)
      glTexCoord2f(0.0, 0.0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, -2)
      glTexCoord2f(1.0, 0.0)
      glVertex3f((n - self.strings / 2) * w + sw, -v, -2)
      glTexCoord2f(0.0, 1.0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, self.boardLength)
      glTexCoord2f(1.0, 1.0)
      glVertex3f((n - self.strings / 2) * w + sw, -v, self.boardLength)
      glEnd()
      v *= 2
    glDisable(GL_TEXTURE_2D)
开发者ID:fretsonfire,项目名称:fof-python,代码行数:40,代码来源:Guitar.py

示例7: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    if not visibility:
      return

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      v = (1 - visibility) ** 2
      font = self.engine.data.font

      if self.fadeScreen:
        Dialogs.fadeScreen(v)
      
      glEnable(GL_BLEND)
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
      glEnable(GL_COLOR_MATERIAL)

      n = len(self.choices)
      x, y = self.pos
      w, h = font.getStringSize("_")

      for i, choice in enumerate(self.choices[self.viewOffset:self.viewOffset + self.viewSize]):
        text = choice.getText(i + self.viewOffset == self.currentIndex)
        glPushMatrix()
        glRotate(v * 45, 0, 0, 1)

        # Draw arrows if scrolling is needed to see all items
        if i == 0 and self.viewOffset > 0:
          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:
          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:
          a = (math.sin(self.time) * .15 + .75) * (1 - v * 2)
          Theme.setSelectedColor(a)
          a *= -.005
          glTranslatef(a, a, a)
        else:
          Theme.setBaseColor(1 - v)

        font.render(text, (x - v / 4, y))
        v *= 2
        y += h
        glPopMatrix()
    finally:
      self.engine.view.resetProjection()
开发者ID:fretsonfire,项目名称:fof-python,代码行数:55,代码来源:Menu.py

示例8: renderTracks

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def renderTracks(self, visibility):
    w = self.boardWidth / self.strings
    v = 1.0 - visibility

    if self.editorMode:
      x = (self.strings / 2 - self.selectedString) * w
      s = 2 * w / self.strings
      z1 = -0.5 * visibility ** 2
      z2 = (self.boardLength - 0.5) * visibility ** 2
      
      glColor4f(1, 1, 1, .15)
      
      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(x - s, 0, z1)
      glVertex3f(x + s, 0, z1)
      glVertex3f(x - s, 0, z2)
      glVertex3f(x + s, 0, z2)
      glEnd()

    sw = 0.025
    for n in range(self.strings - 1, -1, -1):
      glBegin(GL_TRIANGLE_STRIP)
      Theme.setBaseColor(0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, -2)
      glVertex3f((n - self.strings / 2) * w + sw, -v, -2)
      Theme.setBaseColor((1.0 - v) * .75)
      glVertex3f((n - self.strings / 2) * w - sw, -v, -1)
      glVertex3f((n - self.strings / 2) * w + sw, -v, -1)
      Theme.setBaseColor((1.0 - v) * .75)
      glVertex3f((n - self.strings / 2) * w - sw, -v, self.boardLength * .7)
      glVertex3f((n - self.strings / 2) * w + sw, -v, self.boardLength * .7)
      Theme.setBaseColor(0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, self.boardLength)
      glVertex3f((n - self.strings / 2) * w + sw, -v, self.boardLength)
      glEnd()
      v *= 2
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:38,代码来源:Guitar.py

示例9: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    SceneClient.render(self, visibility, topMost)
    
    bigFont = self.engine.data.bigFont
    font    = self.engine.data.font

    v = ((1 - visibility) ** 2)
    
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_COLOR_MATERIAL)

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      t = self.time / 100
      w, h, = self.engine.view.geometry[2:4]
      r = .5
      if self.background:
        if self.spinnyDisabled != True and Theme.spinnyResultsDisabled != True:
          self.background.transform.reset()
          self.background.transform.translate(v * 2 * w + w / 2 + math.cos(t / 2) * w / 2 * r, h / 2 + math.sin(t) * h / 2 * r)
          self.background.transform.rotate(-t)
          self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
        self.background.draw()
      
      if self.showHighscores:
        for j,player in enumerate(self.playerList):
          #self.engine.view.setViewportHalf(len(self.playerList),j)
          scale = 0.0017
          endScroll = -.14
        
          if self.pauseScroll != None:
            self.offset = 0.0

          if self.pauseScroll > 0.5:
            self.pauseScroll = None
          if self.offset == None:
            self.offset = 0
            self.pauseScroll = 0
            self.nextHighScore()

          
          text = _("%s High Scores") % (self.scorePart)
          w, h = font.getStringSize(text)

          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + self.offset))

          text = _("Difficulty: %s") % (self.scoreDifficulty)
          w, h = font.getStringSize(text)
          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + h + self.offset))
        
          x = .01
          y = .16 + v
          
        if self.song:
          i = -1
          for i, scores in enumerate(self.song.info.getHighscores(self.scoreDifficulty, part = self.scorePart)):
            score, stars, name, scores_ext = scores
            notesHit, notesTotal, noteStreak, modVersion, modOptions1, modOptions2 = scores_ext
            if stars == 6:
              stars = 5
              perfect = 1
            else:
              perfect = 0
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
            font.render("%d." % (i + 1), (x, y + self.offset),    scale = scale)
            if notesTotal != 0:
              score = "%s %.1f%%" % (score, (float(notesHit) / notesTotal) * 100.0)
            if noteStreak != 0:
              score = "%s %d" % (score, noteStreak)
            font.render(unicode(score), (x + .05, y + self.offset),   scale = scale)
            options = ""
            #options = "%s,%s" % (modOptions1, modOptions2)
            #options = self.engine.config.prettyModOptions(options)
            w2, h2 = font.getStringSize(options, scale = scale / 2)
            font.render(unicode(options), (.6 - w2, y + self.offset),   scale = scale / 2)
            if perfect == 1:
              glColor3f(0, 1, 0)
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * .9)
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
            font.render(name, (x + .8, y + self.offset), scale = scale)
            y += h
            endScroll -= .07
            
          if self.offset < endScroll or i == -1:
            self.offset = .8
            self.nextHighScore()
            endScroll = -0.14
#.........这里部分代码省略.........
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:103,代码来源:GameResultsScene.py

示例10: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    self.engine.view.setViewport(1,0)
    SceneClient.render(self, visibility, topMost)
    
    bigFont = self.engine.data.bigFont
    font    = self.engine.data.font

    v = ((1 - visibility) ** 2)
    
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_COLOR_MATERIAL)

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      t = self.time / 100
      w, h, = self.engine.view.geometry[2:4]
      r = .5
      if self.background:
        imgwidth = self.background.width1()
        wfactor = 640.000/imgwidth
        self.background.transform.reset()
        #self.background.transform.scale(1,-1)
        self.background.transform.scale(wfactor,-wfactor)
        self.background.transform.translate(w/2,h/2)
        self.background.draw()
      
      if self.showHighscores:
        for j,player in enumerate(self.playerList):
          #self.engine.view.setViewportHalf(len(self.playerList),j)
          scale = 0.0017
          endScroll = -.14
        
          if self.pauseScroll != None:
            self.offset = 0.0

          if self.pauseScroll > 0.5:
            self.pauseScroll = None
          if self.offset == None:
            self.offset = 0
            self.pauseScroll = 0
            self.nextHighScore()

          
          # evilynux - highscore
          if self.song is not None:
            text = _("%s High Scores for %s") % (self.scorePart, Dialogs.removeSongOrderPrefixFromName(self.song.info.name))
          else:
            text = _("%s High Scores") % self.scorePart
          w, h = font.getStringSize(text)

          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + self.offset))

          text = _("Difficulty: %s") % (self.scoreDifficulty)
          w, h = font.getStringSize(text)
          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + h + self.offset))
        
          x = .01
          y = .16 + v
          
        if self.song:
          i = -1
          for i, scores in enumerate(self.song.info.getHighscores(self.scoreDifficulty, part = self.scorePart)):
            score, stars, name, scores_ext = scores
            notesHit, notesTotal, noteStreak, modVersion, modOptions1, modOptions2 = scores_ext
            if stars == 6:
              stars = 5
              perfect = 1
            else:
              perfect = 0
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
            font.render("%d." % (i + 1), (x, y + self.offset),    scale = scale)
            if notesTotal != 0:
              score = "%s %.1f%%" % (score, (float(notesHit) / notesTotal) * 100.0)
            if noteStreak != 0:
              score = "%s (%d)" % (score, noteStreak)
            font.render(unicode(score), (x + .05, y + self.offset),   scale = scale)
            options = ""
            w2, h2 = font.getStringSize(options, scale = scale / 2)
            font.render(unicode(options), (.6 - w2, y + self.offset),   scale = scale / 2)
            # evilynux - Fixed star size following Font render bugfix
            if perfect == 1 and self.theme == 2:
              glColor3f(1, 1, 0) #racer: perfect is now gold for rock band
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * 1.8)
            if perfect == 1 and self.theme < 2:
              glColor3f(0, 1, 0) #racer: perfect is green for any non-RB theme
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * 1.8)
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
#.........这里部分代码省略.........
开发者ID:Gamer125,项目名称:fofix,代码行数:103,代码来源:GameResultsScene.py

示例11: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    self.engine.view.setViewport(1,0)
    SceneClient.render(self, visibility, topMost)
    
    bigFont = self.engine.data.bigFont
    font    = self.engine.data.font

    v = ((1 - visibility) ** 2)
    
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_COLOR_MATERIAL)

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      t = self.time / 100
      w, h, = self.engine.view.geometry[2:4]
      r = .5
      if self.background:
        imgwidth = self.background.width1()
        wfactor = 640.000/imgwidth
        self.background.transform.reset()
        #self.background.transform.scale(1,-1)
        self.background.transform.scale(wfactor,-wfactor)
        self.background.transform.translate(w/2,h/2)
        self.background.draw()
      
      if self.showHighscores:
        for j,player in enumerate(self.playerList):
          #self.engine.view.setViewportHalf(len(self.playerList),j)
          scale = 0.0017
          endScroll = -.14
        
          if self.pauseScroll != None:
            self.offset = 0.0

          if self.pauseScroll > 0.5:
            self.pauseScroll = None
          if self.offset == None:
            self.offset = 0
            self.pauseScroll = 0
            self.nextHighScore()

          
          # evilynux - highscore
          if self.song is not None:
            text = _("%s High Scores for %s") % (self.scorePart, self.song.info.name)
          else:
            text = _("%s High Scores") % self.scorePart
          w, h = font.getStringSize(text)

          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + self.offset))

          text = _("Difficulty: %s") % (self.scoreDifficulty)
          w, h = font.getStringSize(text)
          Theme.setBaseColor(1 - v)
          font.render(text, (.5 - w / 2, .01 - v + h + self.offset))
        
          x = .01
          y = .16 + v
          
        if self.song:
          i = -1
          for i, scores in enumerate(self.song.info.getHighscores(self.scoreDifficulty, part = self.scorePart)):
            score, stars, name, scores_ext = scores
            notesHit, notesTotal, noteStreak, modVersion, modOptions1, modOptions2 = scores_ext
            if stars == 6:
              stars = 5
              perfect = 1
            else:
              perfect = 0
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
            font.render("%d." % (i + 1), (x, y + self.offset),    scale = scale)
            if notesTotal != 0:
              score = "%s %.1f%%" % (score, (float(notesHit) / notesTotal) * 100.0)
            if noteStreak != 0:
              score = "%s (%d)" % (score, noteStreak)
            font.render(unicode(score), (x + .05, y + self.offset),   scale = scale)
            options = ""
            w2, h2 = font.getStringSize(options, scale = scale / 2)
            font.render(unicode(options), (.6 - w2, y + self.offset),   scale = scale / 2)
            # evilynux - Fixed star size following Font render bugfix
            if perfect == 1 and self.theme == 2:
              glColor3f(1, 1, 0) #racer: perfect is now gold for rock band
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * 1.8)
            if perfect == 1 and self.theme < 2:
              glColor3f(0, 1, 0) #racer: perfect is green for any non-RB theme
            font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .6, y + self.offset), scale = scale * 1.8)
            for j,player in enumerate(self.playerList):
              if (self.time % 10.0) < 5.0 and i == self.highscoreIndex[j] and self.scoreDifficulty == player.difficulty and self.scorePart == player.part:
                Theme.setSelectedColor(1 - v)
                break
              else:
                Theme.setBaseColor(1 - v)
#.........这里部分代码省略.........
开发者ID:Gamer125,项目名称:fofix,代码行数:103,代码来源:GameResultsScene.py

示例12: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
    def render(self, visibility, topMost):
        SceneClient.render(self, visibility, topMost)

        font    = self.engine.data.font
        bigFont = self.engine.data.bigFont

        self.visibility = v = 1.0 - ((1 - visibility) ** 2)

        self.engine.view.setOrthogonalProjection(normalize = True)
        try:
            # show countdown
            if self.countdown > 1:
                Theme.setBaseColor(min(1.0, 3.0 - abs(4.0 - self.countdown)))
                text = _("Get Ready to Rock")
                w, h = font.getStringSize(text)
                font.render(text,  (.5 - w / 2, .3))
                if self.countdown < 6:
                    scale = 0.002 + 0.0005 * (self.countdown % 1) ** 3
                    text = "%d" % (self.countdown)
                    w, h = bigFont.getStringSize(text, scale = scale)
                    Theme.setSelectedColor()
                    bigFont.render(text,  (.5 - w / 2, .45 - h / 2), scale = scale)

            w, h = font.getStringSize(" ")
            y = .05 - h / 2 - (1.0 - v) * .2

            # show song name
            if self.countdown and self.song:
                Theme.setBaseColor(min(1.0, 4.0 - abs(4.0 - self.countdown)))
                Dialogs.wrapText(font, (.05, .05 - h / 2), self.song.info.name + " \n " + self.song.info.artist, rightMargin = .6, scale = 0.0015)

            Theme.setSelectedColor()

            font.render("%d" % (self.player.score + self.getExtraScoreForCurrentlyPlayedNotes()),  (.6, y))
            font.render("%dx" % self.player.getScoreMultiplier(), (.6, y + h))

            # show the streak counter and miss message
            if self.player.streak > 0 and self.song:
                text = _("%d hit") % self.player.streak
                factor = 0.0
                if self.lastPickPos:
                    diff = self.getSongPosition() - self.lastPickPos
                    if diff > 0 and diff < self.song.period * 2:
                        factor = .25 * (1.0 - (diff / (self.song.period * 2))) ** 2
                factor = (1.0 + factor) * 0.002
                tw, th = font.getStringSize(text, scale = factor)
                font.render(text, (.16 - tw / 2, y + h / 2 - th / 2), scale = factor)
            elif self.lastPickPos is not None and self.countdown <= 0:
                diff = self.getSongPosition() - self.lastPickPos
                alpha = 1.0 - diff * 0.005
                if alpha > .1:
                    Theme.setSelectedColor(alpha)
                    glPushMatrix()
                    glTranslate(.1, y + 0.000005 * diff ** 2, 0)
                    glRotatef(math.sin(self.lastPickPos) * 25, 0, 0, 1)
                    font.render(_("Missed!"), (0, 0))
                    glPopMatrix()

            # show the streak balls
            if self.player.streak >= 30:
                glColor3f(.5, .5, 1)
            elif self.player.streak >= 20:
                glColor3f(1, 1, .5)
            elif self.player.streak >= 10:
                glColor3f(1, .5, .5)
            else:
                glColor3f(.5, 1, .5)

            s = min(39, self.player.streak) % 10 + 1
            font.render(Data.BALL2 * s + Data.BALL1 * (10 - s),   (.67, y + h * 1.3), scale = 0.0011)

            # show multiplier changes
            if self.song and self.lastMultTime is not None:
                diff = self.getSongPosition() - self.lastMultTime
                if diff > 0 and diff < self.song.period * 2:
                    m = self.player.getScoreMultiplier()
                    c = (1, 1, 1)
                    if self.player.streak >= 40:
                        texture = None
                    elif m == 1:
                        texture = None
                    elif m == 2:
                        texture = self.fx2x.texture
                        c = (1, .5, .5)
                    elif m == 3:
                        texture = self.fx3x.texture
                        c = (1, 1, .5)
                    elif m == 4:
                        texture = self.fx4x.texture
                        c = (.5, .5, 1)

                    f = (1.0 - abs(self.song.period * 1 - diff) / (self.song.period * 1)) ** 2

                    # Flash the screen
                    glBegin(GL_TRIANGLE_STRIP)
                    glColor4f(c[0], c[1], c[2], (f - .5) * 1)
                    glVertex2f(0, 0)
                    glColor4f(c[0], c[1], c[2], (f - .5) * 1)
                    glVertex2f(1, 0)
                    glColor4f(c[0], c[1], c[2], (f - .5) * .25)
#.........这里部分代码省略.........
开发者ID:fculpo,项目名称:fof-reborn,代码行数:103,代码来源:GuitarScene.py

示例13: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    #MFH - display version in any menu:

    if not visibility:
      self.active = False
      return

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

      if self.fadeScreen:
        Dialogs.fadeScreen(v)
      
      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]):
        text = choice.getText(i + self.viewOffset == self.currentIndex)
        glPushMatrix()
        glRotate(v * 45, 0, 0, 1)

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

        elif self.theme == 1 and self.mainMenu:
          if not i % 2 == 1:
            scale = 0.002
          else:
            scale = 0.0016

        else:
          scale = 0.002

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

        # Draw arrows if scrolling is needed to see all items
        if i == 0 and self.viewOffset > 0:
          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:
          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:
          a = (math.sin(self.time) * .15 + .75) * (1 - v * 2)
          Theme.setSelectedColor(a)
          a *= -.005
          glTranslatef(a, a, a)
        else:
          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 = ""
        
        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*.75
        else:
          y += h
        glPopMatrix()
    
    
    finally:
      self.engine.view.resetProjection()
开发者ID:Gamer125,项目名称:fofix,代码行数:99,代码来源:Menu.py

示例14: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  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:
            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:
            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:
                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)
            Theme.setSelectedColor(a)
            a *= -.005
            glTranslatef(a, a, a)
          else:
            Theme.setBaseColor(1 - v)      
        
          #MFH - settable color through Menu constructor
          if i + self.viewOffset == self.currentIndex and self.selectedColor:
            c1,c2,c3 = self.selectedColor
#.........这里部分代码省略.........
开发者ID:Gamer125,项目名称:fofix,代码行数:103,代码来源:Menu.py

示例15: render

# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import setBaseColor [as 别名]
  def render(self, visibility, topMost):
    SceneClient.render(self, visibility, topMost)
    
    bigFont = self.engine.data.bigFont
    font    = self.engine.data.font

    v = ((1 - visibility) ** 2)
    
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_COLOR_MATERIAL)

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      t = self.time / 100
      w, h, = self.engine.view.geometry[2:4]
      r = .5
      self.background.transform.reset()
      self.background.transform.translate(v * 2 * w + w / 2 + math.cos(t / 2) * w / 2 * r, h / 2 + math.sin(t) * h / 2 * r)
      self.background.transform.rotate(-t)
      self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
      self.background.draw()
      
      if self.showHighscores:
        scale = 0.0017
        d = self.player.difficulty
        
        text = _("Highest Scores (%s)") % d
        w, h = font.getStringSize(text)
        Theme.setBaseColor(1 - v)
        font.render(text, (.5 - w / 2, .05 - v))
        
        x = .1
        y = .15 + v
        for i, scores in enumerate(self.song.info.getHighscores(d)):
          score, stars, name = scores
          if i == self.highscoreIndex and (self.time % 10.0) < 5.0:
            Theme.setSelectedColor(1 - v)
          else:
            Theme.setBaseColor(1 - v)
          font.render("%d." % (i + 1), (x, y),    scale = scale)
          font.render(unicode(score), (x + .05, y),   scale = scale)
          font.render(unicode(Data.STAR2 * stars + Data.STAR1 * (5 - stars)), (x + .25, y), scale = scale * .9)
          font.render(name, (x + .5, y), scale = scale)
          y += h
          
        if self.uploadingScores:
          Theme.setBaseColor(1 - v)
          if self.uploadResult is None:
            text = _("Uploading Scores...")
          else:
            success, ordinal = self.uploadResult
            if success:
              if ordinal > 0:
                text = _("You're #%d on the world charts!") % ordinal
              else:
                text = ""
            else:
              text = _("Score upload failed")
          font.render(text, (.05, .7 + v), scale = 0.001)
        return
      
      Theme.setBaseColor(1 - v)
      text = _("Song Finished!")
      w, h = font.getStringSize(text)
      font.render(text, (.5 - w / 2, .05 - v))
      
      text = "%d" % (self.player.score * self.anim(1000, 2000))
      w, h = bigFont.getStringSize(text)
      bigFont.render(text, (.5 - w / 2, .11 + v + (1.0 - self.anim(0, 1000) ** 3)), scale = 0.0025)
      
      if self.counter > 1000:
        scale = 0.0017
        text = (Data.STAR2 * self.stars + Data.STAR1 * (5 - self.stars))
        w, h = bigFont.getStringSize(Data.STAR1, scale = scale)
        x = .5 - w * len(text) / 2
        for i, ch in enumerate(text):
          bigFont.render(ch, (x + 100 * (1.0 - self.anim(1000 + i * 200, 1000 + (i + 1) * 200)) ** 2, .35 + v), scale = scale)
          x += w
      
      if self.counter > 2500:
        text = _("Accuracy: %d%%") % self.accuracy      
        w, h = font.getStringSize(text)
        font.render(text, (.5 - w / 2, .55 + v))
        text = _("Longest note streak: %d") % self.player.longestStreak
        w, h = font.getStringSize(text)
        font.render(text, (.5 - w / 2, .55 + h + v))
    finally:
      self.engine.view.resetProjection()
开发者ID:fretsonfire,项目名称:fof-python,代码行数:91,代码来源:GameResultsScene.py


注:本文中的Theme.setBaseColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。