def on_draw(self): self.parent.set_caption(str(pyglet.clock.get_fps())) gl.glClear(gl.GL_COLOR_BUFFER_BIT) gl.glColor4ub(*[255,255,255,255]) self.room.bg.blit(0,0) self.room.render() gl.glColor4ub(255,255,255,255) self.player.draw() self.room.lightbatch.draw() self.player.draw_eye() self.player.draw_integrity() if self.pause: gl.glColor4ub(50,50,50,150) left = self.message['text'].x-self.message['text'].width/2 -5 down = self.message['text'].y-self.message['text'].height/2 -5 right = self.message['text'].x+self.message['text'].width/2 + 5 up = self.message['text'].y+self.message['text'].height/2 + 5 gl.glRecti(left,down,right,up) gl.glLineWidth(2) gl.glColor4ub(200,200,200,200) gl.glBegin(gl.GL_LINE_LOOP) gl.glVertex2i(left,down) gl.glVertex2i(left,up) gl.glVertex2i(right,up) gl.glVertex2i(right,down) gl.glEnd() gl.glLineWidth(1) gl.glColor4ub(255,255,255,255) self.message['text'].draw() self.message['helper'].draw() self.message['sprite'].draw()
def draw(self): gl.glColor3ub(255,30,30) gl.glRecti(*(self.p1+self.p2)) gl.glColor3ub(150,255,45) gl.glRecti(*(self.p1+self.p3)) #gl.glColor3ub(255,255,255) self.text.draw()