basilisk-engine 0.1.20__py3-none-any.whl → 0.1.22__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of basilisk-engine might be problematic. Click here for more details.
- basilisk/engine.py +15 -5
- basilisk/render/post_process.py +7 -0
- {basilisk_engine-0.1.20.dist-info → basilisk_engine-0.1.22.dist-info}/METADATA +1 -1
- {basilisk_engine-0.1.20.dist-info → basilisk_engine-0.1.22.dist-info}/RECORD +6 -6
- {basilisk_engine-0.1.20.dist-info → basilisk_engine-0.1.22.dist-info}/WHEEL +0 -0
- {basilisk_engine-0.1.20.dist-info → basilisk_engine-0.1.22.dist-info}/top_level.txt +0 -0
basilisk/engine.py
CHANGED
|
@@ -39,8 +39,10 @@ class Engine():
|
|
|
39
39
|
"""Object containing information about the user's mouse"""
|
|
40
40
|
root: str
|
|
41
41
|
"""Path to the root directory containing internal data"""
|
|
42
|
+
event_resize: bool
|
|
43
|
+
"""Bool for if a resize event has occured this frame"""
|
|
42
44
|
|
|
43
|
-
def __init__(self, win_size=(800, 800), title="Basilisk Engine", vsync=None, grab_mouse=True, headless=False) -> None:
|
|
45
|
+
def __init__(self, win_size=(800, 800), title="Basilisk Engine", vsync=None, max_fps=None, grab_mouse=True, headless=False, resizable=True) -> None:
|
|
44
46
|
"""
|
|
45
47
|
Basilisk Engine Class. Sets up the engine enviornment and allows the user to interact with Basilisk
|
|
46
48
|
Args:
|
|
@@ -60,6 +62,7 @@ class Engine():
|
|
|
60
62
|
|
|
61
63
|
# Save the window size
|
|
62
64
|
self.win_size = win_size
|
|
65
|
+
self.event_resize = None
|
|
63
66
|
|
|
64
67
|
pg.init()
|
|
65
68
|
# Initialize pygame and OpenGL attributes
|
|
@@ -68,13 +71,17 @@ class Engine():
|
|
|
68
71
|
pg.display.gl_set_attribute(pg.GL_CONTEXT_PROFILE_MASK, pg.GL_CONTEXT_PROFILE_CORE)
|
|
69
72
|
# Check vsync against platform defaults
|
|
70
73
|
if vsync == None: vsync = True if platform == 'linux' else False
|
|
74
|
+
self.max_fps = max_fps
|
|
71
75
|
# Pygame display init
|
|
72
76
|
if headless:
|
|
73
77
|
pg.display.set_mode((300, 50), vsync=vsync, flags=pg.OPENGL | pg.DOUBLEBUF)
|
|
74
78
|
pg.display.iconify()
|
|
75
79
|
else:
|
|
76
|
-
pg.display.set_mode(self.win_size, vsync=vsync, flags=pg.OPENGL | pg.DOUBLEBUF | pg.RESIZABLE)
|
|
77
|
-
|
|
80
|
+
if resizable: pg.display.set_mode(self.win_size, vsync=vsync, flags=pg.OPENGL | pg.DOUBLEBUF | pg.RESIZABLE)
|
|
81
|
+
else: pg.display.set_mode(self.win_size, vsync=vsync, flags=pg.OPENGL | pg.DOUBLEBUF)
|
|
82
|
+
|
|
83
|
+
self.caption = title
|
|
84
|
+
if title: pg.display.set_caption(title)
|
|
78
85
|
|
|
79
86
|
# Init sound
|
|
80
87
|
pg.mixer.pre_init(44100, -16, 2, 512)
|
|
@@ -122,9 +129,11 @@ class Engine():
|
|
|
122
129
|
"""
|
|
123
130
|
|
|
124
131
|
# Tick the clock and get delta time
|
|
125
|
-
self.delta_time = self.clock.tick() / 1000
|
|
132
|
+
if self.max_fps: self.delta_time = self.clock.tick(self.max_fps) / 1000
|
|
133
|
+
else: self.delta_time = self.clock.tick() / 1000
|
|
126
134
|
self.time += self.delta_time
|
|
127
|
-
pg.display.set_caption(f"FPS: {round(self.clock.get_fps())}")
|
|
135
|
+
if not self.caption: pg.display.set_caption(f"FPS: {round(self.clock.get_fps())}")
|
|
136
|
+
self.event_resize = False
|
|
128
137
|
|
|
129
138
|
# Update the previous input lists for the next frame
|
|
130
139
|
self.previous_keys = self.keys
|
|
@@ -141,6 +150,7 @@ class Engine():
|
|
|
141
150
|
return
|
|
142
151
|
if event.type == pg.VIDEORESIZE:
|
|
143
152
|
# Updates the viewport
|
|
153
|
+
self.event_resize = True
|
|
144
154
|
self.win_size = (event.w, event.h)
|
|
145
155
|
self.ctx.viewport = (0, 0, event.w, event.h)
|
|
146
156
|
self.scene.camera.use()
|
basilisk/render/post_process.py
CHANGED
|
@@ -61,6 +61,13 @@ class PostProcess:
|
|
|
61
61
|
|
|
62
62
|
raise ValueError(f'PostProces.apply: Invalid postprocess source type {type(source)}')
|
|
63
63
|
|
|
64
|
+
def resize(self, size: tuple=None):
|
|
65
|
+
"""
|
|
66
|
+
Resize the post process
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
self.size = size if size else self.engine.win_size
|
|
70
|
+
|
|
64
71
|
def _render_post_process(self, source: mgl.Texture):
|
|
65
72
|
# Clear and use the fbo as a render target
|
|
66
73
|
self.fbo.use()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
basilisk/__init__.py,sha256=nltSEm5HK3aeg1VSkYBEBGLj7DcFzUwt4yZUmEJQ8EM,602
|
|
2
2
|
basilisk/config.py,sha256=ynTRlX633DGoEtZOeAK8KNJF6offV3k3XFD7cia3Keg,61
|
|
3
|
-
basilisk/engine.py,sha256=
|
|
3
|
+
basilisk/engine.py,sha256=qfyUk_o0gVrVc-3sCp2qbBNCEx0MsfHI5VbTAVZ9PsE,7441
|
|
4
4
|
basilisk/scene.py,sha256=sa8UIV1MH-4OEmlc4geaSHBmzSPRNFS8g5MsO-XjwNA,12153
|
|
5
5
|
basilisk/audio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
basilisk/audio/sound.py,sha256=BjqaPv_07iD_-NDRy1cc0TS4PJzAnQc4hfsW9ntNjGQ,719
|
|
@@ -76,7 +76,7 @@ basilisk/render/light.py,sha256=hFqODv9iK4GEDZeDyBHxOWwwd4v8Pm089_xoScBMjVY,3879
|
|
|
76
76
|
basilisk/render/light_handler.py,sha256=Le5InqqjgglSXUu7MwkVVsb7WbNJeRkRKldYDQGr6kg,2161
|
|
77
77
|
basilisk/render/material.py,sha256=JmmwCxSYkPLHw73bH-7SzPo5ewzbU3QPTIvI_2pInXQ,9655
|
|
78
78
|
basilisk/render/material_handler.py,sha256=dbfQs0u7qkEan0e0FsnqPpxbmkSNAQmH2B9jv4vx-bs,4242
|
|
79
|
-
basilisk/render/post_process.py,sha256=
|
|
79
|
+
basilisk/render/post_process.py,sha256=w71zgvnc1VyQAK7xTAyEe1FsUBDzch_6TrkhxZ27MgA,5098
|
|
80
80
|
basilisk/render/shader.py,sha256=C4LtkAqC_QE1I9ftiFBTsCNM9uv811gOAyriXuqGRKk,3988
|
|
81
81
|
basilisk/render/shader_handler.py,sha256=G3cQ_tTIC_GUa68MP_l_VycMxqfZq2IyZqJQeipmUZk,2579
|
|
82
82
|
basilisk/render/sky.py,sha256=TwLJ_6dYWCOAb06HZocrRdBzlbR6mQ0ojmmJgCC6im4,4910
|
|
@@ -97,7 +97,7 @@ basilisk/shaders/particle.frag,sha256=Cv8cWQpVVQvhZeWj3NqL0D5nLtSO3EWV0VzOU-ZVL4
|
|
|
97
97
|
basilisk/shaders/particle.vert,sha256=ElXzT7ywiZ0SjrFcUistVDBi4wOobQ7_J5O7XVxrsVs,3027
|
|
98
98
|
basilisk/shaders/sky.frag,sha256=vTmZ1Xsd601_gmeBRfLYodHuBoBDI-M_1IybRt0ZDFk,178
|
|
99
99
|
basilisk/shaders/sky.vert,sha256=v_BSdnMiljSJGPqno-J_apAiom38IrBzbDoxM7pIgwI,345
|
|
100
|
-
basilisk_engine-0.1.
|
|
101
|
-
basilisk_engine-0.1.
|
|
102
|
-
basilisk_engine-0.1.
|
|
103
|
-
basilisk_engine-0.1.
|
|
100
|
+
basilisk_engine-0.1.22.dist-info/METADATA,sha256=dCFBegbwaCFFRnZnUwmFQq-pK6sgZ3buKRDtLziFL5k,1147
|
|
101
|
+
basilisk_engine-0.1.22.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
102
|
+
basilisk_engine-0.1.22.dist-info/top_level.txt,sha256=enlSYSf7CUyAly1jmUCNNGInTbaFUjGk4SKwyckZQkw,9
|
|
103
|
+
basilisk_engine-0.1.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|