mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 04:57:46 +00:00
A little more window initialization
This commit is contained in:
parent
7789038409
commit
8db7756d2e
1 changed files with 10 additions and 3 deletions
|
|
@ -1,26 +1,33 @@
|
|||
import moderngl_window as mglw
|
||||
from moderngl_window.context.pyglet.window import Window as PygletWindow
|
||||
from moderngl_window.timers.clock import Timer
|
||||
|
||||
from manimlib.constants import DEFAULT_PIXEL_WIDTH
|
||||
from manimlib.constants import DEFAULT_PIXEL_HEIGHT
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
|
||||
|
||||
class Window(PygletWindow):
|
||||
title = ""
|
||||
size = (DEFAULT_PIXEL_WIDTH, DEFAULT_PIXEL_HEIGHT)
|
||||
fullscreen = False
|
||||
resizable = True
|
||||
gl_version = (3, 3)
|
||||
aspect_ratio = None
|
||||
vsync = True
|
||||
samples = 1
|
||||
cursor = True
|
||||
|
||||
def __init__(self, scene, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.scene = scene
|
||||
# self.print_context_info()
|
||||
self.title = str(scene)
|
||||
# Put at the top of the screen
|
||||
self.position = (self.position[0], 0)
|
||||
|
||||
mglw.activate_context(window=self)
|
||||
self.timer = Timer()
|
||||
self.config = mglw.WindowConfig(ctx=self.ctx, wnd=self, timer=self.timer)
|
||||
self.timer.start()
|
||||
|
||||
# Delegate event handling to scene
|
||||
def pixel_coords_to_space_coords(self, px, py, relative=False):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue