def renderNeckMethod(self, visibility, offset, neck, alpha = False): #blazingamer: New neck rendering method def project(beat): return 0.125 * beat / self.beatsPerUnit # glorandwarf: was 0.12 if self.instrument.starPowerActive and self.theme == 0:#8bit color = self.engine.theme.spNoteColor #self.spColor #(.3,.7,.9) elif self.instrument.starPowerActive and self.theme == 1: color = self.engine.theme.spNoteColor #self.spColor #(.3,.7,.9) else: color = (1,1,1) v = visibility l = self.boardLength glEnable(GL_TEXTURE_2D) board_tex = array([[0.0, project(offset - 2 * self.beatsPerUnit)], [1.0, project(offset - 2 * self.beatsPerUnit)], [0.0, project(offset - 1 * self.beatsPerUnit)], [1.0, project(offset - 1 * self.beatsPerUnit)], [0.0, project(offset + l * self.beatsPerUnit * .7)], [1.0, project(offset + l * self.beatsPerUnit * .7)], [0.0, project(offset + l * self.beatsPerUnit)], [1.0, project(offset + l * self.beatsPerUnit)]], dtype=float32) #must be seperate for neck flashing. board_col = array([[color[0],color[1],color[2], 0], [color[0],color[1],color[2], 0], [color[0],color[1],color[2], v], [color[0],color[1],color[2], v], [color[0],color[1],color[2], v], [color[0],color[1],color[2], v], [color[0],color[1],color[2], 0], [color[0],color[1],color[2], 0]], dtype=float32) if alpha == True: glBlendFunc(GL_ONE, GL_ONE) neck.texture.bind() cmglDrawArrays(GL_TRIANGLE_STRIP, vertices=self.board_vtx, colors=board_col, texcoords=board_tex) if alpha == True: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glDisable(GL_TEXTURE_2D)
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()