proper handling for zoomin/zoomout keypress
This commit is contained in:
parent
2c9c5c126b
commit
afbf383db4
2 changed files with 8 additions and 9 deletions
1
hr.py
1
hr.py
|
@ -43,7 +43,6 @@ class LoadScreen(object):
|
|||
self.window.push_handlers(renderer)
|
||||
self.window.push_handlers(mapview)
|
||||
self.window.push_handlers(interface)
|
||||
self.window.push_handlers(self.window.keys)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
|
|
|
@ -249,6 +249,14 @@ class MapView(object):
|
|||
for i, atlas in enumerate(self.mapset.atlases):
|
||||
self.cur_objects[i] = list(set(self.cur_objects[i]))
|
||||
|
||||
def on_key_press(self, symbol, modifiers):
|
||||
if symbol == pyglet.window.key.PLUS and self.tile_size < 32:
|
||||
self.tile_size+=8
|
||||
self._init_view()
|
||||
elif symbol == pyglet.window.key.MINUS and self.tile_size > 16:
|
||||
self.tile_size-=8
|
||||
self._init_view()
|
||||
|
||||
def update(self, dt):
|
||||
try:
|
||||
if self.window.keys[pyglet.window.key.LCTRL] and \
|
||||
|
@ -272,14 +280,6 @@ class MapView(object):
|
|||
y = 0
|
||||
self.dx += x*8
|
||||
self.dy += y*8
|
||||
elif self.window.keys[pyglet.window.key.PLUS] and \
|
||||
self.tile_size < 32:
|
||||
self.tile_size+=8
|
||||
self._init_view()
|
||||
elif self.window.keys[pyglet.window.key.MINUS] and \
|
||||
self.tile_size > 16:
|
||||
self.tile_size-=8
|
||||
self._init_view()
|
||||
except KeyError:
|
||||
pass
|
||||
if self.dx or self.dy:
|
||||
|
|
Loading…
Reference in a new issue