def on_draw(): pyglet.gl.glClearColor(240,240,240,255) window.clear() fps_display.draw() # static attach points pyglet.gl.glColor3f(1,0,1) pyglet.gl.glPointSize(6) a = [] for b in static_bs: a += [b.position.x, b.position.y] pyglet.graphics.draw(len(a)/2, pyglet.gl.GL_POINTS, ('v2f',a)) # web crossings / bodies pyglet.gl.glColor3f(.8,.8,.8) a = [] for b in bs: a += [b.position.x, b.position.y] pyglet.gl.glPointSize(4) pyglet.graphics.draw(len(a)/2, pyglet.gl.GL_POINTS, ('v2f',a)) # web net / constraints a = [] for j in space.constraints: a += [j.a.position.x, j.a.position.y, j.b.position.x, j.b.position.y] pass pyglet.graphics.draw(len(a)/2, pyglet.gl.GL_LINES, ('v2f',a)) # anything else draw(space)
def update(self, keys_held): self.scrollable_menu.update() self.keys_held = keys_held self.space.step(0.015) self.camera.update((self.cameraPosX,self.cameraPosY), self.camera_zoom, 0, [10,10],20) self.menu.update() if pyglet.window.key.E in self.keys_held: self.editor_label.set_style('background_color', (0,0,0,80)) self.editor_label.color = (255,25,25,150) else: self.editor_label.set_style('background_color', (0,0,0,0)) self.editor_label.color = (255,25,25,0) glClearColor(.9,.9,.9,1) if not self.debug: self.level_batch.draw() if self.debug: self.level_batch.draw() pyglet_util.draw(self.space) self.debug_batch.draw() self.camera.hud_mode() self.ui_batch.draw()
def on_draw(): pyglet.gl.glClearColor(240, 240, 240, 255) window.clear() fps_display.draw() # static attach points pyglet.gl.glColor3f(1, 0, 1) pyglet.gl.glPointSize(6) a = [] for b in static_bs: a += [b.position.x, b.position.y] pyglet.graphics.draw(len(a) / 2, pyglet.gl.GL_POINTS, ('v2f', a)) # web crossings / bodies pyglet.gl.glColor3f(.8, .8, .8) a = [] for b in bs: a += [b.position.x, b.position.y] pyglet.gl.glPointSize(4) pyglet.graphics.draw(len(a) / 2, pyglet.gl.GL_POINTS, ('v2f', a)) # web net / constraints a = [] for j in space.constraints: a += [j.a.position.x, j.a.position.y, j.b.position.x, j.b.position.y] pass pyglet.graphics.draw(len(a) / 2, pyglet.gl.GL_LINES, ('v2f', a)) # anything else draw(space)