def onWindowRender(deltaT): global flag_textures flag_value = info.graphics.flag texture_id = flag_textures[flag_value] ac.glColor4f(1.0, 1.0, 1.0, FLAG_BACKGROUND_OPACITY) ac.glQuadTextured(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, texture_id)
def texture_rect(x: int, y: int, w: int, h: int, color: Color, tex_id: int = -1, tex: Texture = None): ac.glColor4f(color.r, color.g, color.b, color.a) if tex_id != -1: ac.glQuadTextured(x, y, w, h, tex_id) elif tex: ac.glQuadTextured(x, y, w, h, tex.texture)
def draw(self, rect, texture_id=None) -> None: """ Draws the box background. """ if self.size > 0.0 and self.border[3] > 0.0: twice = self.size * 2.0 ac.glColor4f(*self.border) ac.glQuad(rect[0] - self.size, rect[1] - self.size, rect[2] + twice, rect[3] + twice) ac.glColor4f(*self.color) if texture_id is None: ac.glQuad(*rect) else: ac.glQuadTextured(rect[0], rect[1], rect[2], rect[3], texture_id)
def drawIndicators(maxIndicatorL, maxIndicatorR, alpha): if helipicapewcar.showIndicators and alpha > 0: #left side if maxIndicatorL == 1: ac.glColor4f(indicator1Colors[0], indicator1Colors[1], indicator1Colors[2], alpha) #yellow ac.glQuadTextured(0, helipicapewcar.yOff * z - 152 * z / 2, 100 * z, 152 * z, texture_indicator_left) elif maxIndicatorL == 2: ac.glColor4f(indicator2Colors[0], indicator2Colors[1], indicator2Colors[2], alpha) #orange ac.glQuadTextured(0, helipicapewcar.yOff * z - 152 * z / 2, 100 * z, 152 * z, texture_indicator_left) #right side if maxIndicatorR == 1: ac.glColor4f(indicator1Colors[0], indicator1Colors[1], indicator1Colors[2], alpha) #yellow ac.glQuadTextured(helipicapewcar.xOff * z, helipicapewcar.yOff * z - 152 * z / 2, 100 * z, 152 * z, texture_indicator_right) elif maxIndicatorR == 2: ac.glColor4f(indicator2Colors[0], indicator2Colors[1], indicator2Colors[2], alpha) #orange ac.glQuadTextured(helipicapewcar.xOff * z, helipicapewcar.yOff * z - 152 * z / 2, 100 * z, 152 * z, texture_indicator_right)
def drawCars(): global hSession #The whole appearance is dependent on the highest alpha setting of the near cars, #so we need to figure that one out. As we already iterate we also get the indicator values maxOpacity = 0.0 maxIndicatorL = 0 maxIndicatorR = 0 for c in hSession.nearcars: if c.maxOpacity > maxOpacity: maxOpacity = c.maxOpacity if c.overlapIndicatorL > maxIndicatorL: maxIndicatorL = c.overlapIndicatorL if c.overlapIndicatorR > maxIndicatorR: maxIndicatorR = c.overlapIndicatorR #nothing to draw is nothing to draw if maxOpacity == 0.0: return #First: Draw background. It's dependent on the setting as well as the maximum alpha value if showBackgroundPic == 1: ac.glColor4f(1, 1, 1, maxOpacity) ac.glQuadTextured(0, 0, 200 * z, 200 * z, texture_radar) #basicall we iterate all the (near) cars and try to draw points or #whatever shapes of them - relative to the player's position and direction #first we check wether to show any indicators if helipicapewcar.showIndicators: drawIndicators(maxIndicatorL, maxIndicatorR, maxOpacity) if showCars: #then we draw all near cars for c in hSession.nearcars: c.drawYourself() # then we'll draw the players car at the center. hSession.player.maxOpacity = maxOpacity hSession.player.drawYourself()
def draw(self): if self.color is not None: ac.glColor4f(*self.color) ac.glQuadTextured(self.pos_x, self.pos_y, self.width, self.height, self.id)