Skip to content

Commit

Permalink
Merge pull request fogleman#34 from ProgVal/python3
Browse files Browse the repository at this point in the history
Fix Python 3 compatibility.
  • Loading branch information
fogleman authored Jan 9, 2017
2 parents 50c6dd2 + d7b32d5 commit 43cdaad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import division

import sys
import math
import random
import time
Expand Down Expand Up @@ -30,6 +33,9 @@

PLAYER_HEIGHT = 2

if sys.version_info[0] >= 3:
xrange = range

def cube_vertices(x, y, z, n):
""" Return the vertices of the cube at position x, y, z with size 2*n.
Expand Down Expand Up @@ -116,7 +122,7 @@ def sectorize(position):
"""
x, y, z = normalize(position)
x, y, z = x / SECTOR_SIZE, y / SECTOR_SIZE, z / SECTOR_SIZE
x, y, z = x // SECTOR_SIZE, y // SECTOR_SIZE, z // SECTOR_SIZE
return (x, 0, z)


Expand Down Expand Up @@ -761,7 +767,7 @@ def on_resize(self, width, height):
# reticle
if self.reticle:
self.reticle.delete()
x, y = self.width / 2, self.height / 2
x, y = self.width // 2, self.height // 2
n = 10
self.reticle = pyglet.graphics.vertex_list(4,
('v2i', (x - n, y, x + n, y, x, y - n, x, y + n))
Expand Down

0 comments on commit 43cdaad

Please sign in to comment.