parent
72955afba8
commit
9f3d6fe0e9
@ -339,7 +339,7 @@ class Boss(Thread):
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def on_mouse_move(self, window, xpos, ypos):
|
def on_mouse_move(self, window, xpos, ypos):
|
||||||
mouse_cursor_pos[:2] = xpos, ypos
|
mouse_cursor_pos[:2] = int(xpos * viewport_size.x_ratio), int(ypos * viewport_size.y_ratio)
|
||||||
self.show_mouse_cursor()
|
self.show_mouse_cursor()
|
||||||
w = self.window_for_pos(xpos, ypos)
|
w = self.window_for_pos(xpos, ypos)
|
||||||
if w is not None:
|
if w is not None:
|
||||||
|
|||||||
@ -45,13 +45,14 @@ del _get_config_dir
|
|||||||
|
|
||||||
class ViewportSize:
|
class ViewportSize:
|
||||||
|
|
||||||
__slots__ = ('width', 'height')
|
__slots__ = ('width', 'height', 'x_ratio', 'y_ratio')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.width = self.height = 1024
|
self.width = self.height = 1024
|
||||||
|
self.x_ratio = self.y_ratio = 1.0
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '(width={}, height={})'.format(self.width, self.height)
|
return '(width={}, height={}, x_ratio={}, y_ratio={})'.format(self.width, self.height, self.x_ratio, self.y_ratio)
|
||||||
|
|
||||||
|
|
||||||
def get_boss():
|
def get_boss():
|
||||||
|
|||||||
@ -108,6 +108,9 @@ def run_app(opts, args):
|
|||||||
with open(logo_data_file, 'rb') as f:
|
with open(logo_data_file, 'rb') as f:
|
||||||
window.set_icon(f.read(), 256, 256)
|
window.set_icon(f.read(), 256, 256)
|
||||||
viewport_size.width, viewport_size.height = window.get_framebuffer_size()
|
viewport_size.width, viewport_size.height = window.get_framebuffer_size()
|
||||||
|
w, h = window.get_window_size()
|
||||||
|
viewport_size.x_ratio = viewport_size.width / float(w)
|
||||||
|
viewport_size.y_ratio = viewport_size.height / float(h)
|
||||||
glewInit()
|
glewInit()
|
||||||
boss = Boss(window, opts, args)
|
boss = Boss(window, opts, args)
|
||||||
boss.start()
|
boss.start()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user