This commit is contained in:
shenjack 2023-08-15 23:30:34 +08:00
parent 6fefb4460b
commit 42eef6743d
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -7,7 +7,7 @@
from typing import Tuple, Optional from typing import Tuple, Optional
# from pyglet.gl import gl_compat from pyglet.gl import gl_compat, gl
from pyglet.math import Mat4, Vec3 from pyglet.math import Mat4, Vec3
from pyglet.graphics import Group from pyglet.graphics import Group
@ -194,7 +194,13 @@ class CenterGroupCamera(GroupCamera):
def set_state(self): def set_state(self):
self._previous_view = self._window.view self._previous_view = self._window.view
# gl_compat.glPushMatrix() # gl_compat.glPushMatrix()
# gl_compat.glMatrixMode(gl_compat.GL_MODELVIEW)
#
# gl_compat.glTranslatef(self._view_x, self._view_y, 0)
# gl_compat.glTranslated(self._window.width / 2, self._window.height / 2, 0)
# gl_compat.glTranslated(self._window.dx, self._window.dy, 0)s
# gl_compat.glScaled(self._zoom, self._zoom, 1)
x = (self._window.width / 2) / self._zoom + (self._view_x / self._zoom) x = (self._window.width / 2) / self._zoom + (self._view_x / self._zoom)
y = (self._window.height / 2) / self._zoom + (self._view_y / self._zoom) y = (self._window.height / 2) / self._zoom + (self._view_y / self._zoom)
@ -245,6 +251,7 @@ class CenterGroupFrame(Group):
self._zoom = min(max(value, self.min_zoom), self.max_zoom) self._zoom = min(max(value, self.min_zoom), self.max_zoom)
# def set_state(self): # def set_state(self):