set up best config WIP

This commit is contained in:
cecilkorik 2024-02-05 00:35:30 -05:00
parent 3a643d9864
commit ea57844c33
2 changed files with 29 additions and 5 deletions

View file

@ -8,6 +8,25 @@ def get_config() -> dict:
return config.init
def get_best_config(self):
configs = None
try_configs = [pyggl.Config(double_buffer=True, depth_size=24, major_version=3, minor_version=3),
gl.Config(double_buffer=True, depth_size=16, major_version=3, minor_version=3),
None]
for tryc in try_configs:
try:
configs = (tryc)
break
except window.NoSuchConfigException:
pass
if not configs:
raise window.NoSuchConfigException()
return configs[0]
def init_window() -> None:
global window
@ -25,6 +44,9 @@ def init_window() -> None:
# an available resolution
pass
window = pyglet.window.Window()
display = pyglet.canvas.get_display()
screens = display.get_screens()
windows = []
for screen in screens:
windows.append(window.Window(fullscreen=True, screen=screen))
window = pyglet.window.Window())

View file

@ -2,7 +2,9 @@ import pyglet
import engine
import unittest
unittest.main()
unittest.main(exit=False)
print("Hello!!!")
engine.screen.init_window()
@ -12,7 +14,7 @@ label = pyglet.text.Label('Hello, world',
x=window.width//2, y=window.height//2,
anchor_x='center', anchor_y='center')
@window.event
@pyglet.window.event
def on_draw():
engine.screen.window.clear()
label.draw()