(self)
| 2455 | |
| 2456 | # draw the target cross in the center |
| 2457 | def crosshair_update(self): |
| 2458 | if not cfg.CROSSHAIRS: |
| 2459 | return |
| 2460 | if (not mode.paused) and 'position1' in mode.modalities[mode.mode] and not cfg.VARIABLE_NBACK: |
| 2461 | if not self.crosshair_visible: |
| 2462 | length_of_crosshair = scale_to_height(8) |
| 2463 | if have_shapes: |
| 2464 | self.v_crosshair = [pyglet.shapes.Line(self.center_x - length_of_crosshair, self.center_y, |
| 2465 | self.center_x + length_of_crosshair, self.center_y, |
| 2466 | color=self.color, batch=batch), |
| 2467 | pyglet.shapes.Line(self.center_x, self.center_y - length_of_crosshair, |
| 2468 | self.center_x, self.center_y + length_of_crosshair, |
| 2469 | color=self.color, batch=batch)] |
| 2470 | else: |
| 2471 | self.v_crosshair = batch.add(4, pyglet.gl.GL_LINES, None, ('v2i', ( |
| 2472 | self.center_x - length_of_crosshair, self.center_y, |
| 2473 | self.center_x + length_of_crosshair, self.center_y, |
| 2474 | self.center_x, self.center_y - length_of_crosshair, |
| 2475 | self.center_x, self.center_y + length_of_crosshair)), ('c3B', self.color4)) |
| 2476 | self.crosshair_visible = True |
| 2477 | else: |
| 2478 | if self.crosshair_visible: |
| 2479 | if have_shapes: |
| 2480 | for i in range(2): |
| 2481 | self.v_crosshair[i].delete() |
| 2482 | else: |
| 2483 | self.v_crosshair.delete() |
| 2484 | self.crosshair_visible = False |
| 2485 | |
| 2486 | |
| 2487 | # this class controls the visual cues (colored squares). |
no test coverage detected