Skip to content

Commit

Permalink
Make adding blocks work on OSX.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesstess committed Apr 28, 2013
1 parent a76ca15 commit eeaaba3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pyglet import image
from pyglet.gl import *
from pyglet.graphics import TextureGroup
from pyglet.window import key
from pyglet.window import key, mouse

TICKS_PER_SEC = 60

Expand Down Expand Up @@ -669,14 +669,15 @@ def on_mouse_press(self, x, y, button, modifiers):
if self.exclusive:
vector = self.get_sight_vector()
block, previous = self.model.hit_test(self.position, vector)
if button == pyglet.window.mouse.LEFT:
if block:
texture = self.model.world[block]
if texture != STONE:
self.model.remove_block(block)
else:
if (button == mouse.RIGHT) or \
((button == mouse.LEFT) and (modifiers & key.MOD_CTRL)):
# ON OSX, control + left click = right click.
if previous:
self.model.add_block(previous, self.block)
elif button == pyglet.window.mouse.LEFT and block:
texture = self.model.world[block]
if texture != STONE:
self.model.remove_block(block)
else:
self.set_exclusive_mouse(True)

Expand Down

0 comments on commit eeaaba3

Please sign in to comment.